all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* ‘sudo’ leaves PATH unchanged… so what?
@ 2019-01-17 10:34 Ludovic Courtès
  2019-01-17 11:03 ` Pierre Neidhardt
  2019-01-17 11:14 ` Ricardo Wurmus
  0 siblings, 2 replies; 16+ messages in thread
From: Ludovic Courtès @ 2019-01-17 10:34 UTC (permalink / raw)
  To: guix-devel

Hello Guix,

I’m not sure if this is a bug, but on Guix System, ‘sudo’ leaves PATH
unchanged:

--8<---------------cut here---------------start------------->8---
$ sudo env|grep '^PATH='|sha1sum
5236ce49c388ade7c3e8f767d8136c1c38a97c6a  -
$ env|grep '^PATH='|sha1sum
5236ce49c388ade7c3e8f767d8136c1c38a97c6a  -
--8<---------------cut here---------------end--------------->8---

I think that’s because the shell spawned by ‘sudo’ is not a login shell,
so ~root/.bash_profile and other files that define/modify environment
variables are not sourced.  So I think this is expected behavior.

However, it trips up many people.  In particular, people are surprised
that “sudo guix system reconfigure …” does not use ~root/.config/guix,
and instead uses theirs (or /run/current-system/profile/…).

My take on this is that this is normal behavior, but that we should
maybe recommend “sudo -i guix system reconfigure …” instead of
“sudo guix system reconfigure” in the manual, and/or add a warning in
the manual.

Thoughts?

Ludo’.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ‘sudo’ leaves PATH unchanged… so what?
  2019-01-17 10:34 ‘sudo’ leaves PATH unchanged… so what? Ludovic Courtès
@ 2019-01-17 11:03 ` Pierre Neidhardt
  2019-01-17 11:14 ` Ricardo Wurmus
  1 sibling, 0 replies; 16+ messages in thread
From: Pierre Neidhardt @ 2019-01-17 11:03 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]


> sudo -i guix system reconfigure …

I use `sudo -E guix system reconfigure …`

which preserves my environment so that I can reconfigure using my current user's
Guix.

I think we should document both options.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ‘sudo’ leaves PATH unchanged… so what?
  2019-01-17 10:34 ‘sudo’ leaves PATH unchanged… so what? Ludovic Courtès
  2019-01-17 11:03 ` Pierre Neidhardt
@ 2019-01-17 11:14 ` Ricardo Wurmus
  2019-01-17 12:35   ` Ludovic Courtès
  1 sibling, 1 reply; 16+ messages in thread
From: Ricardo Wurmus @ 2019-01-17 11:14 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


Ludovic Courtès <ludo@gnu.org> writes:

> Hello Guix,
>
> I’m not sure if this is a bug, but on Guix System, ‘sudo’ leaves PATH
> unchanged:
>
> --8<---------------cut here---------------start------------->8---
> $ sudo env|grep '^PATH='|sha1sum
> 5236ce49c388ade7c3e8f767d8136c1c38a97c6a  -
> $ env|grep '^PATH='|sha1sum
> 5236ce49c388ade7c3e8f767d8136c1c38a97c6a  -
> --8<---------------cut here---------------end--------------->8---
>
> I think that’s because the shell spawned by ‘sudo’ is not a login shell,
> so ~root/.bash_profile and other files that define/modify environment
> variables are not sourced.  So I think this is expected behavior.

Yes, this is expected and desired behaviour.  Sysadmins generally use
“su -” or “sudo -i” to get a “proper” root login shell because of this.

> However, it trips up many people.  In particular, people are surprised
> that “sudo guix system reconfigure …” does not use ~root/.config/guix,
> and instead uses theirs (or /run/current-system/profile/…).
>
> My take on this is that this is normal behavior, but that we should
> maybe recommend “sudo -i guix system reconfigure …” instead of
> “sudo guix system reconfigure” in the manual, and/or add a warning in
> the manual.

Why would we want to recommend the use of the root user’s installation
of Guix, though?  I usually don’t care at all about the root user’s
Guix.

--
Ricardo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ‘sudo’ leaves PATH unchanged… so what?
  2019-01-17 11:14 ` Ricardo Wurmus
