[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ‘sudo’ leaves PATH unchanged… so what?
From: |
Danny Milosavljevic |
Subject: |
Re: ‘sudo’ leaves PATH unchanged… so what? |
Date: |
Sun, 20 Jan 2019 03:12:33 +0100 |
Hi Ludo,
On Sat, 19 Jan 2019 23:52:59 +0100
Ludovic Courtès <address@hidden> wrote:
> Currently the ‘xdg-directory’ procedure (and thus ‘config-directory’,
> which by default gives ~/.config/guix) does this:
>
> (or (getenv variable)
> (and=> (or (getenv "HOME")
> (passwd:dir (getpwuid (getuid))))
> (cut string-append <> suffix)))
>
> I think giving $HOME higher precedence than /etc/passwd is the “right”
> behavior (the behavior people expect from programs in general), but it’s
> true that it’s confusing in this case.
I think it's good that one can override defaults using environment variables.
But if it was this instead:
> (or (getenv variable)
> (and=> (cond
((getenv "SUDO_USER") (passwd:dir (getpwnam (getenv
"SUDO_USER"))))
((getenv "HOME") (getenv "HOME"))
(_ (passwd:dir (getpwuid (getuid)))))
> (cut string-append <> suffix)))
... it would be still overridable by the user (by unsetting SUDO_USER
and setting HOME), so it would be fine.
(sudo without "-E" also nukes XDG_CONFIG_HOME, so it's ok if that gets preferred
if it's there)
Or we could just document "sudo -E" in the documentation and do nothing.
I have a slight preference for the latter since it's less magical. But from
a user experience standpoint the former does what is probably expected.
pgpW1zG0xebdP.pgp
Description: OpenPGP digital signature
- Re: ‘sudo’ leaves PATH unchanged… so what?, (continued)
- Re: ‘sudo’ leaves PATH unchanged… so what?, Pierre Neidhardt, 2019/01/17
- Re: ‘sudo’ leaves PATH unchanged… so what?, Giovanni Biscuolo, 2019/01/18
- Re: ‘sudo’ leaves PATH unchanged… so what?, Ricardo Wurmus, 2019/01/18
- Re: ‘sudo’ leaves PATH unchanged… so what?, Caleb Ristvedt, 2019/01/18
- Re: ‘sudo’ leaves PATH unchanged… so what?, Giovanni Biscuolo, 2019/01/18
- Re: ‘sudo’ leaves PATH unchanged… so what?, Caleb Ristvedt, 2019/01/18
- Re: ‘sudo’ leaves PATH unchanged… so what?, Danny Milosavljevic, 2019/01/18
- Re: ‘sudo’ leaves PATH unchanged… so what?, swedebugia, 2019/01/19
- Re: ‘sudo’ leaves PATH unchanged… so what?, Ludovic Courtès, 2019/01/19
- Re: ‘sudo’ leaves PATH unchanged… so what?, Ludovic Courtès, 2019/01/19
- Re: ‘sudo’ leaves PATH unchanged… so what?,
Danny Milosavljevic <=
- Re: ‘sudo’ leaves PATH unchanged… so what?, Giovanni Biscuolo, 2019/01/18