Closed Bug 266292 Opened 20 years ago Closed 20 years ago

strange behaviour with command line, or even sometimes crash, when using gtk handled arguments

Categories

(Toolkit :: Startup and Profile System, defect)

x86
Linux
defect
Not set
critical

Tracking

()

VERIFIED FIXED

People

(Reporter: glandium, Assigned: benjamin)

Details

(Keywords: fixed-aviary1.0, regression, Whiteboard: [have patch] - has review, needs approval)

Attachments

(2 files)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.3) Gecko/20041027 Firefox/0.10.1 (Debian package 0.10.1+1.0PR-5) Build Identifier: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.3) Gecko/20041027 Firefox/0.10.1 (Debian package 0.10.1+1.0PR-5) ./firefox-bin --display=:0.0 segfaults while ./firefox-bin --display=:0.0 http://mozilla.org/ displays the usage The explanation is that gtk_init removes the arguments it treated and thus updates argc and argv. But nsCmdLineService::Initialize gets a value that has been saved _before_ the update, so, in the first case, it tries to read from a NULL pointer (--display=:0.0 is replaced by NULL by gtk), and in the second, it sees twice http://mozilla.org/ (the --display=:0.0 being replaced by http://mozilla.org/, argc decreased, but the second argument not NULLed) Saving argc again after gtk_init call, so that it gets the new value, fixes the issue. Fix will follow. Note that #183640 is the same problem in an other bunch of code (the viewer seems outdated, though) Reproducible: Always Steps to Reproduce: 1. 2. 3.
Attached patch Fix for this bugSplinter Review
Attachment #163591 - Flags: review?(darin)
This is a regression since 0.9, that nobody caught. Three cheers for long testing cycles!
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking-aviary1.0+
Keywords: regression
Whiteboard: [have patch] - need review darin
True, argc is not used anywhere else. It probably got into there when adding support for -register without X support needed.
Attachment #163591 - Flags: review?(darin) → review+
Whiteboard: [have patch] - need review darin → [have patch] - has review, needs approval
Attachment #163591 - Flags: approval-aviary?
trying to shutdown on changes for 1.0, lets get this for 1.1. jay, can you try and generate a crash, check talkback for top crash just to make sure. renominate if we thing this is high visability
Flags: blocking-aviary1.0+ → blocking-aviary1.0-
If anyone has been able to reproduce this with a Talkback enabled build, please post your incident ids. Or if there are stack traces out there, please post one here so I can get an idea of what to look for in the Talkback data. Thanks.
chofmann, can I disagree here? This is a basic correctness patch, and it would affect anyone who uses GTK flags to start Firefox.
Flags: blocking-aviary1.0- → blocking-aviary1.0?
And this crash happens before the talkback client is initialized, so it will never show up in talkback.
This is fixed on trunk, but I'm going to leave it open to make sure it stays on the aviary radar.
Flags: blocking-aviary1.0? → blocking-aviary1.0-
Comment on attachment 163591 [details] [diff] [review] Alternate fix, call gtk_init with gArgv, gArgc approval-aviary+ per discussion with Ben, and sr=jst
Attachment #163591 - Flags: superreview+
Attachment #163591 - Flags: approval-aviary?
Attachment #163591 - Flags: approval-aviary+
Fix landed on the aviary branch.
Keywords: fixed-aviary1.0
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
tested with 2004110309-0.11 bits on linux fc2 (gnome). when I issue ./firefox-bin --display=:0.0 or ./firefox-bin --display=:0.0 http://www.mozilla.org all I get is this: ./firefox-bin: error while loading shared libraries: libmozjs.so: cannot open shared object file: No such file or directory is that expected?
try: ./firefox --display=:0.0 or just ./firefox you shouldn't run firefox-bin directly.
thanks, Andrew! yep, running with those commands works nicely (launches firefox, and at the targeted url if provided).
Status: RESOLVED → VERIFIED
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: