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#50794 - [bash] /etc/bash.bashrc clobbers PS{1,2,3,4}
Attached to Project:
Arch Linux
Opened by Alain Kalker (ackalker) - Friday, 16 September 2016, 04:23 GMT
Last edited by Bartłomiej Piotrowski (Barthalion) - Wednesday, 09 November 2016, 20:15 GMT
Opened by Alain Kalker (ackalker) - Friday, 16 September 2016, 04:23 GMT
Last edited by Bartłomiej Piotrowski (Barthalion) - Wednesday, 09 November 2016, 20:15 GMT
|
DetailsDescription:
I sometimes want to debug trace (with line number info, etc.) a shell script without editing it, which is why I would want to do: $ export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' $ bash -x somescript This doesn't work as expected: trace output is in default format. It turns out that PS4 gets set to default value of '+ ' even when I exported it with a different value. It appears that /etc/bash.bashrc (sourced by /etc/profile when shell is bash) sets PS{1,2,3,4} to hardcoded defaults for interactive shells. I don't know the rationale behind the change which added this[1] back in 2009, but it seems to me rather rude and superfluous at best, as bash sets these prompt variables (at least PS{1,2,4} for interactive shells anyway when they have no values . See the function `initialize_shell_variables` in `variables.c`, in particular the calls to `set_if_not()`. If there is some compelling reason to set these variables in /etc/bash.bashrc, please at least do so only if they don't already have values. [1]: https://git.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/bash&id=c2cd913b6581e10c2c3f68d312f13a27c404a09e Additional info: * package version(s) bash 4.3.046-1 * config and/or log files etc. Steps to reproduce: |
This task depends upon
Closed by Bartłomiej Piotrowski (Barthalion)
Wednesday, 09 November 2016, 20:15 GMT
Reason for closing: Fixed
Additional comments about closing: bash 4.4-1
Wednesday, 09 November 2016, 20:15 GMT
Reason for closing: Fixed
Additional comments about closing: bash 4.4-1
The part about setting variables in /etc/bash.bashrc still holds.
$ export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
$ bash -x
This should trace (with source/line/function info) startup scripts as for an interactive shell, but currently doesn't.