Package: sensible-utils
Version: 0.0.9+deb9u1
Severity: normal
Tags: patch

when environmental variable BROWSER is set to value FOO
(and FOO is i /usr/bin/FOO)

$ sensible-browser
does
execve("/usr/bin/FOO", ["FOO", ""], ...)
execve("/usr/bin/FOO", ["FOO", ""], ...)
instead of
execve("/usr/bin/FOO", ["FOO"], ...)

That is, in sh notation, it does
$ FOO ''
instead of
$ FOO

In particular, it causes firefox to open with a directory listing of
getcwd() instead of its configured start page.

I attach two patches: a minimal patch that uses the same solution as
the rest of the script (maybe good for security update, to correct the
regression introduced by the security update), and a better patch that
also allows passing sensible-browser multiple URLs (maybe good for
sid).

-- System Information:
Debian Release: 9.3
  APT prefers stable
  APT policy: (500, 'stable'), (400, 'testing'), (200, 'unstable'), (1, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-3-amd64 (SMP w/8 CPU cores)
Locale: LANG=fr_LU.UTF-8, LC_CTYPE=fr_LU.UTF-8 (charmap=UTF-8), 
LANGUAGE=fr_LU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)

-- no debconf information
--- sensible-utils-0.0.11/sensible-browser	2017-11-15 16:30:02.000000000 +0100
+++ sensible-utils-0.0.11.foo/sensible-browser	2017-12-29 05:38:26.658192505 +0100
@@ -1,13 +1,11 @@
 #!/bin/sh
 
-URL="$1"
-
 # Prevent recursive loops, where these values are set to this script
 p="$(which sensible-browser)"
 [ "$(which $BROWSER || true)" = "$p" ] && BROWSER=
 
 if test -n "$BROWSER"; then
-    ${BROWSER} "$1"
+    ${BROWSER} "$@"
     ret="$?"
     if [ "$ret" -ne 126 ] && [ "$ret" -ne 127 ]; then
 	exit "$ret"
@@ -17,20 +15,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:+"$URL"}
+            exec /usr/bin/gnome-www-browser "$@"
         elif test -x /usr/bin/x-www-browser; then
-            exec /usr/bin/x-www-browser ${URL:+"$URL"}
+            exec /usr/bin/x-www-browser "$@"
         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:+\"$URL\"}"
+            exec /usr/bin/gnome-terminal -x /usr/bin/www-browser "$@"
         fi
     fi
     if test -x /usr/bin/x-www-browser; then
-        exec /usr/bin/x-www-browser ${URL:+"$URL"}
+        exec /usr/bin/x-www-browser "$@"
     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:+"$URL"}
+        exec /usr/bin/x-terminal-emulator -x /usr/bin/www-browser "$@"
     fi
 elif test -x /usr/bin/www-browser; then
-    exec /usr/bin/www-browser ${URL:+"$URL"}
+    exec /usr/bin/www-browser "$@"
 fi
 
 printf "Couldn't find a suitable web browser!\n" >&2
--- sensible-browser~	2017-11-15 16:30:02.000000000 +0100
+++ sensible-browser	2017-12-29 05:32:11.183127131 +0100
@@ -7,7 +7,7 @@
 [ "$(which $BROWSER || true)" = "$p" ] && BROWSER=
 
 if test -n "$BROWSER"; then
-    ${BROWSER} "$1"
+    ${BROWSER} ${URL:+"$URL"}
     ret="$?"
     if [ "$ret" -ne 126 ] && [ "$ret" -ne 127 ]; then
 	exit "$ret"

Reply via email to