An example of the gross failure of this is "rmdir ~/Videos" . XDG tools will then notice the dir not missing, and change the definition to "$HOME/" .
Thereafter, media scanner will treat home as the Videos dir, and spend days of CPU scanning ~/sourcecode/projectsfoo/tests/10TB-of-video- files/* . ---- xdg-user-dirs should be an expression of the user's preferences, not an assertion of what was valid on the disk at some point in the past. It does not matter whether the named variable's target existed on disk the last time it looked. Existence of the target is a function of time, the user's whims, and language. Apps using a XDG name at the user's request should handle the nonexistence by prompting the user to confirm intent, or merely create what it was asked to use. Redefining the variable without any ability to discover or undo it is evil. Lying about the user's preference is wrong. Assuming apps can never mkdir() what they are asked to use is wrong. ---- In the mean time, apps should probably interpret XDG variables that are "$HOME/" (with significan trailing slash) as previously clobbered from this bug, invalid, and then prompt the user to re-set it to default or pick a location. If users pick their home, do not include the trailing slash in the value, and set it to "$HOME" instead. The trailing slash is a good semaphore because any app is already expecting the returned value not to end in a slash. Most values from the XDG tool are like "/home/alice/Music", no trailing slash, so they append slash and the rest of their relative filename. ** Also affects: mediascanner2 (Ubuntu) Importance: Undecided Status: New ** Also affects: mediascanner2 Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to mediascanner2 in Ubuntu. https://bugs.launchpad.net/bugs/285998 Title: mv or rm of any XDG user dir causes its definition to change to wrong, oversimple $HOME/ Status in Media Scanner v2: New Status in “mediascanner2” package in Ubuntu: New Status in “xdg-user-dirs” package in Ubuntu: Confirmed Bug description: $ rmdir ~/Videos ... $ mkdir ~/Videos Hours later, find apps doing crazy things in home directory. During the elided period between rmdir and mkdir, if the XDG functions were run, the user's intent is forever lost, and its value is set to the user's home directory. Apps can not rely on XDG functions not to lie about what the user wants. It prefers to say what exists, not now when the app is accessing it, but when the XDG functions ran. It does not provide a file descriptor for an open_at(2) call. It provides a stale, text name of what used to exist on disk, and often not even what the user wanted. To manage notifications about this bug go to: https://bugs.launchpad.net/mediascanner2/+bug/285998/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp