Closed
Bug 221422
Opened 21 years ago
Closed 21 years ago
Unix builds after 2003/09/13 don't start when run with a relative path
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
People
(Reporter: pkwarren, Assigned: pkwarren)
References
Details
Attachments
(3 files, 1 obsolete file)
|
27.16 KB,
text/plain
|
Details | |
|
50.20 KB,
text/plain
|
Details | |
|
1.01 KB,
patch
|
darin.moz
:
review+
dougt
:
superreview+
|
Details | Diff | Splinter Review |
The last working daily build for AIX was on 2003/09/13. All subsequent builds fail to start, exiting with return code 4. I have not yet been able to check out a build from that time to see exactly what the problem is, but initially I think it may have something to do with the checkin for Bug 179834.
| Assignee | ||
Comment 1•21 years ago
|
||
These are the checkins between 2003/09/13 08:00:00 and 2003/09/14 08:00:00: http://makeashorterlink.com/?L23D51F16
Comment 2•21 years ago
|
||
Hrm, hase someone got a debug build? If my checkin is to blame you will get some interesting warnings during startup. Really, though, I can't see how I would be to blame for this unless nsTHashtable itself was misbehaving.
| Assignee | ||
Comment 3•21 years ago
|
||
I am in the process of building an updated trunk debug build. I believe the last time I tried to bring one up it gave errors about not being able to find res://gre/... files, which is why I thought it might have something to do with the checkin for Bug 179834.
| Assignee | ||
Comment 4•21 years ago
|
||
This is a log from the startup of a debug build on AIX.
Comment 5•21 years ago
|
||
Philip, can you run the following script in xpcshell (the debug build) and post
back the results?
const C = Components.classes;
const I = Components.interfaces;
dirService = C["@mozilla.org/file/directory_service;1"].getService(I.nsIProperties);
appDir = dirService.get("CurProcD", I.nsIFile);
print("Applicaiton directory is: " + appDir.path + "\n");
greDir = dirService.get("GreD", I.nsIFile);
print("GRE directory is: " + greDir.path + "\n");
ioS = C["@mozilla.org/network/io-service;1"].getService(I.nsIIOService);
resHandler = ioS.getProtocolHandler("resource");
resHandler = resHandler.QueryInterface(I.nsIResProtocolHandler);
greMapping = resHandler.getSubstitution("gre");
print("resource://gre/ mapping = " + greMapping.spec + "\n");
| Assignee | ||
Comment 6•21 years ago
|
||
$ LIBPATH=. ./xpcshell -f xpcshell.script Application directory is: /home/pkw/sb/moz14/src/nsmoz/mozilla/obj-opt/dist/bin GRE directory is: /home/pkw/sb/moz14/src/nsmoz/mozilla/obj-opt/dist/bin uncaught exception: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIResProtocolHandler.getSubstitution]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: xpcshell.script :: <TOP_LEVEL> :: line 16" data: no]
Comment 7•21 years ago
|
||
Ugh! That's bad, and would cause the other problems in that log. Without a machine for testing I'm somewhat at a loss, but I would start by putting printf()s in nsResProtocolHandler::Init() or stepping through that function to see whether anything is failing there. Could you also run the TestHashtables test program and see whether that reports any failures?
| Assignee | ||
Comment 8•21 years ago
|
||
As far as I can tell, the output of TestHashtables looks ok. Its pretty verbose though.
| Assignee | ||
Comment 9•21 years ago
|
||
Ok here is a log (NSPR_LOG_MODULES=nsResProtocol:5) with some additions by me: This is for the first call to AddSpecialDir in Init(): 1[20057f48]: nsResProtocolHandler::AddSpecialDir(aSpecialDir="CurProcD", aSubstitution="") 1[20057f48]: file->nativePath="/home/pkw/sb/mozilla/trunk/mozilla/obj-debug/dist/bin" 1[20057f48]: nsResProtocolHandler::SetSubstitution(root="", baseURI=0x20aadcb8, baseURI->Path="/home/pkw/sb/mozilla/trunk/mozilla/obj-debug/dist/bin/") This is for the second call to AddSpecialDir in Init(): 1[20057f48]: nsResProtocolHandler::AddSpecialDir(aSpecialDir="GreD", aSubstitution="gre") 1[20057f48]: file->nativePath="." 1[20057f48]: nsResProtocolHandler::SetSubstitution(root="gre", baseURI=0x20aae168, baseURI->Path="/") So for some reason, when run with the command "./mozilla" in dist/bin, the GreD variable is set to ".", which when turned into a nsIURI gets the path "/". Now when I run Mozilla with its full path (i.e. /home/pkw/sb/mozilla/trunk/mozilla/obj-debug/dist/bin/mozilla), it starts correctly and I get the following log entries: 1[20057f48]: nsResProtocolHandler::AddSpecialDir(aSpecialDir="CurProcD", aSubstitution="") 1[20057f48]: file->nativePath="/home/pkw/sb/mozilla/trunk/mozilla/obj-debug/dist/bin" 1[20057f48]: nsResProtocolHandler::SetSubstitution(root="", baseURI=0x209d0748, baseURI->Path="/home/pkw/sb/mozilla/trunk/mozilla/obj-debug/dist/bin/") 1[20057f48]: nsResProtocolHandler::AddSpecialDir(aSpecialDir="GreD", aSubstitution="gre") 1[20057f48]: file->nativePath="/home/pkw/sb/mozilla/trunk/mozilla/obj-debug/dist/bin" 1[20057f48]: nsResProtocolHandler::SetSubstitution(root="gre", baseURI=0x209d0bf8, baseURI->Path="/home/pkw/sb/mozilla/trunk/mozilla/obj-debug/dist/bin/") In the Mozilla startup script, the MOZILLA_FIVE_HOME variable is set to `dirname $0`, so in the first case it is ".", in the second one it is "/home/pkw/sb/mozilla/trunk/mozilla/obj-debug/dist/bin". Maybe there is just a path that needs to be normalized somewhere?
Comment 10•21 years ago
|
||
Beautiful work. That is a problem, because initializing a nsILocalFile with a relative path doesn't work, but we don't fail properly. I can think of several solutions 1) make initializing an nsILocalFile work correctly with a relative path (i.e. make the path absolute during initialization) 2) in the standalone glue, use some sort of helper function to make a relative path absolute 3) in the run-mozilla script, make the MOZILLA_FIVE_HOME absolute (using `pwd` I suppose).
| Assignee | ||
Comment 11•21 years ago
|
||
You probably just want to call nsILocalFile->Normalize at the right location, I just can't find where that is right now. Where is the GreD directory initialized?
Comment 12•21 years ago
|
||
It appears that normalize() is already called. The comments for nsILocalFile specifically disallow initializing it with a relative path. http://lxr.mozilla.org/seamonkey/source/xpcom/io/nsDirectoryService.cpp#256
| Assignee | ||
Comment 13•21 years ago
|
||
I don't know if that's where the value for NS_GRE_DIR is being set. I added some printfs to nsDirectoryService::Get() and nsDirectoryService::Set(), and here's what I'm seeing: nsDirectoryService::Get(prop=GreD) Found GREDir value in mProviders nsDirectoryService::Set(prop=GreD) Setting GreD to path . Then later on: nsDirectoryService::Get(prop=GreD) Found GREDir value in hash
Comment 14•21 years ago
|
||
somewhat related: bug 183871 comment 31
Comment 15•21 years ago
|
||
Hack # 3 has solved my problems with Mozilla-solaris-sparc2.7 ,probably related to bugs 221405 220777,221048, etc. etc . etc. "3) in the run-mozilla script, make the MOZILLA_FIVE_HOME absolute (using `pwd` I suppose). "
| Assignee | ||
Comment 16•21 years ago
|
||
Seems to fix the problem on my end...
| Assignee | ||
Updated•21 years ago
|
Attachment #132828 -
Flags: superreview?(dougt)
Attachment #132828 -
Flags: review?(darin)
Comment 17•21 years ago
|
||
Hack #3 only seems to work if I run it directly from my build directory, just in case that question was directed at me
| Assignee | ||
Comment 18•21 years ago
|
||
Reassigning bug.
Assignee: general → pkw
Component: Browser-General → XPCOM
| Assignee | ||
Comment 19•21 years ago
|
||
Changing QA contact.
Status: NEW → ASSIGNED
QA Contact: general → scc
| Assignee | ||
Comment 20•21 years ago
|
||
*** Bug 220777 has been marked as a duplicate of this bug. ***
| Assignee | ||
Comment 21•21 years ago
|
||
*** Bug 221048 has been marked as a duplicate of this bug. ***
Comment 22•21 years ago
|
||
*** Bug 221405 has been marked as a duplicate of this bug. ***
Comment 23•21 years ago
|
||
Comment on attachment 132828 [details] [diff] [review] Patch v1 where is the path coming from? Is it from an env var or from the gre.conf file? Why can't that just be normalized?
Attachment #132828 -
Flags: superreview?(dougt) → superreview-
| Assignee | ||
Comment 24•21 years ago
|
||
This path is coming from the MOZILLA_FIVE_HOME environment variable. I changed
the GRE code to normalize the path so it behaves consistently with the
GetCurrentProcessDirectory function in nsDirectoryService.cpp (snippet shown here):
251 char *moz5 = PR_GetEnv("MOZILLA_FIVE_HOME");
252
253 if (moz5)
254 {
255 localFile->InitWithNativePath(nsDependentCString(moz5));
256 localFile->Normalize();
257 *aFile = localFile;
258 return NS_OK;
259 }
Comment 25•21 years ago
|
||
can you move the normalization into GetGREDirectoryPath()
Updated•21 years ago
|
Attachment #132828 -
Flags: review?(darin)
| Assignee | ||
Updated•21 years ago
|
Attachment #132828 -
Attachment is obsolete: true
| Assignee | ||
Comment 26•21 years ago
|
||
This patch moves the normalization into GetCurrentProcessDirectory(). This assumes this only place where relative paths will be coming from is the MOZILLA_FIVE_HOME environment variable, and not from GRE configuration files.
| Assignee | ||
Updated•21 years ago
|
Attachment #133422 -
Flags: superreview?(dougt)
Attachment #133422 -
Flags: review?(darin)
Comment 27•21 years ago
|
||
Comment on attachment 133422 [details] [diff] [review] Patch v2 r=dougt
Attachment #133422 -
Flags: superreview?(dougt) → superreview+
Comment 28•21 years ago
|
||
Comment on attachment 133422 [details] [diff] [review] Patch v2 what about the #ifdef's?
Comment 29•21 years ago
|
||
nevermind that last comment, we are in a "#elif defined(XP_UNIX)"
Comment 30•21 years ago
|
||
Comment on attachment 133422 [details] [diff] [review] Patch v2 >Index: xpcom/glue/standalone/nsGREDirServiceProvider.cpp >+ if (realpath(moz5, buf)) >+ resultPath = strdup(buf); >+ else >+ resultPath = strdup(moz5); reading the linux (rh9) man page on realpath doesn't give me much confidence that this is going to always work. this bit is interesting: CONFORMING TO In BSD 4.4 and Solaris the limit on the pathname length is MAXPATHLEN (found in <sys/param.h>). The SUSv2 prescribes PATH_MAX and NAME_MAX, as found in <limits.h> or provided by the pathconf() function. A typi- cal source fragment would be #ifdef PATH_MAX path_max = PATH_MAX; #else path_max = pathconf (path, _PC_PATH_MAX); if (path_max <= 0) path_max = 4096; #endif The BSD 4.4, Linux and SUSv2 versions always return an absolute path name. Solaris may return a relative path name when the path argument is relative. The prototype of realpath is given in <unistd.h> in libc4 and libc5, but in <stdlib.h> everywhere else. the bit about Solaris returning a relative path is very concerning. are you sure this is what we want here? seems to me that using realpath is just opening a big can of portability problems.
Attachment #133422 -
Flags: review?(darin) → review-
Comment 31•21 years ago
|
||
Comment on attachment 133422 [details] [diff] [review] Patch v2 well, ok... seems like nsLocalFileUnix.cpp uses realpath in this manner, so maybe _nevermind_ ;-) r/sr=darin though, i still wonder about what that man page was saying... seems like we should worry, no?
Attachment #133422 -
Flags: review- → review+
| Assignee | ||
Updated•21 years ago
|
OS: AIX → All
Hardware: Other → All
Summary: Builds after 2003/09/13 don't start on AIX → Unix builds after 2003/09/13 don't start when run with a relative path
| Assignee | ||
Comment 32•21 years ago
|
||
Fixed. Checking in nsGREDirServiceProvider.cpp; /cvsroot/mozilla/xpcom/glue/standalone/nsGREDirServiceProvider.cpp,v <-- nsGREDirServiceProvider.cpp new revision: 1.22; previous revision: 1.21 done
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 33•21 years ago
|
||
Yep, it's working now on Solaris (original bug #221048). Thanks!
You need to log in
before you can comment on or make changes to this bug.
Description
•