[Portland-bugs] [Bug 105635] New: xdg-desktop-menu uninstall /nonexistent/*.directory /nonexistent/*.desktop removes unrelated files

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Mar 20 23:42:27 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=105635

            Bug ID: 105635
           Summary: xdg-desktop-menu uninstall /nonexistent/*.directory
                    /nonexistent/*.desktop removes unrelated files
           Product: Portland
           Version: unspecified
          Hardware: All
                OS: Linux (All)
            Status: NEW
          Severity: major
          Priority: medium
         Component: xdg-utils
          Assignee: portland-bugs at lists.freedesktop.org
          Reporter: marmarek at mimuw.edu.pl

Providing arguments to xdg-desktop-menu with wildcards (not expanded by shell -
either because of quoting, or missing files) expand them internally, but
ignoring directory part of the argument. This results in operation on unrelated
files.

The most extreme case is: xdg-desktop-menu uninstall /nonexistent/*.directory
/nonexistent/*.desktop
This results in removing all files from /usr/share/desktop-directories and
/usr/share/applications.
While this behavior could be expected (if documented!) for just "*.desktop"
argument, certainly it isn't when there was a full path provided.

Looks like missing quoting here:

        uninstall)
            for x in $xdg_dir $kde_dir $gnome_dir ; do
                rm -f $x/$basefile  # <- here
            done

(this fragment appears twice in the script - once for directory files and once
for desktop files)

Version: xdg-utils 1.1.1 (Fedora 26).

BTW I recommend running shellcheck on this (and other) script, it detects
problems like this:
In /usr/bin/xdg-desktop-menu line 1411:
                rm -f $x/$basefile
                      ^-- SC2086: Double quote to prevent globbing and word
splitting.
                         ^-- SC2086: Double quote to prevent globbing and word
splitting.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/portland-bugs/attachments/20180320/477eeb61/attachment.html>


More information about the Portland-bugs mailing list