commit: d04f29919a1cd81775067cead8b123d57306bc29 Author: Kerin Millar <kfm <AT> plushkava <DOT> net> AuthorDate: Mon Aug 18 04:53:25 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Mon Aug 18 15:50:58 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d04f2991
app-shells/bash: add 5.2_p37-r4 & 5.3_p3-r1, revise 9999, address PR #42626 This commit introduces 5.2_p37-r4 and bash-5.3_p3-r1, as well as revising bash-9999. The effective changes are described herewith. Install a new /etc/profile.d drop-in, named "00-prompt-command.sh". It serves to initialise the PROMPT_COMMAND variable as early as is conveniently possible, provided that bash is acting as a login shell. Install a revision of the /etc/bash/bashrc file that refrains from initialising the PROMPT_COMMAND variable, provided that bash is acting as a login shell. Along with the aforementioned change, this amounts to a simplified interpretation of GitHub PR #42626. Though not a common practice, some /etc/profile.d drop-ins (such as vte-2.91.sh) need to be able to manipulate PROMPT_COMMAND and had hitherto been stymied by bashrc proceeding to unconditionally clobber it. Finally, refrain from installing 15-gentoo-bashrc-check.bash to /etc/bash/bashrc.d. At the time of its introduction, I recommended that it should exist for no longer than a year. Its removal is overdue. Reported-by: Krzesimir Nowak <knowak <AT> microsoft.com> Part-of: https://github.com/gentoo/gentoo/pull/42626 Closes: https://github.com/gentoo/gentoo/pull/42626 Signed-off-by: Kerin Millar <kfm <AT> plushkava.net> Signed-off-by: Sam James <sam <AT> gentoo.org> .../{bash-9999.ebuild => bash-5.2_p37-r4.ebuild} | 51 +++++++++++++--------- .../{bash-9999.ebuild => bash-5.3_p3-r1.ebuild} | 11 ++--- app-shells/bash/bash-9999.ebuild | 8 ++-- app-shells/bash/files/bashrc-r2 | 30 +++++++++++++ .../bash/files/profile.d/00-prompt-command.sh | 7 +++ 5 files changed, 77 insertions(+), 30 deletions(-) diff --git a/app-shells/bash/bash-9999.ebuild b/app-shells/bash/bash-5.2_p37-r4.ebuild similarity index 90% copy from app-shells/bash/bash-9999.ebuild copy to app-shells/bash/bash-5.2_p37-r4.ebuild index e025d4e56763..299473ed97a9 100644 --- a/app-shells/bash/bash-9999.ebuild +++ b/app-shells/bash/bash-5.2_p37-r4.ebuild @@ -17,21 +17,20 @@ MY_PATCHES=() # Determine the patchlevel. See ftp://ftp.gnu.org/gnu/bash/bash-5.2-patches/. case ${PV} in + *_p*) + PLEVEL=${PV##*_p} + ;; 9999|*_alpha*|*_beta*|*_rc*) # Set a negative patchlevel to indicate that it's a pre-release. PLEVEL=-1 ;; - *_p*) - PLEVEL=${PV##*_p} - ;; *) PLEVEL=0 - ;; esac # The version of readline this bash normally ships with. Note that we only use # the bundled copy of readline for pre-releases. -READLINE_VER="8.3" +READLINE_VER="8.2_p1" DESCRIPTION="The standard GNU Bourne again shell" HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html https://git.savannah.gnu.org/cgit/bash.git" @@ -40,15 +39,6 @@ if [[ ${PV} == 9999 ]]; then EGIT_REPO_URI="https://git.savannah.gnu.org/git/bash.git" EGIT_BRANCH=devel inherit git-r3 -elif (( PLEVEL < 0 )) && [[ ${PV} == *_p* ]] ; then - # It can be useful to have snapshots in the pre-release period once - # the first alpha is out, as various bugs get reported and fixed from - # the alpha, and the next pre-release is usually quite far away. - # - # i.e. if it's worth packaging the alpha, it's worth packaging a followup. - BASH_COMMIT="b35866a2891a9b069e37ca5684d4309c0391e261" - SRC_URI="https://git.savannah.gnu.org/cgit/bash.git/snapshot/bash-${BASH_COMMIT}.tar.gz -> ${P}-${BASH_COMMIT}.tar.gz" - S=${WORKDIR}/${PN}-${BASH_COMMIT} else my_urls=( "mirror://gnu/bash/${MY_P}.tar.gz" ) @@ -62,7 +52,6 @@ else done SRC_URI="${my_urls[*]} verify-sig? ( ${my_urls[*]/%/.sig} )" - S=${WORKDIR}/${MY_P} unset -v my_urls my_p my_patch_idx my_patch_ver fi @@ -71,6 +60,8 @@ if [[ ${GENTOO_PATCH_VER} ]]; then SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV:?}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER:?}-patches.tar.xz" fi +S=${WORKDIR}/${MY_P} + LICENSE="GPL-3+" SLOT="0" if (( PLEVEL >= 0 )); then @@ -102,6 +93,13 @@ PATCHES=( # Patches to or from Chet, posted to the bug-bash mailing list. "${FILESDIR}/${PN}-5.0-syslog-history-extern.patch" + "${FILESDIR}/${PN}-5.2_p15-random-ub.patch" + "${FILESDIR}/${PN}-5.2_p15-configure-clang16.patch" + "${FILESDIR}/${PN}-5.2_p21-wpointer-to-int.patch" + "${FILESDIR}/${PN}-5.2_p32-memory-leaks.patch" + "${FILESDIR}/${PN}-5.2_p32-invalid-continuation-byte-ignored-as-delimiter-1.patch" + "${FILESDIR}/${PN}-5.2_p32-invalid-continuation-byte-ignored-as-delimiter-2.patch" + "${FILESDIR}/${PN}-5.2_p32-erroneous-delimiter-pushback-condition.patch" ) pkg_setup() { @@ -123,8 +121,6 @@ src_unpack() { if [[ ${PV} == 9999 ]]; then git-r3_src_unpack - elif (( PLEVEL < 0 )) && [[ ${PV} == *_p* ]] ; then - default else if use verify-sig; then verify-sig_verify_detached "${DISTDIR}/${MY_P}.tar.gz"{,.sig} @@ -146,6 +142,15 @@ src_prepare() { # Include official patches. (( PLEVEL > 0 )) && eapply -p0 "${MY_PATCHES[@]}" + # Clean out local libs so we know we use system ones w/releases. The + # touch utility is invoked for the benefit of config.status. + if (( PLEVEL >= 0 )); then + rm -rf lib/{readline,termcap}/* \ + && touch lib/{readline,termcap}/Makefile.in \ + && sed -i -E 's:\$[{(](RL|HIST)_LIBSRC[)}]/[[:alpha:]_-]*\.h::g' Makefile.in \ + || die + fi + # Prefixify hardcoded path names. No-op for non-prefix. hprefixify pathnames.h.in @@ -171,6 +176,10 @@ src_configure() { # may misbehave at runtime. unset -v YACC + # bash 5.3 drops unprototyped functions, earlier versions are + # incompatible with C23. + append-cflags $(test-flags-CC -std=gnu17) + if tc-is-cross-compiler; then export CFLAGS_FOR_BUILD="${BUILD_CFLAGS} -std=gnu17" fi @@ -308,14 +317,14 @@ src_install() { insinto /etc/bash doins "${FILESDIR}"/bash_logout - my_prefixify bashrc.d "${FILESDIR}"/bashrc-r1 | newins - bashrc + my_prefixify bashrc.d "${FILESDIR}"/bashrc-r2 | newins - bashrc insinto /etc/bash/bashrc.d my_prefixify DIR_COLORS "${FILESDIR}"/bashrc.d/10-gentoo-color-r2.bash | newins - 10-gentoo-color.bash newins "${FILESDIR}"/bashrc.d/10-gentoo-title-r2.bash 10-gentoo-title.bash - if [[ ! ${EPREFIX} ]]; then - doins "${FILESDIR}"/bashrc.d/15-gentoo-bashrc-check.bash - fi + + insinto /etc/profile.d + doins "${FILESDIR}/profile.d/00-prompt-command.sh" insinto /etc/skel for f in bash{_logout,_profile,rc}; do diff --git a/app-shells/bash/bash-9999.ebuild b/app-shells/bash/bash-5.3_p3-r1.ebuild similarity index 98% copy from app-shells/bash/bash-9999.ebuild copy to app-shells/bash/bash-5.3_p3-r1.ebuild index e025d4e56763..6a8170bcca41 100644 --- a/app-shells/bash/bash-9999.ebuild +++ b/app-shells/bash/bash-5.3_p3-r1.ebuild @@ -101,7 +101,8 @@ PATCHES=( #"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}/ # Patches to or from Chet, posted to the bug-bash mailing list. - "${FILESDIR}/${PN}-5.0-syslog-history-extern.patch" + "${FILESDIR}"/${PN}-5.0-syslog-history-extern.patch + "${FILESDIR}"/${PN}-5.3-read-sys.patch ) pkg_setup() { @@ -308,14 +309,14 @@ src_install() { insinto /etc/bash doins "${FILESDIR}"/bash_logout - my_prefixify bashrc.d "${FILESDIR}"/bashrc-r1 | newins - bashrc + my_prefixify bashrc.d "${FILESDIR}"/bashrc-r2 | newins - bashrc insinto /etc/bash/bashrc.d my_prefixify DIR_COLORS "${FILESDIR}"/bashrc.d/10-gentoo-color-r2.bash | newins - 10-gentoo-color.bash newins "${FILESDIR}"/bashrc.d/10-gentoo-title-r2.bash 10-gentoo-title.bash - if [[ ! ${EPREFIX} ]]; then - doins "${FILESDIR}"/bashrc.d/15-gentoo-bashrc-check.bash - fi + + insinto /etc/profile.d + doins "${FILESDIR}/profile.d/00-prompt-command.sh" insinto /etc/skel for f in bash{_logout,_profile,rc}; do diff --git a/app-shells/bash/bash-9999.ebuild b/app-shells/bash/bash-9999.ebuild index e025d4e56763..248fb8be6cd6 100644 --- a/app-shells/bash/bash-9999.ebuild +++ b/app-shells/bash/bash-9999.ebuild @@ -308,14 +308,14 @@ src_install() { insinto /etc/bash doins "${FILESDIR}"/bash_logout - my_prefixify bashrc.d "${FILESDIR}"/bashrc-r1 | newins - bashrc + my_prefixify bashrc.d "${FILESDIR}"/bashrc-r2 | newins - bashrc insinto /etc/bash/bashrc.d my_prefixify DIR_COLORS "${FILESDIR}"/bashrc.d/10-gentoo-color-r2.bash | newins - 10-gentoo-color.bash newins "${FILESDIR}"/bashrc.d/10-gentoo-title-r2.bash 10-gentoo-title.bash - if [[ ! ${EPREFIX} ]]; then - doins "${FILESDIR}"/bashrc.d/15-gentoo-bashrc-check.bash - fi + + insinto /etc/profile.d + doins "${FILESDIR}/profile.d/00-prompt-command.sh" insinto /etc/skel for f in bash{_logout,_profile,rc}; do diff --git a/app-shells/bash/files/bashrc-r2 b/app-shells/bash/files/bashrc-r2 new file mode 100644 index 000000000000..f084d98ffb0a --- /dev/null +++ b/app-shells/bash/files/bashrc-r2 @@ -0,0 +1,30 @@ +# /etc/bash/bashrc + +# Proceed no further in the case of a non-interactive shell. +if [[ $- != *i* ]]; then + return +fi + +# Disable errexit in case the user enabled it then chose to re-source this file. +shopt -u -o errexit + +# Disable completion when the input buffer is empty. Mute STDERR because this +# option is only present in the case that bash was built with readline support. +shopt -s no_empty_cmd_completion 2>/dev/null && + +# Append to HISTFILE rather than overwrite upon exiting, per bug #139609. This +# option also requires for bash to have been built with readline support. +shopt -s histappend + +# Initialise PROMPT_COMMAND as an array, unless bash is acting as a login shell. +# In the latter case, the profile.d drop-in will already have initialised it. +shopt -q login_shell || PROMPT_COMMAND=() + +# Don't let the user influence the order of sourcing for bash 5.3 or greater. +unset -v GLOBSORT + +for _ in /etc/bash/bashrc.d/*; do + if [[ $_ == *.@(bash|sh) && -r $_ ]]; then + source "$_" + fi +done diff --git a/app-shells/bash/files/profile.d/00-prompt-command.sh b/app-shells/bash/files/profile.d/00-prompt-command.sh new file mode 100644 index 000000000000..61794c8ecb46 --- /dev/null +++ b/app-shells/bash/files/profile.d/00-prompt-command.sh @@ -0,0 +1,7 @@ +# This unit serves to initialise PROMPT_COMMAND as early as possible in cases +# where bash has been launched as a login shell. Though not an especially +# common practice, some profile.d drop-ins need to be able to extend its value. + +if [ "${BASH}" ] && shopt -q login_shell; then + eval 'PROMPT_COMMAND=()' +fi