@ 2019-01-17 12:35   ` Ludovic Courtès
  2019-01-17 12:47     ` Pierre Neidhardt
  2019-01-18  7:15     ` Giovanni Biscuolo
  0 siblings, 2 replies; 16+ messages in thread
From: Ludovic Courtès @ 2019-01-17 12:35 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <rekado@elephly.net> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Hello Guix,
>>
>> I’m not sure if this is a bug, but on Guix System, ‘sudo’ leaves PATH
>> unchanged:
>>
>> --8<---------------cut here---------------start------------->8---
>> $ sudo env|grep '^PATH='|sha1sum
>> 5236ce49c388ade7c3e8f767d8136c1c38a97c6a  -
>> $ env|grep '^PATH='|sha1sum
>> 5236ce49c388ade7c3e8f767d8136c1c38a97c6a  -
>> --8<---------------cut here---------------end--------------->8---
>>
>> I think that’s because the shell spawned by ‘sudo’ is not a login shell,
>> so ~root/.bash_profile and other files that define/modify environment
>> variables are not sourced.  So I think this is expected behavior.
>
> Yes, this is expected and desired behaviour.  Sysadmins generally use
> “su -” or “sudo -i” to get a “proper” root login shell because of this.

OK.

>> However, it trips up many people.  In particular, people are surprised
>> that “sudo guix system reconfigure …” does not use ~root/.config/guix,
>> and instead uses theirs (or /run/current-system/profile/…).
>>
>> My take on this is that this is normal behavior, but that we should
>> maybe recommend “sudo -i guix system reconfigure …” instead of
>> “sudo guix system reconfigure” in the manual, and/or add a warning in
>> the manual.
>
> Why would we want to recommend the use of the root user’s installation
> of Guix, though?  I usually don’t care at all about the root user’s
> Guix.

Yeah, you’re right.

I think the main reason would be this bit in the manual:

--8<---------------cut here---------------start------------->8---
@cindex upgrading GuixSD
From then on, you can update GuixSD whenever you want by running @command{guix
pull} as @code{root} (@pxref{Invoking guix pull}), and then running
@command{guix system reconfigure /etc/config.scm}, as @code{root} too, to
--8<---------------cut here---------------end--------------->8---

To many, this translates to:

  sudo guix pull
  sudo guix system …

… which doesn’t do what one might think before “sudo guix pull” updates
root’s ‘guix’ whereas “sudo guix system” uses the user’s ‘guix’.

Either we should rephrase it or perhaps explicitly write:

  From then on, you can update GuixSD whenever you want by running:

  @example
  guix pull
  sudo guix system reconfigure /etc/config.scm
  @end example

WDYT?

Ludo’.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ‘sudo’ leaves PATH unchanged… so what?
  2019-01-17 12:35   ` Ludovic Courtès
@ 2019-01-17 12:47     ` Pierre Neidhardt
  2019-01-18  7:15     ` Giovanni Biscuolo
  1 sibling, 0 replies; 16+ messages in thread
From: Pierre Neidhardt @ 2019-01-17 12:47 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 208 bytes --]

Absolutely.  I should have reported this before, this is precisely the train of
thought that got me confused for the many weeks that I "guix pulled" as root!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ‘sudo’ leaves PATH unchanged… so what?
  2019-01-17 12:35   ` Ludovic Courtès
  2019-01-17 12:47     ` Pierre Neidhardt
@ 2019-01-18  7:15     ` Giovanni Biscuolo
  2019-01-18  7:30       ` Ricardo Wurmus
  1 sibling, 1 reply; 16+ messages in thread
From: Giovanni Biscuolo @ 2019-01-18  7:15 UTC (permalink / raw)
  To: Ludovic Courtès, Ricardo Wurmus; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1419 bytes --]

Hi all,

Ludovic Courtès <ludo@gnu.org> writes:

> Ricardo Wurmus <rekado@elephly.net> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>> Hello Guix,
>>>
>>> I’m not sure if this is a bug, but on Guix System, ‘sudo’ leaves PATH
>>> unchanged:

this also happens on foreign distros :-)

[...]

>> Yes, this is expected and desired behaviour.  Sysadmins generally use
>> “su -” or “sudo -i” to get a “proper” root login shell because of this.
>
> OK.
>
>>> However, it trips up many people.

