[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

‘sudo’ leaves PATH unchanged… so what?

From: Ludovic Courtès
Subject: ‘sudo’ leaves PATH unchanged… so what?
Date: Thu, 17 Jan 2019 11:34:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hello Guix,

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

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



reply via email to

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