[Reportbug-maint] Bug#616523: querybts: browsing fails unless xdg-open is present when /bin/sh is dash
RjY
rjy at users.sourceforge.net
Sat Mar 5 08:39:53 UTC 2011
Package: reportbug
Version: 5.0
Severity: normal
Tags: patch
Trying to start a web browser to view bug reports (with e.g. querybts -w
or via 'b') fails with the error "sh: xdg-open: not found"
The code used in launch_browser (urlutils.py) to detect if xdg-open is
present on the system is a bashism. When /bin/sh is dash, the wrong exit
code is returned, fooling launch_browser into thinking xdg-open is
available when it is not. launch_browser then tries to run the command
anyway, which fails with the above message, and returns without doing
anything else.
This patch seems to fix the problem for me. checkbashisms also reported
"'command' with option other than -p", so you might prefer to use
'which'. However dash supports 'command -v' so I will leave it up to you
:-)
diff --git a/reportbug/urlutils.py b/reportbug/urlutils.py
index c4ba5aa..054932d 100644
--- a/reportbug/urlutils.py
+++ b/reportbug/urlutils.py
@@ -163,7 +163,7 @@ def open_url(url, http_proxy=None, timeout=60):
return page
def launch_browser(url):
- if not os.system('command -v xdg-open &> /dev/null'):
+ if not os.system('command -v xdg-open >/dev/null 2>&1'):
cmd = 'xdg-open' + commands.mkarg(url)
os.system(cmd)
return
-- Package-specific info:
** Environment settings:
EDITOR="vim"
VISUAL="vim"
INTERFACE="text"
** /home/rjy/.reportbugrc:
reportbug_version "5.0"
mode standard
ui text
email "rjy at users.sourceforge.net"
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.37-2-686 (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages reportbug depends on:
ii apt 0.8.11.5 Advanced front-end for dpkg
ii python 2.6.6-3+squeeze5 interactive high-level object-orie
ii python-reportbug 5.0 Python modules for interacting wit
reportbug recommends no packages.
Versions of packages reportbug suggests:
pn debconf-utils <none> (no description available)
pn debsums <none> (no description available)
pn dlocate <none> (no description available)
pn emacs22-bin-common | emacs23- <none> (no description available)
ii file 5.04-5 Determines file type using "magic"
ii gnupg 1.4.11-3 GNU privacy guard - a free PGP rep
ii postfix [mail-transport-agent 2.8.1-1 High-performance mail transport ag
pn python-gtk2 <none> (no description available)
pn python-gtkspell <none> (no description available)
pn python-urwid <none> (no description available)
pn python-vte <none> (no description available)
pn xdg-utils <none> (no description available)
-- no debconf information
--
http://rjy.org.uk/
More information about the Reportbug-maint
mailing list