yes, and it was a subject of many help requests both here and help-guix
in recent months (since I'm subscribed)

[...]

> … which doesn’t do what one might think before “sudo guix pull” updates
> root’s ‘guix’ whereas “sudo guix system” uses the user’s ‘guix’.
>
> Either we should rephrase it or perhaps explicitly write:
>
>   From then on, you can update GuixSD whenever you want by running:
>
>   @example
>   guix pull
>   sudo guix system reconfigure /etc/config.scm
>   @end example

IMHO it should be explicitly stated that in general it's not
advised/needed to install guix for the root user and that "guix system"
must be run as a normal user via sudo (and the user must be allowed to
do so by root via sudoers); then the example above

[...]

Thanks!
Giovanni

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ‘sudo’ leaves PATH unchanged… so what?
  2019-01-18  7:15     ` Giovanni Biscuolo
@ 2019-01-18  7:30       ` Ricardo Wurmus
  2019-01-18  8:06         ` Caleb Ristvedt
  2019-01-18 10:39         ` Giovanni Biscuolo
  0 siblings, 2 replies; 16+ messages in thread
From: Ricardo Wurmus @ 2019-01-18  7:30 UTC (permalink / raw)
  To: Giovanni Biscuolo; +Cc: guix-devel


Giovanni Biscuolo <g@xelera.eu> writes:

> IMHO it should be explicitly stated that in general it's not
> advised/needed to install guix for the root user and that "guix system"
> must be run as a normal user via sudo (and the user must be allowed to
> do so by root via sudoers); then the example above

Currently, installing Guix for the root user is what the installer
script does and what the instructions for the binary installation method
suggest.

--
Ricardo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ‘sudo’ leaves PATH unchanged… so what?
  2019-01-18  7:30       ` Ricardo Wurmus
@ 2019-01-18  8:06         ` Caleb Ristvedt
  2019-01-18 11:33           ` Giovanni Biscuolo
  2019-01-19 22:52           ` Ludovic Courtès
  2019-01-18 10:39         ` Giovanni Biscuolo
  1 sibling, 2 replies; 16+ messages in thread
From: Caleb Ristvedt @ 2019-01-18  8:06 UTC (permalink / raw)
  To: Ricardo Wurmus, guix-devel

[-- Attachment #1: Type: text/plain, Size: 1075 bytes --]

I'd just like to add that if a user has guix installed for root but only
really keeps their user's guix up to date (I imagine a fairly common
situation), they're in for a weird situation when using sudo: a
bleeding-edge guix will complain about being outdated, since sudo (even
with -E) sets $USER, which is used to determine which file's timestamp
should be used for deciding whether the installed guix is outdated.
Basically, your shiny new guix warns you that someone else's dirty old guix
is old.

On Fri, Jan 18, 2019 at 7:31 AM Ricardo Wurmus <rekado@elephly.net> wrote:

>
> Giovanni Biscuolo <g@xelera.eu> writes:
>
> > IMHO it should be explicitly stated that in general it's not
> > advised/needed to install guix for the root user and that "guix system"
> > must be run as a normal user via sudo (and the user must be allowed to
> > do so by root via sudoers); then the example above
>
> Currently, installing Guix for the root user is what the installer
> script does and what the instructions for the binary installation method
> suggest.
>
> --
> Ricardo
>
>
>

[-- Attachment #2: Type: text/html, Size: 1510 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ‘sudo’ leaves PATH unchanged… so what?
  2019-01-18  7:30       ` Ricardo Wurmus
  2019-01-18  8:06         ` Caleb Ristvedt
@ 2019-01-18 10:39         ` Giovanni Biscuolo
  1 sibling, 0 replies; 16+ messages in thread
From: Giovanni Biscuolo @ 2019-01-18 10:39 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 700 bytes --]

Ricardo,

Ricardo Wurmus <rekado@elephly.net> writes:

> Giovanni Biscuolo <g@xelera.eu> writes:
>
>> IMHO it should be explicitly stated that in general it's not
>> advised/needed to install guix for the root user and that "guix system"
>> must be run as a normal user via sudo (and the user must be allowed to
>> do so by root via sudoers); then the example above
>
> Currently, installing Guix for the root user is what the installer
> script does and what the instructions for the binary installation method
> suggest.

mumble: yes mine was a stupid statement, I should have read that twice :-S

Thanks!
Giovanni

[...]

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ‘sudo’ leaves PATH unchanged… so what?
  2019-01-18  8:06         ` Caleb Ristvedt
@ 2019-01-18 11:33           ` Giovanni Biscuolo
  2019-01-18 19:03             ` Caleb Ristvedt
  2019-01-19 22:52           ` Ludovic Courtès
  1 sibling, 1 reply; 16+ messages in thread
From: Giovanni Biscuolo @ 2019-01-18 11:33 UTC (permalink / raw)
  To: Caleb Ristvedt, Ricardo Wurmus, guix-devel

[-- Attachment #1: Type: text/plain, Size: 984 bytes --]

Hi all,

Caleb Ristvedt <caleb.ristvedt@cune.org> writes:

> I'd just like to add that if a user has guix installed for root but only
> really keeps their user's guix up to date (I imagine a fairly common
> situation), they're in for a weird situation when using sudo: a
> bleeding-edge guix will complain about being outdated, since sudo (even
> with -E) sets $USER, which is used to determine which file's timestamp
> should be used for deciding whether the installed guix is outdated.
> Basically, your shiny new guix warns you that someone else's dirty old guix
> is old.

