Bug#556428: This is a bug in sensible-browser

martin f krafft madduck at debian.org
Thu Nov 26 11:32:38 UTC 2009


reassign 556428 sensible-tools
retitle 556428 sensible-browser passes empty argv[1] when called without URL
tags 556428 patch
thanks

The behaviour appears when iceweasel (or x-www-browser) is called
with "" as the first argument. A look into sensible-browser reveals
that it uses a quoted "$URL" to pass the argument. If $URL is
empty, "" will be passed.

Using ${URL:+"$URL"} instead gives the desired behaviour, and quotes
the URL only when it is non-empty.

A better approach might be to handle URL calling with printf like
it's done in the $BROWSER loop.

Curiously, there, $URL is not quoted. Second patch down below, if
you want it.



--- /tmp/sensible-browser	2009-11-26 12:25:46.970150575 +0100
+++ /usr/bin/sensible-browser	2009-11-26 12:28:33.142147405 +0100
@@ -29,20 +29,20 @@
 if test -n "$DISPLAY"; then
     if test -n "$GNOME_DESKTOP_SESSION_ID"; then
         if test -x /usr/bin/gnome-www-browser; then
-            exec /usr/bin/gnome-www-browser "$URL"
+            exec /usr/bin/gnome-www-browser ${URL:+"$URL"}
         elif test -x /usr/bin/x-www-browser; then
-            exec /usr/bin/x-www-browser "$URL"
+            exec /usr/bin/x-www-browser ${URL:+"$URL"}
         elif test -x /usr/bin/gnome-terminal && test -x /usr/bin/www-browser; then
-            exec /usr/bin/gnome-terminal -e "/usr/bin/www-browser \"$URL\""
+            exec /usr/bin/gnome-terminal -e "/usr/bin/www-browser \"${URL:+"$URL"}\""
         fi
     fi
     if test -x /usr/bin/x-www-browser; then
-        exec /usr/bin/x-www-browser "$URL"
+        exec /usr/bin/x-www-browser ${URL:+"$URL"}
     elif test -x /usr/bin/x-terminal-emulator && test -x /usr/bin/www-browser; then
-        exec /usr/bin/x-terminal-emulator -e /usr/bin/www-browser "$URL"
+        exec /usr/bin/x-terminal-emulator -e /usr/bin/www-browser ${URL:+"$URL"}
     fi
 elif test -x /usr/bin/www-browser; then
-    exec /usr/bin/www-browser "$URL"
+    exec /usr/bin/www-browser ${URL:+"$URL"}
 fi
 
 printf "Couldn't find a suitable web browser!\n" >&2






--- /tmp/sensible-browser	2009-11-26 12:25:46.970150575 +0100
+++ /usr/bin/sensible-browser	2009-11-26 12:31:14.458488326 +0100
@@ -15,7 +15,7 @@
 	    :
 	    ;;
 	    (*)
-	    i="$i %s"
+	    i="$i \"%s\""
 	    ;;
 	esac
         IFS="$OLDIFS"



-- 
 .''`.   martin f. krafft <madduck at d.o>      Related projects:
: :'  :  proud Debian developer               http://debiansystem.info
`. `'`   http://people.debian.org/~madduck    http://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature (see http://martin-krafft.net/gpg/)
URL: <http://lists.alioth.debian.org/pipermail/pkg-mozilla-maintainers/attachments/20091126/137290f8/attachment.pgp>


More information about the pkg-mozilla-maintainers mailing list