pharo-project / pharo

Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk.
http://pharo.org
Other
1.22k stars 357 forks source link

UnixResolver>>xdgParseUserDirLine: returns root if XDG_DOCUMENTS_DIR is set to $HOME/ #9410

Closed a12l closed 3 years ago

a12l commented 3 years ago

Bug description

If the environmental variable XDG_DOCUMENTS_DIR in ~/.config/user-dirs.dirs (on Linux systems) is set to

XDG_DOCUMENTS_DIR="$HOME/"

UnixResolver>>xdgParseUserDirLine: will end up calling self home / '', which will return the root directory. Note that this problem only occur if there is a trailing slash after $HOME specifically. There is no problems if you only have $HOME or a slash after another level. For example,

XDG_DOCUMENTS_DIR="$HOME/Documents/"

works without any problem.

Found in https://github.com/feenkcom/gtoolkit/issues/1927. @akgrant43 found the exact cause of the problem.

To Reproduce

  1. Set the environmental variable XDG_DOCUMENTS_DIR to $HOME/ in ~/.config/user-dirs.dirs on a Linux system.
  2. Logout and log in again. This needs to be done for the change to take effect.
  3. Run FileLocator documents..

Expected behavior

UnixResolver>>xdgParseUserDirLine: should return the home directory if XDG_DOCUMENTS_DIR is set to $HOME/.

Screenshots

No screenshots.

Version information:

Expected development cost

I don't know how big change is needed, so I abstain from making an estimate. And if I had enough knowledge to make an estimate, I would probably have fixed myself and created a pull request.

Additional context

Not what I know of.

welcome[bot] commented 3 years ago

Thanks for opening your first issue! Please check the CONTRIBUTING documents for some tips about which information should be provided. You can find information of how to do a Pull Request here: https://github.com/pharo-project/pharo/wiki/Contribute-a-fix-to-Pharo

GitHub
pharo-project/pharo
Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk. - pharo-project/pharo