if this is true (root and user profiles using different versions of guix
is a problem), should this be clearly stated in the manual?

maybe I'm missing something, but I thought root and user profiles were
isolated so I can have different binaries (guix included) and use them
independently, am I wrong?

Thanks!
Giovanni

[...]

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ‘sudo’ leaves PATH unchanged… so what?
  2019-01-18 11:33           ` Giovanni Biscuolo
@ 2019-01-18 19:03             ` Caleb Ristvedt
  2019-01-18 20:29               ` Danny Milosavljevic
  0 siblings, 1 reply; 16+ messages in thread
From: Caleb Ristvedt @ 2019-01-18 19:03 UTC (permalink / raw)
  To: Giovanni Biscuolo, guix-devel

[-- Attachment #1: Type: text/plain, Size: 1599 bytes --]

To be clear, it's not so much a real problem as an eyesore. 'sudo guix
package ...' and 'sudo guix pull' will operate on root's profile(s) as
expected, but that also means 'sudo guix system reconfigure' will look at
root's profile when deciding whether to say that it's out of date, even
though the guix actually used for reconfiguring may not be out of date. It
pretty much only ever comes up when reconfiguring, but for those like
myself who are worried by messages like that it can be confusing to try to
resolve.

On Fri, Jan 18, 2019 at 11:33 AM Giovanni Biscuolo <g@xelera.eu> wrote:

> Hi all,
>
> Caleb Ristvedt <caleb.ristvedt@cune.org> writes:
>
> > I'd just like to add that if a user has guix installed for root but only
> > really keeps their user's guix up to date (I imagine a fairly common
> > situation), they're in for a weird situation when using sudo: a
> > bleeding-edge guix will complain about being outdated, since sudo (even
> > with -E) sets $USER, which is used to determine which file's timestamp
> > should be used for deciding whether the installed guix is outdated.
> > Basically, your shiny new guix warns you that someone else's dirty old
> guix
> > is old.
>
> if this is true (root and user profiles using different versions of guix
> is a problem), should this be clearly stated in the manual?
>
> maybe I'm missing something, but I thought root and user profiles were
> isolated so I can have different binaries (guix included) and use them
> independently, am I wrong?
>
> Thanks!
> Giovanni
>
> [...]
>
> --
> Giovanni Biscuolo
>
> Xelera IT Infrastructures
>

[-- Attachment #2: Type: text/html, Size: 2164 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ‘sudo’ leaves PATH unchanged… so what?
  2019-01-18 19:03             ` Caleb Ristvedt
@ 2019-01-18 20:29               ` Danny Milosavljevic
  2019-01-19  6:19                 ` swedebugia
  2019-01-19 22:55                 ` Ludovic Courtès
  0 siblings, 2 replies; 16+ messages in thread
From: Danny Milosavljevic @ 2019-01-18 20:29 UTC (permalink / raw)
  To: Caleb Ristvedt; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 808 bytes --]

On Fri, 18 Jan 2019 19:03:18 +0000
Caleb Ristvedt <caleb.ristvedt@cune.org> wrote:

> To be clear, it's not so much a real problem as an eyesore. 'sudo guix
> package ...' and 'sudo guix pull' will operate on root's profile(s) as
> expected, but that also means 'sudo guix system reconfigure' will look at
> root's profile when deciding whether to say that it's out of date, even
> though the guix actually used for reconfiguring may not be out of date. It
> pretty much only ever comes up when reconfiguring, but for those like
> myself who are worried by messages like that it can be confusing to try to
> resolve.

There's an environment variable "SUDO_USER" which still contains the name
of the original user.

We could check SUDO_USER instead of USER if USER=root, otherwise check USER.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ‘sudo’ leaves PATH unchanged… so what?
  2019-01-18 20:29               ` Danny Milosavljevic
@ 2019-01-19  6:19                 ` swedebugia
  2019-01-19 22:55                 ` Ludovic Courtès
  1 sibling, 0 replies; 16+ messages in thread
From: swedebugia @ 2019-01-19  6:19 UTC (permalink / raw)
  To: Danny Milosavljevic, Caleb Ristvedt; +Cc: guix-devel@gnu.org


