Closed
Bug 550310
Opened 16 years ago
Closed 15 years ago
simple arithmetic expressions evaluated at startup
Categories
(Toolkit :: Startup and Profile System, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: dietrich, Unassigned)
Details
(Whiteboard: [ts])
Attachments
(1 file)
|
9.81 KB,
patch
|
Details | Diff | Splinter Review |
using strace and filtering on "exec(" showed that we do the following at startup:
execve("/usr/bin/firefox-3.6", ["firefox-3.6", "-no-remote", "-P", "empty"], [/* 38 vars */]) = 0
[pid 22183] execve("/usr/bin/which", ["which", "/usr/bin/firefox-3.6"], [/* 38 vars */]) = 0
[pid 22184] execve("/usr/bin/basename", ["basename", "/usr/bin/firefox-3.6"], [/* 38 vars */]) = 0
[pid 22185] execve("/bin/readlink", ["readlink", "/usr/bin/firefox-3.6"], [/* 38 vars */] <unfinished ...>
[pid 22186] execve("/usr/bin/basename", ["basename", "../lib/firefox-3.6.2pre/firefox."...], [/* 38 vars */]) = 0
[pid 22187] execve("/usr/bin/basename", ["basename", "../lib/firefox-3.6.2pre/firefox."...], [/* 38 vars */] <unfinished ...>
execve("/usr/lib/firefox-3.6.2pre/firefox", ["/usr/lib/firefox-3.6.2pre/firefo"..., "-no-remote", "-P", "empty"], [/* 39 vars */]) = 0
[pid 22188] execve("/usr/bin/dirname", ["dirname", "/usr/lib/firefox-3.6.2pre/firefo"...], [/* 39 vars */]) = 0
[pid 22189] execve("/usr/bin/basename", ["basename", "/usr/lib/firefox-3.6.2pre/firefo"...], [/* 39 vars */]) = 0
[pid 22190] execve("/usr/bin/expr", ["expr", "0", "+", "1"], [/* 39 vars */]) = 0
[pid 22191] execve("/usr/bin/expr", ["expr", "1", "+", "1"], [/* 39 vars */]) = 0
[pid 22192] execve("/usr/bin/expr", ["expr", "2", "+", "1"], [/* 39 vars */]) = 0
[pid 22193] execve("/usr/lib/firefox-3.6.2pre/run-mozilla.sh", ["/usr/lib/firefox-3.6.2pre/run-mo"..., "/usr/lib/firefox-3.6.2pre/firefo"..., "-no-remote", "-P", "empty"], [/* 39 vars */]) = 0
[pid 22194] execve("/usr/bin/basename", ["basename", "/usr/lib/firefox-3.6.2pre/run-mo"...], [/* 39 vars */] <unfinished ...>
[pid 22195] execve("/usr/bin/dirname", ["dirname", "/usr/lib/firefox-3.6.2pre/run-mo"...], [/* 39 vars */]) = 0
[pid 22196] execve("/bin/uname", ["uname", "-s"], [/* 39 vars */]) = 0
[pid 22197] execve("/usr/lib/firefox-3.6.2pre/firefox-bin", ["/usr/lib/firefox-3.6.2pre/firefo"..., "-no-remote", "-P", "empty"], [/* 49 vars */]) = 0
| Reporter | ||
Updated•16 years ago
|
Whiteboard: [ts]
Comment 1•16 years ago
|
||
| Reporter | ||
Comment 2•16 years ago
|
||
(In reply to comment #1)
> http://mxr.mozilla.org/mozilla-central/source/build/unix/mozilla.in#130
I don't understand. Does that mean that the scripts that run the binary on Linux are passing those parameters in?
Comment 3•16 years ago
|
||
Essentially, yes, I think that's what he's saying.
Most of those execs can be replaced with shell builtins and/or syntax, if we're willing to assume a modern shell. I see we already use "set --", so I think we're good. The only execing left in mozilla.in, in this patch, is that necessary to chase symlinks. It *might* be possible to squeeze out some more forks for that case, I don't really grok shell functions.
run-mozilla.sh is a little trickier. Its use of basename and dirname can get the same treatment that I applied in mozilla.in. The debugging paths do not need to be optimized. That leaves one use of "uname" to detect Solaris and avoid setting LD_LIBRARY_PATH. The comments above that block make me think maybe we should just scrap that, but what I've done for now is test for the existence of /kernel/genunix, which *looks* generic but AFAIK is found on all Solaris and only Solaris systems.
I also squoze out one exec() (and more importantly, one shell startup) by having mozilla.in chain to run-mozilla.sh with "." instead of "exec", when we don't need $0 to change (i.e. when we didn't chase symlinks or fall back to $moz_libdir).
| Reporter | ||
Comment 4•16 years ago
|
||
Zack: bsmedberg said he's not the shell expert you're looking for. Is there someone else who knows shell code well enough to do a first-review here?
Comment 5•16 years ago
|
||
I don't know if that falls under the build system or not, but I'd be happy to delegate to a self-selected shell expert.
Comment 6•16 years ago
|
||
Comment on attachment 430795 [details] [diff] [review]
patch
Unfortunately, I don't know who that would be.
Attachment #430795 -
Flags: review?(benjamin) → review?
Comment 7•16 years ago
|
||
I asked for help on dev-platform.
Comment 8•16 years ago
|
||
Orthogonal take:
Why not preprocess this file instead? The Solaris build could then unconditionally enable the Solaris bits (and non-Solaris builds wouldn't need to deal with it at all). Ditto for the bits dealing with running with a debugger and all the other cruft.
In fact, I'd suggest that it would be better to have a simple, small startup script that does only the bare minimum required for the common-case startup (tailored to the platform), and move all the oddball cases (if we even want to continue supporting them) to a separate script...
| Reporter | ||
Comment 9•16 years ago
|
||
(In reply to comment #8)
> In fact, I'd suggest that it would be better to have a simple, small startup
> script that does only the bare minimum required for the common-case startup
> (tailored to the platform), and move all the oddball cases (if we even want to
> continue supporting them) to a separate script...
That sounds nice. Zack, as the current domain expert in this area of code, is it feasible?
Comment 10•16 years ago
|
||
Well, we could move the debugging cruft out of run-mozilla.sh, and we could preprocess for Solaris, and maybe we don't need all of the work being done by mozilla.in (it looks to me like that's mostly to support, um, weird installations) but the bare minimum still needs to handle command line options and do the messing with $0 to figure out how to set LD_LIBRARY_PATH, and that's where most of the work is happening, actually.
I think a better long-term angle to look at is whether we are providing sufficient binary compatibility guarantees that we could give libxpcom.so and libxul.so versioned SONAMEs and install them in /usr/lib. Then we could throw both shell scripts away in an installed build (we would still need it for running out of the build directory, but that could assume the build directory's layout, so it could be much, much simpler).
(If libxpcom.so is felt to have a stable ABI but libxul.so isn't, an alternative would be to go for static linkage of libxul into xulrunner and make firefox-atop-xulrunner the normal install on Linux.)
... But that would be a separate bug.
Comment 11•16 years ago
|
||
> ... But that would be a separate bug.
Filed bug 552864.
Comment 12•16 years ago
|
||
I no longer work for Mozilla, I am deassigning myself from bugs I have no intention of working on as a volunteer.
Assignee: zackw → nobody
Status: ASSIGNED → NEW
Updated•15 years ago
|
Attachment #430795 -
Flags: review?
Comment 13•15 years ago
|
||
After the work done in bug 552864, I am not sure there is any point keeping this bug open. cc:ing Mike Hommey for sanity check there.
Comment 14•15 years ago
|
||
Not much point, indeed.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•