Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong definition of macro paths from ~/.config/user-dirs.dirs if they are not in "$HOME". #3735

Open
IlyaIndigo opened this issue Nov 10, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@IlyaIndigo
Copy link

IlyaIndigo commented Nov 10, 2020

When I specify "blacklist ${DOCUMENTS}" in the config, I expect that the path to the documents directory assigned in my KDE will be blocked. But this only works if the path starts with $HOME. If this is not the case, for example (/Data/Documents) then "$HOME/Documents" is used instead.

cat ~/.config/user-dirs.dirs
XDG_DESKTOP_DIR="$HOME/Desktop/"
XDG_DOCUMENTS_DIR="/Data/Documents"
XDG_DOWNLOAD_DIR="$HOME/Downloads/"
XDG_MUSIC_DIR="/Data/Music"
XDG_PICTURES_DIR="/Data/Pictures"
XDG_PUBLICSHARE_DIR="$HOME/"
XDG_TEMPLATES_DIR="$HOME/"
XDG_VIDEOS_DIR="/Data/Video"

openSUSE Tumbleweed
KDE
firejail 0.9.64

@rusty-snake
Copy link
Collaborator

But in reality it is just hardcoded to "${HOME}/Documents" ignoring the KDE settings in the file "~/.config/user-dirs.dirs".

It's not hardcoded, user-dirs.dirs is parsed.

$ firejail --noprofile '--blacklist=${DOCUMENTS}' ls Dokumente
ls: cannot open directory 'Dokumente': Permission denied
# Edit ~/.config/user-dirs.dirs: XDG_DOCUMENTS_DIR="$HOME/DokumentenEnte"
firejail --noprofile '--blacklist=${DOCUMENTS}' ls Dokumente DokumentenEnte
Dokumente:
 foo     bar
ls: cannot open directory 'DokumentenEnte': Permission denied

However, user-dirs.dirs is not parse correctly. The code expects that the line for ${DOCUMENTS} starts with XDG_DOCUMENTS_DIR=\"$HOME/ and the part after the / is then used relative to cfg.homedir.

@rusty-snake rusty-snake added the bug Something isn't working label Nov 10, 2020
@IlyaIndigo
Copy link
Author

Your script also works for me.
But I'm not specifying the path in $HOME, but on another partition of the disk /Data.
And this is no longer processed, and instead of "/Data/Documents", "$HOME/Documents" is blocked.

@IlyaIndigo IlyaIndigo changed the title Incorrect definition of paths for macros ${DOCUMENTS} and possibly others in KDE. Wrong definition of macro paths from ~/.config/user-dirs.dirs if they are not in "$HOME". Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants