Bug#809877: xdg-utils: fix for #801048 breaks xdg-open if whitespaces in the filename on Debian/Cinnamon
Hello! On Sat, 2021-01-09 at 15:47 +0100, Eduard Bloch wrote: > I also ran into trouble with the whitespace stuff. This time in the > application entry (vendor). > > The code is just buggy, sometimes doublequotes are used, sometimes not. > I think the attached patch should fix at least my problem. Could you > give it a try and see how it works for you? > > The other file is prepatched xdg-mime from version 1.1.3 (don't use it > with older package version like above!). Do you have a complete test case leading to an error which you tries to fix by the patch? In other words, what should I do to reproduce the problem you are experiencing? Which command do you run? Which .desktop file does it use? signature.asc Description: This is a digitally signed message part
Bug#809877: xdg-utils: fix for #801048 breaks xdg-open if whitespaces in the filename on Debian/Cinnamon
On Mon, 04 Jan 2016 13:15:49 -0600 tyler wrote: > Package: xdg-utils > Version: 1.1.1-1 > Severity: grave > Justification: renders package unusable > > To reproduce, install Cinnamon on Debian 8.2, then pull 1.1.1-1 from Stretch. > You should find that xdg-open will no longer correctly parse file paths with > spaces in them. This is probably due to the fix for #801048 which dealt with > some whitespace stuff, since whitespaces worked just fine in 1.1.0. I also ran into trouble with the whitespace stuff. This time in the application entry (vendor). The code is just buggy, sometimes doublequotes are used, sometimes not. I think the attached patch should fix at least my problem. Could you give it a try and see how it works for you? The other file is prepatched xdg-mime from version 1.1.3 (don't use it with older package version like above!). Best regards, Eduard. diff --git a/scripts/xdg-utils-common.in b/scripts/xdg-utils-common.in index d8277e7..e84a3c4 100644 --- a/scripts/xdg-utils-common.in +++ b/scripts/xdg-utils-common.in @@ -62,17 +62,17 @@ desktop_file_to_binary() if [ "${desktop#*-}" != "$desktop" ]; then vendor=${desktop%-*} app=${desktop#*-} -if [ -r $dir/applications/$vendor/$app ]; then -file_path=$dir/applications/$vendor/$app -elif [ -r $dir/applnk/$vendor/$app ]; then -file_path=$dir/applnk/$vendor/$app +if [ -r "$dir/applications/$vendor/$app" ]; then +file_path="$dir/applications/$vendor/$app" +elif [ -r "$dir/applnk/$vendor/$app" ]; then +file_path="$dir/applnk/$vendor/$app" fi fi if test -z "$file_path" ; then for indir in "$dir"/applications/ "$dir"/applications/*/ "$dir"/applnk/ "$dir"/applnk/*/; do file="$indir/$desktop" if [ -r "$file" ]; then -file_path=$file +file_path="$file" break fi done #!/bin/sh #- # xdg-mime # # Utility script to manipulate MIME related information # on XDG compliant systems. # # Refer to the usage() function below for usage. # # Copyright 2009-2010, Fathi Boudra # Copyright 2009-2010, Rex Dieter # Copyright 2006, Kevin Krammer # Copyright 2006, Jeremy White # # LICENSE: # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # #- manualpage() { cat << _MANUALPAGE Name xdg-mime - command line tool for querying information about file type handling and adding descriptions for new file types Synopsis xdg-mime query { filetype | default } ... xdg-mime default application mimetype(s) xdg-mime install [--mode mode] [--novendor] mimetypes-file xdg-mime uninstall [--mode mode] mimetypes-file xdg-mime { --help | --manual | --version } Description The xdg-mime program can be used to query information about file types and to add descriptions for new file types. Commands query Returns information related to file types. The query option is for use inside a desktop session only. It is not recommended to use xdg-mime query as root. The following queries are supported: query filetype FILE: Returns the file type of FILE in the form of a MIME type. query default mimetype: Returns the default application that the desktop environment uses for opening files of type mimetype. The default application is identified by its *.desktop file. default Ask the desktop environment to make application the default application for opening files of type mimetype. An application can be made the default for several file types by specifying multiple mimetypes. application is the desktop file id of the application and has the form vendor-name.desktop. application must already be installed
Bug#809877: xdg-utils: fix for #801048 breaks xdg-open if whitespaces in the filename on Debian/Cinnamon
Hi Per, (FYI I did not originally file this bug) > Please, it's not unusable. Well, /technically/ true but the current situation is almost unusable for a lot of modern use-cases. :) In particular, when I download files in Chromium with identical names they are called: foo.ext foo (1).bar foo (2).bar foo (3).bar … so the first file works and opens directly in Chromium but subsequent ones fail with an obscure error message about /tmp. (I am not using Cinnamon but the "awesome" window manager) § > sh -x /usr/bin/xdg-open "file with spaces.txt" Attached. So, I think this an issue in run-mailcap: $ run-mailcap --debug --action=view file\ with\ spaces.xspf - parsing parameter "--action=view" - parsing parameter "file with spaces.xspf" - Reading mime.types file "/home/lamby/.mime.types"... could not read "/home/lamby/.mime.types" -- No such file or directory - Reading mime.types file "/usr/local/etc/mime.types"... could not read "/usr/local/etc/mime.types" -- No such file or directory - Reading mime.types file "/usr/share/etc/mime.types"... could not read "/usr/share/etc/mime.types" -- No such file or directory - Reading mime.types file "/etc/mime.types"... - extension "xspf" maps to mime-type "application/xspf+xml" - Reading mailcap file "/home/lamby/.mailcap"... could not read "/home/lamby/.mailcap" -- No such file or directory - Reading mailcap file "/etc/mailcap"... - Reading mailcap file "/usr/local/etc/mailcap"... could not read "/usr/local/etc/mailcap" -- No such file or directory - Reading mailcap file "/usr/share/etc/mailcap"... could not read "/usr/share/etc/mailcap" -- No such file or directory - Reading mailcap file "/usr/etc/mailcap"... could not read "/usr/etc/mailcap" -- No such file or directory Processing file "file with spaces.xspf" of type "application/xspf+xml" (encoding=none)... - checking mailcap entry "application/xspf+xml; audacious %s; test=test -n "$DISPLAY"" - program to execute: audacious %s - running test: test -n "$DISPLAY" (result=0=true) - filename contains shell meta-characters; aliased to '/tmp/fileNt0KnK' - executing: audacious /tmp/fileNt0KnK ERROR util.cc:269 [audgui_simple_message]: Error playing file:///tmp/fileNt0KnK: File format not recognised … so reassign to src:mime-support and mark as "affects" ? Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org chris-lamb.co.uk `- + check_common_commands file with spaces.xspf + [ 1 -gt 0 ] + parm=file with spaces.xspf + shift + [ 0 -gt 0 ] + [ -z ] + unset XDG_UTILS_DEBUG_LEVEL + [ 0 -lt 1 ] + xdg_redirect_output= > /dev/null 2> /dev/null + [ xfile with spaces.xspf != x ] + url= + [ 1 -gt 0 ] + parm=file with spaces.xspf + shift + [ -n ] + url=file with spaces.xspf + [ 0 -gt 0 ] + [ -z file with spaces.xspf ] + detectDE + unset GREP_OPTIONS + [ -n GNOME ] + DE=gnome + [ xgnome = x ] + [ xgnome = x ] + [ xgnome = x ] + [ xgnome = xgnome ] + which gnome-default-applications-properties + DE=gnome3 + [ -f /run/user/1000/flatpak-info ] + [ xgnome3 = x ] + DEBUG 2 Selected DE gnome3 + [ -z ] + return 0 + open_gnome3 file with spaces.xspf + gio help open + gvfs-open --help + open_generic file with spaces.xspf + is_file_url_or_path file with spaces.xspf + echo file with spaces.xspf + grep -q ^file:// + echo file with spaces.xspf + egrep -q ^[[:alpha:]+\.\-]+: + return 0 + file_url_to_path file with spaces.xspf + local file=file with spaces.xspf + + echo file with spaces.xspf grep -q ^file:/// + echo file with spaces.xspf + local file=file with spaces.xspf + check_input_file file with spaces.xspf + [ ! -e file with spaces.xspf ] + [ ! -r file with spaces.xspf ] + has_display + [ -n :0 ] + return 0 + xdg-mime query filetype file with spaces.xspf + sed s/;.*// + filetype= + open_generic_xdg_mime file with spaces.xspf + filetype= + xdg-mime query default xdg-mime: mimetype argument missing Try 'xdg-mime --help' for more information. + default= + [ -n ] + which run-mailcap + run-mailcap --action=view file with spaces.xspf + [ 0 -eq 0 ] + exit_success + [ 0 -gt 0 ] + exit 0
Bug#809877: xdg-utils: fix for #801048 breaks xdg-open if whitespaces in the filename on Debian/Cinnamon
Package: xdg-utils Version: 1.1.1-1 Severity: grave Justification: renders package unusable To reproduce, install Cinnamon on Debian 8.2, then pull 1.1.1-1 from Stretch. You should find that xdg-open will no longer correctly parse file paths with spaces in them. This is probably due to the fix for #801048 which dealt with some whitespace stuff, since whitespaces worked just fine in 1.1.0. -- System Information: Debian Release: stretch/sid APT prefers testing APT policy: (500, 'testing'), (500, 'stable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.3.0-1-amd64 (SMP w/8 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) xdg-utils depends on no packages. Versions of packages xdg-utils recommends: ii libfile-mimeinfo-perl 0.27-1 ii libnet-dbus-perl 1.1.0-3 ii libx11-protocol-perl 0.56-7 ii x11-utils 7.7+3 ii x11-xserver-utils 7.7+5 Versions of packages xdg-utils suggests: ii gvfs-bin 1.26.2-1 -- no debconf information