[Top][All Lists]

[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 
                        ((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.

Attachment: pgpW1zG0xebdP.pgp
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]