Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When indirectly invoking `nano` as a non-root user this error is displayed: ``` ubuntu@nv1:~$ lxc profile edit default Unable to create directory /root/.local/share/nano/: Permission denied It is required for saving/loading search history or cursor positions. ``` While applications should use a default value for `XDG_DATA_HOME` of `$HOME/.local/share` it seems that `nano` does not. Exporting `XDG_DATA_HOME` helps but `nano` will fail if the directory does not exist: ``` $ ll .local/ ls: cannot access '.local/': No such file or directory $ lxc profile edit default Unable to create directory /home/ubuntu/.local/share/nano/: No such file or directory It is required for saving/loading search history or cursor positions. ``` As such, if the directory `$HOME/.local/share` does not exist, tell `nano` to not attempt reading any rc files. This provides a nicer experience: ``` ubuntu@nv1:~$ ll .local/ ls: cannot access '.local/': No such file or directory ubuntu@nv1:~$ lxc profile edit default Instructing nano to ignore RC files due to missing directory: "/home/ubuntu/.local/share" ubuntu@nv1:~$ ll .local/ ls: cannot access '.local/': No such file or directory ubuntu@nv1:~$ mkdir -p .local/share ubuntu@nv1:~$ lxc profile edit default ubuntu@nv1:~$ ``` When invoked by root, `nano` has no problem creating `/root/.local/share`. Signed-off-by: Simon Deziel <[email protected]> (cherry picked from commit b32b626)
- Loading branch information