Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#46450 - [filesystem] /etc/profile invokes /etc/bash.bashrc even when bash is invoked as sh
Attached to Project:
Arch Linux
Opened by Celti Burroughs (Celti) - Sunday, 27 September 2015, 00:39 GMT
Last edited by Sébastien Luttringer (seblu) - Wednesday, 30 September 2015, 19:19 GMT
Opened by Celti Burroughs (Celti) - Sunday, 27 September 2015, 00:39 GMT
Last edited by Sébastien Luttringer (seblu) - Wednesday, 30 September 2015, 19:19 GMT
|
Details/etc/profile contains the following stanza:
# Source global bash config if test "$PS1" && test "$BASH" && test -r /etc/bash.bashrc; then . /etc/bash.bashrc fi $BASH is set to /usr/bin/sh when /bin/bash is invoked as /bin/sh (as when, e.g., invoked by machinectl shell). /etc/bash.bashrc can contain bash-specific code that will fail when bash is invoked as sh. Additional info: * filesystem 2015.02-1 Steps to reproduce: * Enter bash-specific code in /etc/bash.bashrc — e.g., PS1="\u@\h \w \$([[ \$? != 0 ]] && echo \":( \")\$ " * Invoke /bin/bash as /bin/sh in such a way that /etc/profile is read — e.g., `machinectl shell` or `chsh -s /bin/sh && sudo -i -u $USER` * Watch the bash-only PS1 spew errors every time the prompt is rendered. Steps to fix: * Change the stanza in /etc/profile as follows: # Source global bash config if test "$PS1" && test "$BASH" = "/usr/bin/bash" && test -r /etc/bash.bashrc; then . /etc/bash.bashrc fi |
This task depends upon
This task blocks these from closing
FS#66499 - [filesystem] Running bash in POSIX mode sources /etc/bash.bashrc
Closed by Sébastien Luttringer (seblu)
Wednesday, 30 September 2015, 19:19 GMT
Reason for closing: Fixed
Additional comments about closing: 2015.09-1
Wednesday, 30 September 2015, 19:19 GMT
Reason for closing: Fixed
Additional comments about closing: 2015.09-1
test "$(basename ${BASH}x)" = "bashx"
This fails to source bash.bashrc when bash is invoked as sh in all circumstances I can find, and also works (fails to source) under dash, with no errors in any case. It likewise does work whenever bash is invoked as bash, whether /usr/bin/bash, /bin/bash, or even /home/user/.local/bin/bash.
if test "$PS1" && test "$BASH" && test -z "$POSIXLY_CORRECT" && test -r /etc/bash; then
. /etc/bash.bashrc
fi
If this variable is in the environment when bash starts, the shell enters posix mode
before reading the startup files, as if the --posix invocation option had been supplied.
If it is set while the shell is running, bash enables posix mode, as if the command set
-o posix had been executed.
Your test will not works when an empty POSIXLY_CORRECT variable is set.
Something like this looks better:
if test "$PS1" && test "$BASH" && test -z ${POSIXLY_CORRECT+x} && test -r /etc/bash.bashrc; then