When using xdg-open on a typical URL in an environment which is considered "generic", my browser comes up with to tabs. One shows www.http.com and the other tries to open the real URL path as a file, which fails of course. The reason for this seems to be an improper use of IFS in the script. The different browsers to try are separated by colons, and to easily loop over them, IFS is set to colon. But that will also affect the colon which is typically part of the URL, and split it into two separate arguments to the browser. See the output from running xdg-open with "bash -xv" at the end. This is with xdg-utils-1.1.0-0.10.20111207.fc16.noarch on a Fedora system. This output comes from running open_generic, starting at line 612 in my copy of xdg-open. Note that x-www-browser and firefox are called with two separate arguments, rather than a single URL. + IFS=: + for browser in '$BROWSER' + '[' xx-www-browser '!=' x ']' printf "$browser" "$1" 2>/dev/null ++ printf x-www-browser http://portland.freedesktop.org/ + browser_with_arg=x-www-browser + '[' 0 -ne 0 ']' + '[' xx-www-browser = xx-www-browser ']' + eval '$browser $1 > /dev/null 2> /dev/null' $browser $1 > /dev/null 2> /dev/null ++ x-www-browser http //portland.freedesktop.org/ + '[' 127 -eq 0 ']' + for browser in '$BROWSER' + '[' xfirefox '!=' x ']' printf "$browser" "$1" 2>/dev/null ++ printf firefox http://portland.freedesktop.org/ + browser_with_arg=firefox + '[' 0 -ne 0 ']' + '[' xfirefox = xfirefox ']' + eval '$browser $1 > /dev/null 2> /dev/null' $browser $1 > /dev/null 2> /dev/null ++ firefox http //portland.freedesktop.org/ + '[' 0 -eq 0 ']' + exit_success + '[' 0 -gt 0 ']' + exit 0
Created attachment 63106 [details] Complete log generated with bash -xv xdg-open URL I can confirm this bug on Arch Linux (up-to-date). Here is relevant part of my output generated for: bash -xv xdg-open "http://www.gnu.org" + IFS=: + for browser in '$BROWSER' + '[' xx-www-browser '!=' x ']' printf "$browser" "$1" 2>/dev/null ++ printf x-www-browser http://www.gnu.org + browser_with_arg=x-www-browser + '[' 0 -ne 0 ']' + '[' xx-www-browser = xx-www-browser ']' + eval '$browser $1 > /dev/null 2> /dev/null' $browser $1 > /dev/null 2> /dev/null ++ x-www-browser http //www.gnu.org + '[' 127 -eq 0 ']' + for browser in '$BROWSER' + '[' xfirefox '!=' x ']' printf "$browser" "$1" 2>/dev/null ++ printf firefox http://www.gnu.org + browser_with_arg=firefox + '[' 0 -ne 0 ']' + '[' xfirefox = xfirefox ']' + eval '$browser $1 > /dev/null 2> /dev/null' $browser $1 > /dev/null 2> /dev/null ++ firefox http //www.gnu.org Notice the URL split into "http" and "//www.gnu.org" parts. Complete log attached. My environment: mloskot ~ $ uname -a Linux dog 3.4.2-2-ARCH #1 SMP PREEMPT Mon Jun 11 22:27:17 CEST 2012 x86_64 GNU/Linux mloskot ~ $ firefox -v Mozilla Firefox 13.0.1 mloskot ~ $ xdg-open --version xdg-open 1.1.0 rc1
The eval parameter on line 659 is not quoted. The original line is: eval '$browser $1'$xdg_redirect_output; while it should be: eval '$browser "$1"'$xdg_redirect_output; Tested and working on xdg-open 1.1.0 rc1 on Arch Linux (up to date) with Mozilla Firefox 13.0.1
(In reply to comment #2) > while it should be: > eval '$browser "$1"'$xdg_redirect_output; I also can confirm it fixes the problem.
Created attachment 65338 [details] [review] Solution by David Costa in form of patch I also confirm that bug exists in xdg-open 1.1.0 rc1 and that quoting $1 on line 659 fixes it. Please, apply the patch. Thanks David Costa.
Fix applied, thanks! http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=d1cb061c85388cb9e87a3ea902061d7b94726971
*** Bug 44164 has been marked as a duplicate of this bug. ***
*** Bug 49970 has been marked as a duplicate of this bug. ***
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.