/usr/lib/mozilla-firefox/firefox breaks commandline arguments containing blanks

Bug #45666 reported by Helmut Waitzmann
10
Affects Status Importance Assigned to Milestone
firefox (Ubuntu)
Fix Released
Medium
Mozilla Team

Bug Description

Binary package hint: firefox

On Ubuntu 5.10 "Breezy Badger",

/usr/lib/mozilla-firefox/firefox -a firefox -remote 'openURL(file:'"$file"', new-window)'

failes to parse the url when "$file" contains blanks, whereas

/usr/lib/mozilla-firefox/firefox-bin -a firefox -remote 'openURL(file:'"$file"', new-window)'

can handle it.

As an example, look at the "bash" command

(url='file:'"$PWD"/'URL containing blanks.html' && set '' -a firefox -remote 'openURL('"$url"', new-window)' && shift && show_argv_and_exec() { (set -x && exec ${1+"$@"}); printf 'exited returning exit code %s\n' "$?";}; show_argv_and_exec /usr/lib/mozilla-firefox/firefox ${1+"$@"}; show_argv_and_exec /usr/lib/mozilla-firefox/firefox-bin ${1+"$@"} ) 2>&1 | tee log.txt

, which yields the following output ("log.txt')

++ exec /usr/lib/mozilla-firefox/firefox -a firefox -remote 'openURL(file:/tmptmp/waitzmht/helmut/private/URL containing blanks.html, new-window)'
Error: Failed to send command: 500 command not parsable: openURL(file:/tmptmp/waitzmht/helmut/private/URL
exited returning exit code 1
++ exec /usr/lib/mozilla-firefox/firefox-bin -a firefox -remote 'openURL(file:/tmptmp/waitzmht/helmut/private/URL containing blanks.html, new-window)'
exited returning exit code 0

The above "bash" command tries to open a new window in an existing running firefox browser. The first launch by means of the "/usr/lib/mozilla-firefox/firefox" shell script fails, i.e. there is no window opened. The error message can be seen above.

The second launch by means of the pure "/usr/lib/mozilla-firefox/firefox-bin" binary executable opens a new window, as expected.

Maybe that the error with the "/usr/lib/mozilla-firefox/firefox" shell script is caused by the unquoted references of the shell variable "@"?
For example look at the shell functions "exec_verbose"

    exec $@

and "run_verbose"

    $@

which should be

    exec ${1+"$@"}

resp.

   ${1+"$@"}
.

"/usr/bin/mozilla-suite", which is a similar shell script using the mozilla-suite, does not have this failure: All references to the shell variable "@" are correctly quoted: ${1+"$@"}

Maybe this should be done with "/usr/lib/mozilla-firefox/firefox", too?
I think, yes: A patched /usr/lib/mozilla-firefox/firefox does not produce this error. The patch (diff -u -- /usr/lib/mozilla-firefox/firefox firefox) is appended here:

--- /usr/lib/mozilla-firefox/firefox 2006-04-18 16:01:27.000000000 +0200
+++ firefox 2006-05-19 22:52:08.135983000 +0200
@@ -120,7 +120,7 @@

 verbose () {
     if [ "${VERBOSE}" ]; then
- echo $@
+ echo ${1+"$@"}
     fi
 }

@@ -134,14 +134,14 @@

 # exec wrapper for verbosity
 exec_verbose () {
- verbose Running: $@
- exec $@
+ verbose Running: ${1+"$@"}
+ exec ${1+"$@"}
 }

 # exec wrapper for verbosity
 run_verbose () {
- verbose Running: $@
- $@
+ verbose Running: ${1+"$@"}
+ ${1+"$@"}
 }

 ##

Revision history for this message
John Vivirito (gnomefreak) wrote :

Is this still and issue for you? We are trying to trying sort out the older Mozilla issues and would like to know if this still happens.

Changed in firefox:
assignee: nobody → mozillateam
status: Unconfirmed → Needs Info
Revision history for this message
Helmut Waitzmann (helmut-waitzmann) wrote : Re: [Bug 45666] Re: /usr/lib/mozilla-firefox/firefox breaks commandline arguments containing blanks

John Vivirito <email address hidden> writes:

>Is this still and issue for you? We are trying to trying sort out the
>older Mozilla issues and would like to know if this still happens.
>
>** Changed in: firefox (Ubuntu)
> Assignee: (unassigned) => Mozilla Team
> Status: Unconfirmed => Needs Info
>
>--
>/usr/lib/mozilla-firefox/firefox breaks commandline arguments containing blanks
>https://launchpad.net/bugs/45666

Commandline arguments containing blanks aren't broken any more: The
binary is called with the arguments properly quoted.

But there is a blemish left:

If called in verbose mode (--verbose), "/usr/bin/mozilla-firefox" echoes
its arguments before executing the firefox binary executable. That
echoing is done with the arguments unquoted, which might confuse users,
who want to track down errors.

The following patch (diff -u) will repair the unquoted echoing:

--
Wenn Sie mir E-Mail schreiben, stellen | When writing me e-mail, please
Sie bitte vor meine E-Mail-Adresse | precede my e-mail address with
meinen Vor- und Nachnamen, etwa so: | my full name, like
Helmut Waitzmann <email address hidden>, (Helmut Waitzmann) <email address hidden>

Revision history for this message
John Vivirito (gnomefreak) wrote :

Please file a bug report about the verbose mode running of it. It seems to be a wish list more than a bug. Thank you for reporting this bug with us.

Changed in firefox:
status: Needs Info → Fix Released
Revision history for this message
Helmut Waitzmann (helmut-waitzmann) wrote :

John Vivirito <email address hidden> writes:

>Please file a bug report about the verbose mode running of it. It seems
>to be a wish list more than a bug. Thank you for reporting this bug with
>us.

Yes, it would be more a wish list than a bug. And I'm not sure, whether
its worth while doing it.

Proper quoting in such a way, that it can unambigously be recognized, can
be achieved by means of "sed". A patch follows:

What do you think?
--
Wer mir E-Mail schreiben will, stelle | When writing me e-mail, please
bitte vor meine E-Mail-Adresse meinen | precede my e-mail address with
Vor- und Nachnamen, etwa so: | my full name, like
Helmut Waitzmann <email address hidden>, (Helmut Waitzmann) <email address hidden>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.