[-- Attachment #1.1: Type: text/html, Size: 1687 bytes --]

[-- Attachment #1.2: Type: text/plain, Size: 1268 bytes --]

Danny Milosavljevic <dannym@scratchpost.org> skrev: (18 januari 2019 21:29:28 CET)
>On Fri, 18 Jan 2019 19:03:18 +0000
>Caleb Ristvedt <caleb.ristvedt@cune.org> wrote:
>
>> To be clear, it's not so much a real problem as an eyesore. 'sudo
>guix
>> package ...' and 'sudo guix pull' will operate on root's profile(s)
>as
>> expected, but that also means 'sudo guix system reconfigure' will
>look at
>> root's profile when deciding whether to say that it's out of date,
>even
>> though the guix actually used for reconfiguring may not be out of
>date. It
>> pretty much only ever comes up when reconfiguring, but for those like
>> myself who are worried by messages like that it can be confusing to
>try to
>> resolve.
>
>There's an environment variable "SUDO_USER" which still contains the
>name
>of the original user.
>
>We could check SUDO_USER instead of USER if USER=root, otherwise check
>USER.

+1 great idea.

Maybe we could have an explicit  --root switch too?
Then we could state in the manual that guix always runs with your user profile guix unless you give it  --root.

We could the clearly state why you might not want it to use a root profile of guix on a typical single user system. 
-- 
Sent from my p≡p for Android.

[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 3825 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ‘sudo’ leaves PATH unchanged… so what?
  2019-01-18  8:06         ` Caleb Ristvedt
  2019-01-18 11:33           ` Giovanni Biscuolo
@ 2019-01-19 22:52           ` Ludovic Courtès
  2019-01-20  2:12             ` Danny Milosavljevic
  1 sibling, 1 reply; 16+ messages in thread
From: Ludovic Courtès @ 2019-01-19 22:52 UTC (permalink / raw)
  To: Caleb Ristvedt; +Cc: guix-devel

Hey,

Caleb Ristvedt <caleb.ristvedt@cune.org> skribis:

> I'd just like to add that if a user has guix installed for root but only
> really keeps their user's guix up to date (I imagine a fairly common
> situation), they're in for a weird situation when using sudo: a
> bleeding-edge guix will complain about being outdated, since sudo (even
> with -E) sets $USER, which is used to determine which file's timestamp
> should be used for deciding whether the installed guix is outdated.
> Basically, your shiny new guix warns you that someone else's dirty old guix
> is old.

True, that’s super weird!  (Actually I think it’s $HOME, not $USER.)

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.

Thoughts?

Ludo’.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ‘sudo’ leaves PATH unchanged… so what?
  2019-01-18 20:29               ` Danny Milosavljevic
  2019-01-19  6:19                 ` swedebugia
@ 2019-01-19 22:55                 ` Ludovic Courtès
  1 sibling, 0 replies; 16+ messages in thread
From: Ludovic Courtès @ 2019-01-19 22:55 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> There's an environment variable "SUDO_USER" which still contains the name
> of the original user.
>
> We could check SUDO_USER instead of USER if USER=root, otherwise check USER.

Or perhaps we could ignore HOME when SUDO_USER is set, and instead honor
/etc/passwd only?

Ludo’.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ‘sudo’ leaves PATH unchanged… so what?
  2019-01-19 22:52           ` Ludovic Courtès
@ 2019-01-20  2:12             ` Danny Milosavljevic
  0 siblings, 0 replies; 16+ messages in thread
From: Danny Milosavljevic @ 2019-01-20  2:12 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1525 bytes --]

Hi Ludo,

On Sat, 19 Jan 2019 23:52:59 +0100
Ludovic Courtès <ludo@gnu.org> 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.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-01-20  2:12 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-17 10:34 ‘sudo’ leaves PATH unchanged… so what? Ludovic Courtès
2019-01-17 11:03 ` Pierre Neidhardt
2019-01-17 11:14 ` Ricardo Wurmus
2019-01-17 12:35   ` Ludovic Courtès
2019-01-17 12:47     ` Pierre Neidhardt
2019-01-18  7:15     ` Giovanni Biscuolo
2019-01-18  7:30       ` Ricardo Wurmus
2019-01-18  8:06         ` Caleb Ristvedt
2019-01-18 11:33           ` Giovanni Biscuolo
2019-01-18 19:03             ` Caleb Ristvedt
2019-01-18 20:29               ` Danny Milosavljevic
2019-01-19  6:19                 ` swedebugia
2019-01-19 22:55                 ` Ludovic Courtès
2019-01-19 22:52           ` Ludovic Courtès
2019-01-20  2:12             ` Danny Milosavljevic
2019-01-18 10:39         ` Giovanni Biscuolo

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.