Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/index.php/Reporting_Bug_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!
Tasklist

FS#66449 - [bash] /etc/bash.bashrc may result in initial failing return status ( $? )

Attached to Project: Arch Linux
Opened by Eli Schwartz (eschwartz) - Tuesday, 28 April 2020, 14:44 GMT
Task Type General Gripe
Category Packages: Core
Status Assigned
Assigned To Bartłomiej Piotrowski (Barthalion)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 1
Private No

Details

The final line of https://git.archlinux.org/svntogit/packages.git/tree/trunk/system.bashrc?h=packages/bash checks to see if bash-completion is installed, and if so, sources it. In the event that bash-completion is *not* installed, this causes the final command in /etc/bash.bashrc to be [ -r /usr/share/bash-completion/bash_completion ], which fails. This is a well-documented caveat to using && for conditionals.

If the user does not have a bashrc, then upon initially opening a new interactive shell, echo $? returns "1". This can be user visible in some cases like when setting PS1 to something which displays the previous command's return status, but in .profile instead of .bashrc, then opening a new interactive shell. The PS1 then has a rather confusing value in it.

(initially reported by a confused user in #bash on freenode)

A better default bashrc would ensure it finishes off with a successful command -- this can be done by switching:

[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion

to

if [ -r /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
fi

This is a good time to perform this minor cosmetic change, since bash is already flagged out of date for patch 5.0.016 -> 5.0.017
This task depends upon

Loading...