Allan McRae pushed to branch master at Pacman / Pacman


Commits:
da68447e by Andrew Gregory at 2022-10-15T10:40:59-07:00
set bash env variables before running scripts

Bash sources user configuration files under a number of conditions that
can cause issues with scripts when bash is used as the scriptlet shell.

Bash assumes it's being run under rsh/ssh if stdin is connected to a
socket and sources the user bashrc unless the environment variable
$SHLVL is >= 2.  Commit 6a4c6a02de9b45abe4c0f78c4f5d14d92d3359d6
switched from pipes to sockets when communicating with child processes
to work around SIGPIPE issues.  Normally $SHLVL would be inherited from
the shell running pacman, but operations involving scriptlets are
generally run with sudo which does not let the $SHLVL variable through
unless specifically configured to.

Similarly $BASH_ENV can cause bash to source user-specified configuration
files if set.

https://lists.gnu.org/archive/html/help-bash/2022-02/msg00082.html

Note: the list discussion and bash source all reference SHLVL >= 2, this
is the SHLVL value *after* bash has incremented it on startup.  Setting
it to 1 in pacman is sufficient to disable the unwanted behavior.

Signed-off-by: Andrew Gregory <[email protected]>

- - - - -


1 changed file:

- lib/libalpm/util.c


View it on GitLab: 
https://gitlab.archlinux.org/pacman/pacman/-/commit/da68447ec6325f3ee0c87db9c6498a9876d4f4f1

-- 
View it on GitLab: 
https://gitlab.archlinux.org/pacman/pacman/-/commit/da68447ec6325f3ee0c87db9c6498a9876d4f4f1
You're receiving this email because of your account on gitlab.archlinux.org.


Reply via email to