public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2019-01-15  1:05 Thomas Deutschmann
  0 siblings, 0 replies; 18+ messages in thread
From: Thomas Deutschmann @ 2019-01-15  1:05 UTC (permalink / raw
  To: gentoo-commits

commit:     d1906c39529bc3af416fcc4e7b1edc4901981b71
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 15 01:02:46 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Tue Jan 15 01:05:22 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d1906c39

app-shells/bash: define SHOBJ_STATUS; fix static build

Link: http://lists.gnu.org/archive/html/bug-bash/2016-10/msg00004.html
Bug: https://bugs.gentoo.org/675414
Package-Manager: Portage-2.3.55, Repoman-2.3.12
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 app-shells/bash/bash-4.4_p23-r1.ebuild             | 260 +++++++++++++++++++++
 .../bash/files/bash-4.4-set-SHOBJ_STATUS.patch     |  14 ++
 2 files changed, 274 insertions(+)

diff --git a/app-shells/bash/bash-4.4_p23-r1.ebuild b/app-shells/bash/bash-4.4_p23-r1.ebuild
new file mode 100644
index 00000000000..506c772dc1b
--- /dev/null
+++ b/app-shells/bash/bash-4.4_p23-r1.ebuild
@@ -0,0 +1,260 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit flag-o-matic toolchain-funcs multilib prefix
+
+# Official patchlevel
+# See ftp://ftp.cwru.edu/pub/bash/bash-4.4-patches/
+PLEVEL=${PV##*_p}
+MY_PV=${PV/_p*}
+MY_PV=${MY_PV/_/-}
+MY_P=${PN}-${MY_PV}
+is_release() {
+	case ${PV} in
+	*_alpha*|*_beta*|*_rc*) return 1 ;;
+	*) return 0 ;;
+	esac
+}
+[[ ${PV} != *_p* ]] && PLEVEL=0
+patches() {
+	local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}}
+	[[ ${plevel} -eq 0 ]] && return 1
+	eval set -- {1..${plevel}}
+	set -- $(printf "${pn}${pv/\.}-%03d " "$@")
+	if [[ ${opt} == -s ]] ; then
+		echo "${@/#/${DISTDIR}/}"
+	else
+		local u
+		for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do
+			printf "${u}/${pn}-${pv}-patches/%s " "$@"
+		done
+	fi
+}
+
+# The version of readline this bash normally ships with.
+READLINE_VER="7.0"
+
+DESCRIPTION="The standard GNU Bourne again shell"
+HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html"
+if is_release ; then
+	SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
+else
+	SRC_URI="ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
+fi
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline"
+
+DEPEND="
+	>=sys-libs/ncurses-5.2-r2:0=
+	readline? ( >=sys-libs/readline-${READLINE_VER}:0= )
+	nls? ( virtual/libintl )
+"
+RDEPEND="
+	${DEPEND}
+	!<sys-apps/portage-2.1.6.7_p1
+"
+# we only need yacc when the .y files get patched (bash42-005)
+#DEPEND+=" virtual/yacc"
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+	if is-flag -malign-double ; then #7332
+		eerror "Detected bad CFLAGS '-malign-double'.  Do not use this"
+		eerror "as it breaks LFS (struct stat64) on x86."
+		die "remove -malign-double from your CFLAGS mr ricer"
+	fi
+	if use bashlogger ; then
+		ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
+		ewarn "This will log ALL output you enter into the shell, you have been warned."
+	fi
+}
+
+src_unpack() {
+	unpack ${MY_P}.tar.gz
+}
+
+src_prepare() {
+	# Include official patches
+	[[ ${PLEVEL} -gt 0 ]] && eapply -p0 $(patches -s)
+
+	eapply "${FILESDIR}/${PN}-4.4-jobs_overflow.patch" #644720
+	eapply "${FILESDIR}/${PN}-4.4-set-SHOBJ_STATUS.patch" #644720
+
+	# Clean out local libs so we know we use system ones w/releases.
+	if is_release ; then
+		rm -rf lib/{readline,termcap}/*
+		touch lib/{readline,termcap}/Makefile.in # for config.status
+		sed -ri -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
+
+	# Avoid regenerating docs after patches #407985
+	sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
+	touch -r . doc/*
+
+	eapply_user
+}
+
+src_configure() {
+	local myconf=(
+		--disable-profiling
+		--docdir='$(datarootdir)'/doc/${PF}
+		--htmldir='$(docdir)/html'
+		--with-curses
+		$(use_enable mem-scramble)
+		$(use_enable net net-redirections)
+		$(use_enable readline)
+		$(use_enable readline bang-history)
+		$(use_enable readline history)
+		$(use_with afs)
+		$(use_with mem-scramble bash-malloc)
+	)
+
+	# For descriptions of these, see config-top.h
+	# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
+	append-cppflags \
+		-DDEFAULT_PATH_VALUE=\'\"${EPREFIX}/usr/local/sbin:${EPREFIX}/usr/local/bin:${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin\"\' \
+		-DSTANDARD_UTILS_PATH=\'\"${EPREFIX}/bin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/usr/sbin\"\' \
+		-DSYS_BASHRC=\'\"${EPREFIX}/etc/bash/bashrc\"\' \
+		-DSYS_BASH_LOGOUT=\'\"${EPREFIX}/etc/bash/bash_logout\"\' \
+		-DNON_INTERACTIVE_LOGIN_SHELLS \
+		-DSSH_SOURCE_BASHRC \
+		$(use bashlogger && echo -DSYSLOG_HISTORY)
+
+	# Don't even think about building this statically without
+	# reading Bug 7714 first.  If you still build it statically,
+	# don't come crying to us with bugs ;).
+	#use static && export LDFLAGS="${LDFLAGS} -static"
+	use nls || myconf+=( --disable-nls )
+
+	# Historically, we always used the builtin readline, but since
+	# our handling of SONAME upgrades has gotten much more stable
+	# in the PM (and the readline ebuild itself preserves the old
+	# libs during upgrades), linking against the system copy should
+	# be safe.
+	# Exact cached version here doesn't really matter as long as it
+	# is at least what's in the DEPEND up above.
+	export ac_cv_rl_version=${READLINE_VER%%_*}
+
+	# Force linking with system curses ... the bundled termcap lib
+	# sucks bad compared to ncurses.  For the most part, ncurses
+	# is here because readline needs it.  But bash itself calls
+	# ncurses in one or two small places :(.
+
+	if is_release ; then
+		# Use system readline only with released versions.
+		myconf+=( --with-installed-readline=. )
+	fi
+
+	if use plugins; then
+		append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
+	else
+		# Disable the plugins logic by hand since bash doesn't
+		# provide a way of doing it.
+		export ac_cv_func_dl{close,open,sym}=no \
+			ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
+		sed -i \
+			-e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
+			configure || die
+	fi
+	tc-export AR #444070
+	econf "${myconf[@]}"
+}
+
+src_compile() {
+	emake
+
+	if use plugins ; then
+		emake -C examples/loadables all others
+	fi
+}
+
+src_install() {
+	local d f
+
+	default
+
+	dodir /bin
+	mv "${ED%/}"/usr/bin/bash "${ED%/}"/bin/ || die
+	dosym bash /bin/rbash
+
+	insinto /etc/bash
+	doins "${FILESDIR}"/bash_logout
+	doins "$(prefixify_ro "${FILESDIR}"/bashrc)"
+	keepdir /etc/bash/bashrc.d
+	insinto /etc/skel
+	for f in bash{_logout,_profile,rc} ; do
+		newins "${FILESDIR}"/dot-${f} .${f}
+	done
+
+	local sed_args=(
+		-e "s:#${USERLAND}#@::"
+		-e '/#@/d'
+	)
+	if ! use readline ; then
+		sed_args+=( #432338
+			-e '/^shopt -s histappend/s:^:#:'
+			-e 's:use_color=true:use_color=false:'
+		)
+	fi
+	sed -i \
+		"${sed_args[@]}" \
+		"${ED%/}"/etc/skel/.bashrc \
+		"${ED%/}"/etc/bash/bashrc || die
+
+	if use plugins ; then
+		exeinto /usr/$(get_libdir)/bash
+		doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
+		insinto /usr/include/bash-plugins
+		doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
+	fi
+
+	if use examples ; then
+		for d in examples/{functions,misc,scripts,startup-files} ; do
+			exeinto /usr/share/doc/${PF}/${d}
+			insinto /usr/share/doc/${PF}/${d}
+			for f in ${d}/* ; do
+				if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
+					doexe ${f}
+				else
+					doins ${f}
+				fi
+			done
+		done
+	fi
+
+	doman doc/*.1
+	newdoc CWRU/changelog ChangeLog
+	dosym bash.info /usr/share/info/bashref.info
+}
+
+pkg_preinst() {
+	if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
+		mkdir -p "${EROOT}"/etc/bash
+		mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
+	fi
+
+	if [[ -L ${EROOT}/bin/sh ]] ; then
+		# rewrite the symlink to ensure that its mtime changes. having /bin/sh
+		# missing even temporarily causes a fatal error with paludis.
+		local target=$(readlink "${EROOT}"/bin/sh)
+		local tmp=$(emktemp "${EROOT}"/bin)
+		ln -sf "${target}" "${tmp}"
+		mv -f "${tmp}" "${EROOT}"/bin/sh
+	fi
+}
+
+pkg_postinst() {
+	# If /bin/sh does not exist, provide it
+	if [[ ! -e ${EROOT}/bin/sh ]] ; then
+		ln -sf bash "${EROOT}"/bin/sh
+	fi
+}

diff --git a/app-shells/bash/files/bash-4.4-set-SHOBJ_STATUS.patch b/app-shells/bash/files/bash-4.4-set-SHOBJ_STATUS.patch
new file mode 100644
index 00000000000..96302c2030e
--- /dev/null
+++ b/app-shells/bash/files/bash-4.4-set-SHOBJ_STATUS.patch
@@ -0,0 +1,14 @@
+http://lists.gnu.org/archive/html/bug-bash/2016-10/msg00004.html
+
+--- a/configure
++++ b/configure
+@@ -16124,6 +16124,9 @@ $as_echo_n "checking shared object configuration for loadable builtins... " >&6;
+ 
+ 	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHOBJ_STATUS" >&5
+ $as_echo "$SHOBJ_STATUS" >&6; }
++else
++	SHOBJ_STATUS=unsupported
++
+ fi
+ 
+ # try to create a directory tree if the source is elsewhere


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2023-12-02  4:26 Sam James
  0 siblings, 0 replies; 18+ messages in thread
From: Sam James @ 2023-12-02  4:26 UTC (permalink / raw
  To: gentoo-commits

commit:     9c51528023c4f13a5c407e8bbf2fc6d2e0cc56a1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Dec  2 04:13:49 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Dec  2 04:13:49 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9c515280

app-shells/bash: fix another configure check for modern c

Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-shells/bash/bash-5.2_p21-r1.ebuild             | 374 +++++++++++++++++++++
 .../files/bash-5.2_p21-configure-strtold.patch     |  32 ++
 2 files changed, 406 insertions(+)

diff --git a/app-shells/bash/bash-5.2_p21-r1.ebuild b/app-shells/bash/bash-5.2_p21-r1.ebuild
new file mode 100644
index 000000000000..48634f88f47d
--- /dev/null
+++ b/app-shells/bash/bash-5.2_p21-r1.ebuild
@@ -0,0 +1,374 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/chetramey.asc
+inherit flag-o-matic toolchain-funcs prefix verify-sig
+
+# Uncomment if we have a patchset
+#GENTOO_PATCH_DEV="sam"
+#GENTOO_PATCH_VER="${PV}"
+
+# Official patchlevel
+# See ftp://ftp.cwru.edu/pub/bash/bash-5.1-patches/
+PLEVEL="${PV##*_p}"
+MY_PV="${PV/_p*}"
+MY_PV="${MY_PV/_/-}"
+MY_P="${PN}-${MY_PV}"
+MY_PATCHES=()
+
+is_release() {
+	case ${PV} in
+		9999|*_alpha*|*_beta*|*_rc*)
+			return 1
+			;;
+		*)
+			return 0
+			;;
+	esac
+}
+
+[[ ${PV} != *_p* ]] && PLEVEL=0
+
+# The version of readline this bash normally ships with.
+# Note: right now, we don't use the system copy of readline for bash for non-releases.
+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"
+
+if [[ ${PV} == 9999 ]] ; then
+	EGIT_REPO_URI="https://git.savannah.gnu.org/git/bash.git"
+	EGIT_BRANCH=devel
+	inherit git-r3
+elif is_release ; then
+	SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz"
+	SRC_URI+=" verify-sig? ( mirror://gnu/bash/${MY_P}.tar.gz.sig )"
+
+	if [[ ${PLEVEL} -gt 0 ]] ; then
+		# bash-5.1 -> bash51
+		my_p=${PN}$(ver_rs 1-2 '' $(ver_cut 1-2))
+
+		patch_url=
+		my_patch_index=
+
+		upstream_url_base="mirror://gnu/bash"
+		mirror_url_base="ftp://ftp.cwru.edu/pub/bash"
+
+		for ((my_patch_index=1; my_patch_index <= ${PLEVEL} ; my_patch_index++)) ; do
+			printf -v mangled_patch_ver ${my_p}-%03d ${my_patch_index}
+			patch_url="${upstream_url_base}/${MY_P}-patches/${mangled_patch_ver}"
+
+			SRC_URI+=" ${patch_url}"
+			SRC_URI+=" verify-sig? ( ${patch_url}.sig )"
+
+			# Add in the mirror URL too.
+			SRC_URI+=" ${patch_url/${upstream_url_base}/${mirror_url_base}}"
+			SRC_URI+=" verify-sig? ( ${patch_url/${upstream_url_base}/${mirror_url_base}} )"
+
+			MY_PATCHES+=( "${DISTDIR}"/${mangled_patch_ver} )
+		done
+
+		unset my_p patch_url my_patch_index upstream_url_base mirror_url_base
+	fi
+else
+	SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
+	SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${MY_P}.tar.gz.sig ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )"
+fi
+
+if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+	SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
+fi
+
+LICENSE="GPL-3+"
+SLOT="0"
+if is_release ; then
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+fi
+IUSE="afs bashlogger examples mem-scramble +net nls plugins pgo +readline"
+
+DEPEND="
+	>=sys-libs/ncurses-5.2-r2:=
+	nls? ( virtual/libintl )
+"
+if is_release ; then
+	DEPEND+=" readline? ( >=sys-libs/readline-${READLINE_VER}:= )"
+fi
+RDEPEND="
+	${DEPEND}
+"
+# We only need bison (yacc) when the .y files get patched (bash42-005, bash51-011)
+BDEPEND="
+	pgo? ( dev-util/gperf )
+	verify-sig? ( sec-keys/openpgp-keys-chetramey )
+"
+
+S="${WORKDIR}/${MY_P}"
+
+# EAPI 8 tries to append it but it doesn't exist here
+QA_CONFIGURE_OPTIONS="--disable-static"
+
+PATCHES=(
+	#"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}/
+
+	# Patches from Chet sent to bash-bug ml
+	"${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_p21-configure-strtold.patch
+)
+
+pkg_setup() {
+	# bug #7332
+	if is-flag -malign-double ; then
+		eerror "Detected bad CFLAGS '-malign-double'.  Do not use this"
+		eerror "as it breaks LFS (struct stat64) on x86."
+		die "remove -malign-double from your CFLAGS mr ricer"
+	fi
+
+	if use bashlogger ; then
+		ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
+		ewarn "This will log ALL output you enter into the shell, you have been warned."
+	fi
+}
+
+src_unpack() {
+	if [[ ${PV} == 9999 ]] ; then
+		git-r3_src_unpack
+	else
+		if use verify-sig ; then
+			verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.sig}
+
+			local patch
+			for patch in "${MY_PATCHES[@]}" ; do
+				verify-sig_verify_detached ${patch}{,.sig}
+			done
+		fi
+
+		unpack ${MY_P}.tar.gz
+
+		if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+			unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
+		fi
+	fi
+}
+
+src_prepare() {
+	# Include official patches
+	[[ ${PLEVEL} -gt 0 ]] && eapply -p0 "${MY_PATCHES[@]}"
+
+	# Clean out local libs so we know we use system ones w/releases.
+	if is_release ; then
+		rm -rf lib/{readline,termcap}/* || die
+		touch lib/{readline,termcap}/Makefile.in || die # for config.status
+		sed -ri -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
+
+	# Avoid regenerating docs after patches, bug #407985
+	sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
+	touch -r . doc/* || die
+
+	# Sometimes hangs (more noticeable w/ pgo), bug #907403.
+	rm tests/run-jobs || die
+
+	eapply -p0 "${PATCHES[@]}"
+	eapply_user
+}
+
+src_configure() {
+	# Upstream only test with Bison and require GNUisms like YYEOF and
+	# YYERRCODE. The former at least may be in POSIX soon:
+	# https://www.austingroupbugs.net/view.php?id=1269.
+	# configure warns on use of non-Bison but doesn't abort. The result
+	# may misbehave at runtime.
+	unset YACC
+
+	local myconf=(
+		--disable-profiling
+
+		# Force linking with system curses ... the bundled termcap lib
+		# sucks bad compared to ncurses.  For the most part, ncurses
+		# is here because readline needs it.  But bash itself calls
+		# ncurses in one or two small places :(.
+		--with-curses
+
+		$(use_enable mem-scramble)
+		$(use_enable net net-redirections)
+		$(use_enable readline)
+		$(use_enable readline bang-history)
+		$(use_enable readline history)
+		$(use_with afs)
+		$(use_with mem-scramble bash-malloc)
+	)
+
+	# For descriptions of these, see config-top.h
+	# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
+	append-cppflags \
+		-DDEFAULT_PATH_VALUE=\'\""${EPREFIX}"/usr/local/sbin:"${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/sbin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/bin\"\' \
+		-DSTANDARD_UTILS_PATH=\'\""${EPREFIX}"/bin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/usr/sbin\"\' \
+		-DSYS_BASHRC=\'\""${EPREFIX}"/etc/bash/bashrc\"\' \
+		-DSYS_BASH_LOGOUT=\'\""${EPREFIX}"/etc/bash/bash_logout\"\' \
+		-DNON_INTERACTIVE_LOGIN_SHELLS \
+		-DSSH_SOURCE_BASHRC \
+		$(use bashlogger && echo -DSYSLOG_HISTORY)
+
+	# Don't even think about building this statically without
+	# reading bug #7714 first.  If you still build it statically,
+	# don't come crying to us with bugs ;).
+	#use static && export LDFLAGS="${LDFLAGS} -static"
+	use nls || myconf+=( --disable-nls )
+
+	if is_release ; then
+		# Historically, we always used the builtin readline, but since
+		# our handling of SONAME upgrades has gotten much more stable
+		# in the PM (and the readline ebuild itself preserves the old
+		# libs during upgrades), linking against the system copy should
+		# be safe.
+		# Exact cached version here doesn't really matter as long as it
+		# is at least what's in the DEPEND up above.
+		export ac_cv_rl_version=${READLINE_VER%%_*}
+
+		# Use system readline only with released versions.
+		myconf+=( --with-installed-readline=. )
+	fi
+
+	if use plugins ; then
+		append-ldflags -Wl,-rpath,"${EPREFIX}"/usr/$(get_libdir)/bash
+	else
+		# Disable the plugins logic by hand since bash doesn't
+		# provide a way of doing it.
+		export ac_cv_func_dl{close,open,sym}=no \
+			ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
+
+		sed -i \
+			-e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
+			configure || die
+	fi
+
+	# bug #444070
+	tc-export AR
+
+	econf "${myconf[@]}"
+}
+
+src_compile() {
+	# -fprofile-partial-training because upstream note the test suite isn't super comprehensive
+	# See https://documentation.suse.com/sbp/all/html/SBP-GCC-10/index.html#sec-gcc10-pgo
+	local pgo_generate_flags=$(usev pgo "-fprofile-update=atomic -fprofile-dir=${T}/pgo -fprofile-generate=${T}/pgo $(test-flags-CC -fprofile-partial-training)")
+	local pgo_use_flags=$(usev pgo "-fprofile-use=${T}/pgo -fprofile-dir=${T}/pgo $(test-flags-CC -fprofile-partial-training)")
+
+	emake CFLAGS="${CFLAGS} ${pgo_generate_flags}"
+	use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_generate_flags}" all others
+
+	# Build Bash and run its tests to generate profiles.
+	if use pgo ; then
+		# Used in test suite.
+		unset A
+
+		emake CFLAGS="${CFLAGS} ${pgo_generate_flags}" -k check
+
+		if tc-is-clang; then
+			llvm-profdata merge "${T}"/pgo --output="${T}"/pgo/default.profdata || die
+		fi
+
+		# Rebuild Bash using the profiling data we just generated.
+		emake clean
+		emake CFLAGS="${CFLAGS} ${pgo_use_flags}"
+		use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_use_flags}" all others
+	fi
+}
+
+src_test() {
+	# Used in test suite.
+	unset A
+
+	default
+}
+
+src_install() {
+	local d f
+
+	default
+
+	dodir /bin
+	mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
+	dosym bash /bin/rbash
+
+	insinto /etc/bash
+	doins "${FILESDIR}"/bash_logout
+	doins "$(prefixify_ro "${FILESDIR}"/bashrc)"
+
+	keepdir /etc/bash/bashrc.d
+
+	insinto /etc/skel
+	for f in bash{_logout,_profile,rc} ; do
+		newins "${FILESDIR}"/dot-${f} .${f}
+	done
+
+	local sed_args=(
+		-e 's:#GNU#@::'
+		-e '/#@/d'
+	)
+
+	if ! use readline ; then
+		# bug #432338
+		sed_args+=(
+			-e '/^shopt -s histappend/s:^:#:'
+			-e 's:use_color=true:use_color=false:'
+		)
+	fi
+
+	sed -i \
+		"${sed_args[@]}" \
+		"${ED}"/etc/skel/.bashrc \
+		"${ED}"/etc/bash/bashrc || die
+
+	if use plugins ; then
+		exeinto /usr/$(get_libdir)/bash
+		doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
+
+		insinto /usr/include/bash-plugins
+		doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
+	fi
+
+	if use examples ; then
+		for d in examples/{functions,misc,scripts,startup-files} ; do
+			exeinto /usr/share/doc/${PF}/${d}
+			docinto ${d}
+			for f in ${d}/* ; do
+				if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
+					doexe ${f}
+				else
+					dodoc ${f}
+				fi
+			done
+		done
+	fi
+
+	# Install bash_builtins.1 and rbash.1
+	emake -C doc DESTDIR="${D}" install_builtins
+	sed 's:bash\.1:man1/&:' doc/rbash.1 > "${T}"/rbash.1 || die
+	doman "${T}"/rbash.1
+
+	newdoc CWRU/changelog ChangeLog
+	dosym bash.info /usr/share/info/bashref.info
+}
+
+pkg_preinst() {
+	if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
+		mkdir -p "${EROOT}"/etc/bash
+		mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
+	fi
+}
+
+pkg_postinst() {
+	# If /bin/sh does not exist, provide it
+	if [[ ! -e ${EROOT}/bin/sh ]] ; then
+		ln -sf bash "${EROOT}"/bin/sh
+	fi
+}

diff --git a/app-shells/bash/files/bash-5.2_p21-configure-strtold.patch b/app-shells/bash/files/bash-5.2_p21-configure-strtold.patch
new file mode 100644
index 000000000000..51e9a19daebb
--- /dev/null
+++ b/app-shells/bash/files/bash-5.2_p21-configure-strtold.patch
@@ -0,0 +1,32 @@
+https://src.fedoraproject.org/rpms/bash/blob/bd5ac20b134f2936c54245fc83a8e70207d3e07e/f/bash-configure-c99-2.patch
+
+Another C compatibility issue: char ** and char * are distinct types,
+and strtold expects the former for its second argument.
+
+Submitted upstream:
+
+  <https://lists.gnu.org/archive/html/bug-bash/2023-11/msg00104.html>
+
+--- configure.ac
++++ configure.ac
+@@ -885,7 +885,7 @@ AC_CHECK_DECLS([strtold], [
+ 	[AC_COMPILE_IFELSE(
+ 		[AC_LANG_PROGRAM(
+ 		[[#include <stdlib.h>]],
+-		[[long double r; char *foo, bar; r = strtold(foo, &bar);]]
++		[[long double r; char *foo, *bar; r = strtold(foo, &bar);]]
+ 	)],
+ 	[bash_cv_strtold_broken=no],[bash_cv_strtold_broken=yes])
+         ]
+
+--- configure
++++ configure
+@@ -15676,7 +15676,7 @@ else $as_nop
+ int
+ main (void)
+ {
+-long double r; char *foo, bar; r = strtold(foo, &bar);
++long double r; char *foo, *bar; r = strtold(foo, &bar);
+ 
+   ;
+   return 0;


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2023-11-11  0:21 Sam James
  0 siblings, 0 replies; 18+ messages in thread
From: Sam James @ 2023-11-11  0:21 UTC (permalink / raw
  To: gentoo-commits

commit:     9edfdc3c8998055e798eee56fa4ffd052c847b2e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 11 00:20:24 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 11 00:20:32 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9edfdc3c

app-shells/bash: add 5.2_p21

Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-shells/bash/Manifest                           |  12 +
 app-shells/bash/bash-5.2_p21.ebuild                | 373 +++++++++++++++++++++
 .../bash/files/bash-5.2_p21-wpointer-to-int.patch  |  13 +
 3 files changed, 398 insertions(+)

diff --git a/app-shells/bash/Manifest b/app-shells/bash/Manifest
index 45a63cd6c251..c4530d8443f3 100644
--- a/app-shells/bash/Manifest
+++ b/app-shells/bash/Manifest
@@ -403,3 +403,15 @@ DIST bash52-014 3245 BLAKE2B 990e6566c446ce030d1333a05de9027a994054e983bf414e9aa
 DIST bash52-014.sig 95 BLAKE2B 2206483fd1b356099bab6fb7793d21dbd5b2adcbe2b108c69c5d7ccd6a13f934c69adcecd5f3fb1783b380c91c362609a175c4b95f25ac9996bbfad0147f250d SHA512 e7404ca3ff8bac3cb0dc7edd0bfc79dddd07734474c8d99a4dfffae87645653f05a26911e5f1e4670d80472423c84b42f86c84835ca310c083bcf16cdf860dd2
 DIST bash52-015 8088 BLAKE2B 038f03bc543297a3f2e7612afdee7b27eb5d65d7f81c22976936211f4a80acd9f0faf1ba6c56e20fc653b877a448ab7872b5488da3684952682d80c752227ab2 SHA512 eb1bd6b3bf8811d765f222cd48360eb7f3f0aaa4f29f1b6c1f17635b819e5e4734ec4e7fcfde551fd7a6299a7d67869ea0bc5cc86cc523bc4a64d30e433df493
 DIST bash52-015.sig 95 BLAKE2B b32afb78e24554ccc73f95883e1c78cdee222e589634ecca947b00ce163596373de6179f7c6e6bccbb9ab846c9ff3c8ee04723f23b1a641c908f535c01cbea2c SHA512 047d84c9e1bc996acfb735667409a7285d025fc8c63b9c7da86ace9e6be133d58bd66bf8bf918b81d27aaebc5795419604418d2ddb0ee11b675f283b634f441f
+DIST bash52-016 1225 BLAKE2B 675b70e1df1083021fb6336e50d10012dc02e1a80865a64579256319ca98c8282af20e7210ef9d993f97718c7bfed2315f23edac04e6f3af65a1e08cd5f7ef2e SHA512 11c3197870570050767887a7497b52549caf2bf74e69c5a4eb95ff316942177da0a1150819f7051eb690841796b98d9a81f784204d18ad176cd2c29473e466d4
+DIST bash52-016.sig 95 BLAKE2B 6b61d9293f0f804c12d3c0a0afa802d91fbdbb55e3f69daaad8b1fcb23718ebcca56c9a9fc6b35eaefe05f146b5a502291aead23c523f966e32e3f0585b0fc08 SHA512 59bae9616765a10b3f12f5ca6f6ef6c2d2179c50d94e5698b1c6bfc5cb0819328ee8537bab86ab6efb936f262bdfe14f7fc9d5ba0b88e5c4ebd2cf1aae22990a
+DIST bash52-017 1396 BLAKE2B 461f2f6543501306faa5decd98211699f0ce84eea5a1225145dc401ec0ca893c9d8021359c04af4dec265e7d247f2fbb70cfe8d5382e3c38fd2774e017de4aed SHA512 1844d1f4fbce0ae1dd8f2b9c152decc7cc645b7c0c66e84ed129072251e990f2da2220917957e98dd8b1299d2d10fb2dd23e184e40457063c1d554bb132ef1e5
+DIST bash52-017.sig 95 BLAKE2B cf83b861273b9f7e7611367f7551be7af678839fd1c0570eaf1f8ec54ab8e858b78086f2c20ff5d1899aa8544cc27dd2dc2b6d518f6ff4e1d35bc6f4eb5c752e SHA512 8978eeb9180d2cf699247a1cff537708be9882916cba02ed991b0403aaf0b9d7bbff54b601f4251466114dc0ce5100685ef655504ce1f2d08bb5f5a2b73dadd8
+DIST bash52-018 151467 BLAKE2B 89f95c096f8e487e2a1a00541087d157321b125ae93dc656af0cf6ead9158401a028f5c838c4b81aeb95e7c4951a3b4dfb1a88e08297a03236c0ad36eb6710d2 SHA512 b454ba8a311b0943f9669425891499fe8d4b5f1a90899bf6c4d0969699e21f8f8e08d0b0e23a7cf5c97aa6b21384ae907ed710254053e7edd43328aa6003780c
+DIST bash52-018.sig 95 BLAKE2B 4b371fda53d2bd01b4527688209b49677b5b9f60de6c393fb2b810ba1342c98af0b1e50f35a0a6ef85116686451fad1e103da74611645ed99e04f438dd6245c7 SHA512 0930923972e94dab24f33ef68be03dde13b9b13424078102f5f7d5a7c8080f64989b283417efe2c72c89d2e2c2def9a27470b3e125cc233f5c95122c78b9b540
+DIST bash52-019 2548 BLAKE2B bcf683825da1e56692d7024748501cc582e623168fc1a8713ef3b4eb284222f6bf9144871d6357464a1c8c031f105ca6cac6cc591b5463d8b72eb139fcf044f0 SHA512 d009b0a571a3e23ab723c6c6fd4b28c48db1a927d690b4c42d7ed2fa51052aaf662026a2de9e4ee3676087eac844f8b57adae567556228c4fd8fb4ed3c8a1b94
+DIST bash52-019.sig 95 BLAKE2B f42700d5a25003d9f3e722c6230bb8795e2d01fe4b4b49411956757346f8df42bdfcc5af3a87469df7f560fb9857a05e45258f6057fd26090f0d3e17f9303fc5 SHA512 56de5fe1b98ff89ea5483f9ccef68ea8a7563e7cfa933daa223cd98f9b2d882e6692ae34859281906a228e9c510f1506c3c808eaaad6eeab762df00da2fbf55b
+DIST bash52-020 1459 BLAKE2B de3e38dbb2395c765767aed516ae3d143e3187a44964f90c587f41f93447c43515481e3c9bd562175d750d0dfb9e4e3eacb25c31f8bf54168fa544c938955eae SHA512 a5a927e90ac3daead54e90f8ff99dbda0fd652c3df83b7bcde0adb136fc4ba8498810e5bfa1d7f0c143422bf1f4622a4669c96e505bccad7c9a271d7e0668187
+DIST bash52-020.sig 95 BLAKE2B 8fd778b381cc14d17de8f2b7e215fa0d35c569a90d46fac77c0a94bea525bd62428663f0a908e64ff773bd4caf0aab7f92c2dda1f4158aacbd53f053be91d16d SHA512 0ae6d9189329e560a89af9f42f0f98126faeb15d29bd327e6bd7694870a9bcfae3d3d545e42baf4223dcc732a50d46e4c22477c41b98be85736bb05a359eeeec
+DIST bash52-021 1890 BLAKE2B cc2d886da8c51eb7bdbed694423eae29dc05dc2c7bd0cd41b9ee3acbc56ef135043bb48275c4162d33d2d4051a0a8b27f3aec097335b9d15e38fd841a6793f71 SHA512 c3a61e975819919d7ba120f322fc5e9a420b21f03d7bf989a5e7b6a99bfe35372744277040e88361ee383ab53b05d607d52ff2000b401de038af67c91728b48f
+DIST bash52-021.sig 95 BLAKE2B 79572b14f423f0a96e89d106c5ed448c2b447760e99c743354bd6315132325c19312cfcad98f94c42d3094bb4283c1f7753ac4d3c600d46c63e49d0f7cc3befd SHA512 4063559edade78d1510c12b825aa29925e515807b447e50fe564770ee26ddf34e18b47132e5154a4c883043cc80b3d6415e4ba370bad308a17dc0f6b53fc61c5

diff --git a/app-shells/bash/bash-5.2_p21.ebuild b/app-shells/bash/bash-5.2_p21.ebuild
new file mode 100644
index 000000000000..08518b8b3633
--- /dev/null
+++ b/app-shells/bash/bash-5.2_p21.ebuild
@@ -0,0 +1,373 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/chetramey.asc
+inherit flag-o-matic toolchain-funcs prefix verify-sig
+
+# Uncomment if we have a patchset
+#GENTOO_PATCH_DEV="sam"
+#GENTOO_PATCH_VER="${PV}"
+
+# Official patchlevel
+# See ftp://ftp.cwru.edu/pub/bash/bash-5.1-patches/
+PLEVEL="${PV##*_p}"
+MY_PV="${PV/_p*}"
+MY_PV="${MY_PV/_/-}"
+MY_P="${PN}-${MY_PV}"
+MY_PATCHES=()
+
+is_release() {
+	case ${PV} in
+		9999|*_alpha*|*_beta*|*_rc*)
+			return 1
+			;;
+		*)
+			return 0
+			;;
+	esac
+}
+
+[[ ${PV} != *_p* ]] && PLEVEL=0
+
+# The version of readline this bash normally ships with.
+# Note: right now, we don't use the system copy of readline for bash for non-releases.
+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"
+
+if [[ ${PV} == 9999 ]] ; then
+	EGIT_REPO_URI="https://git.savannah.gnu.org/git/bash.git"
+	EGIT_BRANCH=devel
+	inherit git-r3
+elif is_release ; then
+	SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz"
+	SRC_URI+=" verify-sig? ( mirror://gnu/bash/${MY_P}.tar.gz.sig )"
+
+	if [[ ${PLEVEL} -gt 0 ]] ; then
+		# bash-5.1 -> bash51
+		my_p=${PN}$(ver_rs 1-2 '' $(ver_cut 1-2))
+
+		patch_url=
+		my_patch_index=
+
+		upstream_url_base="mirror://gnu/bash"
+		mirror_url_base="ftp://ftp.cwru.edu/pub/bash"
+
+		for ((my_patch_index=1; my_patch_index <= ${PLEVEL} ; my_patch_index++)) ; do
+			printf -v mangled_patch_ver ${my_p}-%03d ${my_patch_index}
+			patch_url="${upstream_url_base}/${MY_P}-patches/${mangled_patch_ver}"
+
+			SRC_URI+=" ${patch_url}"
+			SRC_URI+=" verify-sig? ( ${patch_url}.sig )"
+
+			# Add in the mirror URL too.
+			SRC_URI+=" ${patch_url/${upstream_url_base}/${mirror_url_base}}"
+			SRC_URI+=" verify-sig? ( ${patch_url/${upstream_url_base}/${mirror_url_base}} )"
+
+			MY_PATCHES+=( "${DISTDIR}"/${mangled_patch_ver} )
+		done
+
+		unset my_p patch_url my_patch_index upstream_url_base mirror_url_base
+	fi
+else
+	SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
+	SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${MY_P}.tar.gz.sig ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )"
+fi
+
+if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+	SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
+fi
+
+LICENSE="GPL-3+"
+SLOT="0"
+if is_release ; then
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+fi
+IUSE="afs bashlogger examples mem-scramble +net nls plugins pgo +readline"
+
+DEPEND="
+	>=sys-libs/ncurses-5.2-r2:=
+	nls? ( virtual/libintl )
+"
+if is_release ; then
+	DEPEND+=" readline? ( >=sys-libs/readline-${READLINE_VER}:= )"
+fi
+RDEPEND="
+	${DEPEND}
+"
+# We only need bison (yacc) when the .y files get patched (bash42-005, bash51-011)
+BDEPEND="
+	pgo? ( dev-util/gperf )
+	verify-sig? ( sec-keys/openpgp-keys-chetramey )
+"
+
+S="${WORKDIR}/${MY_P}"
+
+# EAPI 8 tries to append it but it doesn't exist here
+QA_CONFIGURE_OPTIONS="--disable-static"
+
+PATCHES=(
+	#"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}/
+
+	# Patches from Chet sent to bash-bug ml
+	"${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
+)
+
+pkg_setup() {
+	# bug #7332
+	if is-flag -malign-double ; then
+		eerror "Detected bad CFLAGS '-malign-double'.  Do not use this"
+		eerror "as it breaks LFS (struct stat64) on x86."
+		die "remove -malign-double from your CFLAGS mr ricer"
+	fi
+
+	if use bashlogger ; then
+		ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
+		ewarn "This will log ALL output you enter into the shell, you have been warned."
+	fi
+}
+
+src_unpack() {
+	if [[ ${PV} == 9999 ]] ; then
+		git-r3_src_unpack
+	else
+		if use verify-sig ; then
+			verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.sig}
+
+			local patch
+			for patch in "${MY_PATCHES[@]}" ; do
+				verify-sig_verify_detached ${patch}{,.sig}
+			done
+		fi
+
+		unpack ${MY_P}.tar.gz
+
+		if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+			unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
+		fi
+	fi
+}
+
+src_prepare() {
+	# Include official patches
+	[[ ${PLEVEL} -gt 0 ]] && eapply -p0 "${MY_PATCHES[@]}"
+
+	# Clean out local libs so we know we use system ones w/releases.
+	if is_release ; then
+		rm -rf lib/{readline,termcap}/* || die
+		touch lib/{readline,termcap}/Makefile.in || die # for config.status
+		sed -ri -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
+
+	# Avoid regenerating docs after patches, bug #407985
+	sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
+	touch -r . doc/* || die
+
+	# Sometimes hangs (more noticeable w/ pgo), bug #907403.
+	rm tests/run-jobs || die
+
+	eapply -p0 "${PATCHES[@]}"
+	eapply_user
+}
+
+src_configure() {
+	# Upstream only test with Bison and require GNUisms like YYEOF and
+	# YYERRCODE. The former at least may be in POSIX soon:
+	# https://www.austingroupbugs.net/view.php?id=1269.
+	# configure warns on use of non-Bison but doesn't abort. The result
+	# may misbehave at runtime.
+	unset YACC
+
+	local myconf=(
+		--disable-profiling
+
+		# Force linking with system curses ... the bundled termcap lib
+		# sucks bad compared to ncurses.  For the most part, ncurses
+		# is here because readline needs it.  But bash itself calls
+		# ncurses in one or two small places :(.
+		--with-curses
+
+		$(use_enable mem-scramble)
+		$(use_enable net net-redirections)
+		$(use_enable readline)
+		$(use_enable readline bang-history)
+		$(use_enable readline history)
+		$(use_with afs)
+		$(use_with mem-scramble bash-malloc)
+	)
+
+	# For descriptions of these, see config-top.h
+	# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
+	append-cppflags \
+		-DDEFAULT_PATH_VALUE=\'\""${EPREFIX}"/usr/local/sbin:"${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/sbin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/bin\"\' \
+		-DSTANDARD_UTILS_PATH=\'\""${EPREFIX}"/bin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/usr/sbin\"\' \
+		-DSYS_BASHRC=\'\""${EPREFIX}"/etc/bash/bashrc\"\' \
+		-DSYS_BASH_LOGOUT=\'\""${EPREFIX}"/etc/bash/bash_logout\"\' \
+		-DNON_INTERACTIVE_LOGIN_SHELLS \
+		-DSSH_SOURCE_BASHRC \
+		$(use bashlogger && echo -DSYSLOG_HISTORY)
+
+	# Don't even think about building this statically without
+	# reading bug #7714 first.  If you still build it statically,
+	# don't come crying to us with bugs ;).
+	#use static && export LDFLAGS="${LDFLAGS} -static"
+	use nls || myconf+=( --disable-nls )
+
+	if is_release ; then
+		# Historically, we always used the builtin readline, but since
+		# our handling of SONAME upgrades has gotten much more stable
+		# in the PM (and the readline ebuild itself preserves the old
+		# libs during upgrades), linking against the system copy should
+		# be safe.
+		# Exact cached version here doesn't really matter as long as it
+		# is at least what's in the DEPEND up above.
+		export ac_cv_rl_version=${READLINE_VER%%_*}
+
+		# Use system readline only with released versions.
+		myconf+=( --with-installed-readline=. )
+	fi
+
+	if use plugins ; then
+		append-ldflags -Wl,-rpath,"${EPREFIX}"/usr/$(get_libdir)/bash
+	else
+		# Disable the plugins logic by hand since bash doesn't
+		# provide a way of doing it.
+		export ac_cv_func_dl{close,open,sym}=no \
+			ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
+
+		sed -i \
+			-e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
+			configure || die
+	fi
+
+	# bug #444070
+	tc-export AR
+
+	econf "${myconf[@]}"
+}
+
+src_compile() {
+	# -fprofile-partial-training because upstream note the test suite isn't super comprehensive
+	# See https://documentation.suse.com/sbp/all/html/SBP-GCC-10/index.html#sec-gcc10-pgo
+	local pgo_generate_flags=$(usev pgo "-fprofile-update=atomic -fprofile-dir=${T}/pgo -fprofile-generate=${T}/pgo $(test-flags-CC -fprofile-partial-training)")
+	local pgo_use_flags=$(usev pgo "-fprofile-use=${T}/pgo -fprofile-dir=${T}/pgo $(test-flags-CC -fprofile-partial-training)")
+
+	emake CFLAGS="${CFLAGS} ${pgo_generate_flags}"
+	use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_generate_flags}" all others
+
+	# Build Bash and run its tests to generate profiles.
+	if use pgo ; then
+		# Used in test suite.
+		unset A
+
+		emake CFLAGS="${CFLAGS} ${pgo_generate_flags}" -k check
+
+		if tc-is-clang; then
+			llvm-profdata merge "${T}"/pgo --output="${T}"/pgo/default.profdata || die
+		fi
+
+		# Rebuild Bash using the profiling data we just generated.
+		emake clean
+		emake CFLAGS="${CFLAGS} ${pgo_use_flags}"
+		use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_use_flags}" all others
+	fi
+}
+
+src_test() {
+	# Used in test suite.
+	unset A
+
+	default
+}
+
+src_install() {
+	local d f
+
+	default
+
+	dodir /bin
+	mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
+	dosym bash /bin/rbash
+
+	insinto /etc/bash
+	doins "${FILESDIR}"/bash_logout
+	doins "$(prefixify_ro "${FILESDIR}"/bashrc)"
+
+	keepdir /etc/bash/bashrc.d
+
+	insinto /etc/skel
+	for f in bash{_logout,_profile,rc} ; do
+		newins "${FILESDIR}"/dot-${f} .${f}
+	done
+
+	local sed_args=(
+		-e 's:#GNU#@::'
+		-e '/#@/d'
+	)
+
+	if ! use readline ; then
+		# bug #432338
+		sed_args+=(
+			-e '/^shopt -s histappend/s:^:#:'
+			-e 's:use_color=true:use_color=false:'
+		)
+	fi
+
+	sed -i \
+		"${sed_args[@]}" \
+		"${ED}"/etc/skel/.bashrc \
+		"${ED}"/etc/bash/bashrc || die
+
+	if use plugins ; then
+		exeinto /usr/$(get_libdir)/bash
+		doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
+
+		insinto /usr/include/bash-plugins
+		doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
+	fi
+
+	if use examples ; then
+		for d in examples/{functions,misc,scripts,startup-files} ; do
+			exeinto /usr/share/doc/${PF}/${d}
+			docinto ${d}
+			for f in ${d}/* ; do
+				if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
+					doexe ${f}
+				else
+					dodoc ${f}
+				fi
+			done
+		done
+	fi
+
+	# Install bash_builtins.1 and rbash.1
+	emake -C doc DESTDIR="${D}" install_builtins
+	sed 's:bash\.1:man1/&:' doc/rbash.1 > "${T}"/rbash.1 || die
+	doman "${T}"/rbash.1
+
+	newdoc CWRU/changelog ChangeLog
+	dosym bash.info /usr/share/info/bashref.info
+}
+
+pkg_preinst() {
+	if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
+		mkdir -p "${EROOT}"/etc/bash
+		mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
+	fi
+}
+
+pkg_postinst() {
+	# If /bin/sh does not exist, provide it
+	if [[ ! -e ${EROOT}/bin/sh ]] ; then
+		ln -sf bash "${EROOT}"/bin/sh
+	fi
+}

diff --git a/app-shells/bash/files/bash-5.2_p21-wpointer-to-int.patch b/app-shells/bash/files/bash-5.2_p21-wpointer-to-int.patch
new file mode 100644
index 000000000000..3d4abbc47f43
--- /dev/null
+++ b/app-shells/bash/files/bash-5.2_p21-wpointer-to-int.patch
@@ -0,0 +1,13 @@
+https://lists.gnu.org/archive/html/bug-bash/2023-03/msg00116.html
+https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=57d4dc15ff35895a1c1248f948f59739ffb99fde
+--- lib/sh/random.c
++++ lib/sh/random.c
+@@ -90,7 +90,7 @@ genseed ()
+   u_bits32_t iv;
+ 
+   gettimeofday (&tv, NULL);
+-  iv = (u_bits32_t)seedrand;		/* let the compiler truncate */
++  iv = (uintptr_t)seedrand;		/* let the compiler truncate */
+   iv = tv.tv_sec ^ tv.tv_usec ^ getpid () ^ getppid () ^ current_user.uid ^ iv;
+   return (iv);
+ }


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2023-06-23  2:32 Sam James
  0 siblings, 0 replies; 18+ messages in thread
From: Sam James @ 2023-06-23  2:32 UTC (permalink / raw
  To: gentoo-commits

commit:     dde3a81f420e745fe884b6535796129192f02561
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Jun 17 04:46:45 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jun 23 02:31:32 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dde3a81f

app-shells/bash: backport shell parser reset fix to 5.2

Note that Ramey's claim that only interactive shells are affected is
false, as is demonstrated below.

$ bash -c '[[ ]]; echo fin'; echo $?
0

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Bug: https://savannah.gnu.org/support/?110745
Bug: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00103.html
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-shells/bash/bash-5.2_p15-r4.ebuild             | 366 +++++++++++++++++++++
 .../bash-5.2_p15-shell-parser-reset-issue.patch    |  33 ++
 2 files changed, 399 insertions(+)

diff --git a/app-shells/bash/bash-5.2_p15-r4.ebuild b/app-shells/bash/bash-5.2_p15-r4.ebuild
new file mode 100644
index 000000000000..04710a4c180f
--- /dev/null
+++ b/app-shells/bash/bash-5.2_p15-r4.ebuild
@@ -0,0 +1,366 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/chetramey.asc
+inherit flag-o-matic toolchain-funcs prefix verify-sig
+
+# Uncomment if we have a patchset
+#GENTOO_PATCH_DEV="sam"
+#GENTOO_PATCH_VER="${PV}"
+
+# Official patchlevel
+# See ftp://ftp.cwru.edu/pub/bash/bash-5.1-patches/
+PLEVEL="${PV##*_p}"
+MY_PV="${PV/_p*}"
+MY_PV="${MY_PV/_/-}"
+MY_P="${PN}-${MY_PV}"
+MY_PATCHES=()
+
+is_release() {
+	case ${PV} in
+		9999|*_alpha*|*_beta*|*_rc*)
+			return 1
+			;;
+		*)
+			return 0
+			;;
+	esac
+}
+
+[[ ${PV} != *_p* ]] && PLEVEL=0
+
+# The version of readline this bash normally ships with.
+# Note: right now, we don't use the system copy of readline for bash for non-releases.
+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"
+
+if [[ ${PV} == 9999 ]] ; then
+	EGIT_REPO_URI="https://git.savannah.gnu.org/git/bash.git"
+	EGIT_BRANCH=devel
+	inherit git-r3
+elif is_release ; then
+	SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz"
+	SRC_URI+=" verify-sig? ( mirror://gnu/bash/${MY_P}.tar.gz.sig )"
+
+	if [[ ${PLEVEL} -gt 0 ]] ; then
+		# bash-5.1 -> bash51
+		my_p=${PN}$(ver_rs 1-2 '' $(ver_cut 1-2))
+
+		patch_url=
+		my_patch_index=
+
+		upstream_url_base="mirror://gnu/bash"
+		mirror_url_base="ftp://ftp.cwru.edu/pub/bash"
+
+		for ((my_patch_index=1; my_patch_index <= ${PLEVEL} ; my_patch_index++)) ; do
+			printf -v mangled_patch_ver ${my_p}-%03d ${my_patch_index}
+			patch_url="${upstream_url_base}/${MY_P}-patches/${mangled_patch_ver}"
+
+			SRC_URI+=" ${patch_url}"
+			SRC_URI+=" verify-sig? ( ${patch_url}.sig )"
+
+			# Add in the mirror URL too.
+			SRC_URI+=" ${patch_url/${upstream_url_base}/${mirror_url_base}}"
+			SRC_URI+=" verify-sig? ( ${patch_url/${upstream_url_base}/${mirror_url_base}} )"
+
+			MY_PATCHES+=( "${DISTDIR}"/${mangled_patch_ver} )
+		done
+
+		unset my_p patch_url my_patch_index upstream_url_base mirror_url_base
+	fi
+else
+	SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
+	SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${MY_P}.tar.gz.sig ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )"
+fi
+
+if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+	SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
+fi
+
+LICENSE="GPL-3+"
+SLOT="0"
+if is_release ; then
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+fi
+IUSE="afs bashlogger examples mem-scramble +net nls plugins pgo +readline"
+
+DEPEND="
+	>=sys-libs/ncurses-5.2-r2:=
+	nls? ( virtual/libintl )
+"
+if is_release ; then
+	DEPEND+=" readline? ( >=sys-libs/readline-${READLINE_VER}:= )"
+fi
+RDEPEND="
+	${DEPEND}
+"
+# We only need yacc when the .y files get patched (bash42-005, bash51-011)
+BDEPEND="
+	app-alternatives/yacc
+	pgo? ( dev-util/gperf )
+	verify-sig? ( sec-keys/openpgp-keys-chetramey )
+"
+
+S="${WORKDIR}/${MY_P}"
+
+# EAPI 8 tries to append it but it doesn't exist here
+QA_CONFIGURE_OPTIONS="--disable-static"
+
+PATCHES=(
+	#"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}/
+
+	# Patches from Chet sent to bash-bug ml
+	"${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_p15-shell-parser-reset-issue.patch
+)
+
+pkg_setup() {
+	# bug #7332
+	if is-flag -malign-double ; then
+		eerror "Detected bad CFLAGS '-malign-double'.  Do not use this"
+		eerror "as it breaks LFS (struct stat64) on x86."
+		die "remove -malign-double from your CFLAGS mr ricer"
+	fi
+
+	if use bashlogger ; then
+		ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
+		ewarn "This will log ALL output you enter into the shell, you have been warned."
+	fi
+}
+
+src_unpack() {
+	if [[ ${PV} == 9999 ]] ; then
+		git-r3_src_unpack
+	else
+		if use verify-sig ; then
+			verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.sig}
+
+			local patch
+			for patch in "${MY_PATCHES[@]}" ; do
+				verify-sig_verify_detached ${patch}{,.sig}
+			done
+		fi
+
+		unpack ${MY_P}.tar.gz
+
+		if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+			unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
+		fi
+	fi
+}
+
+src_prepare() {
+	# Include official patches
+	[[ ${PLEVEL} -gt 0 ]] && eapply -p0 "${MY_PATCHES[@]}"
+
+	# Clean out local libs so we know we use system ones w/releases.
+	if is_release ; then
+		rm -rf lib/{readline,termcap}/* || die
+		touch lib/{readline,termcap}/Makefile.in || die # for config.status
+		sed -ri -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
+
+	# Avoid regenerating docs after patches, bug #407985
+	sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
+	touch -r . doc/* || die
+
+	# Sometimes hangs (more noticeable w/ pgo), bug #907403.
+	rm tests/run-jobs || die
+
+	eapply -p0 "${PATCHES[@]}"
+	eapply_user
+}
+
+src_configure() {
+	local myconf=(
+		--disable-profiling
+
+		# Force linking with system curses ... the bundled termcap lib
+		# sucks bad compared to ncurses.  For the most part, ncurses
+		# is here because readline needs it.  But bash itself calls
+		# ncurses in one or two small places :(.
+		--with-curses
+
+		$(use_enable mem-scramble)
+		$(use_enable net net-redirections)
+		$(use_enable readline)
+		$(use_enable readline bang-history)
+		$(use_enable readline history)
+		$(use_with afs)
+		$(use_with mem-scramble bash-malloc)
+	)
+
+	# For descriptions of these, see config-top.h
+	# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
+	append-cppflags \
+		-DDEFAULT_PATH_VALUE=\'\""${EPREFIX}"/usr/local/sbin:"${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/sbin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/bin\"\' \
+		-DSTANDARD_UTILS_PATH=\'\""${EPREFIX}"/bin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/usr/sbin\"\' \
+		-DSYS_BASHRC=\'\""${EPREFIX}"/etc/bash/bashrc\"\' \
+		-DSYS_BASH_LOGOUT=\'\""${EPREFIX}"/etc/bash/bash_logout\"\' \
+		-DNON_INTERACTIVE_LOGIN_SHELLS \
+		-DSSH_SOURCE_BASHRC \
+		$(use bashlogger && echo -DSYSLOG_HISTORY)
+
+	# Don't even think about building this statically without
+	# reading bug #7714 first.  If you still build it statically,
+	# don't come crying to us with bugs ;).
+	#use static && export LDFLAGS="${LDFLAGS} -static"
+	use nls || myconf+=( --disable-nls )
+
+	if is_release ; then
+		# Historically, we always used the builtin readline, but since
+		# our handling of SONAME upgrades has gotten much more stable
+		# in the PM (and the readline ebuild itself preserves the old
+		# libs during upgrades), linking against the system copy should
+		# be safe.
+		# Exact cached version here doesn't really matter as long as it
+		# is at least what's in the DEPEND up above.
+		export ac_cv_rl_version=${READLINE_VER%%_*}
+
+		# Use system readline only with released versions.
+		myconf+=( --with-installed-readline=. )
+	fi
+
+	if use plugins ; then
+		append-ldflags -Wl,-rpath,"${EPREFIX}"/usr/$(get_libdir)/bash
+	else
+		# Disable the plugins logic by hand since bash doesn't
+		# provide a way of doing it.
+		export ac_cv_func_dl{close,open,sym}=no \
+			ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
+
+		sed -i \
+			-e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
+			configure || die
+	fi
+
+	# bug #444070
+	tc-export AR
+
+	econf "${myconf[@]}"
+}
+
+src_compile() {
+	if use pgo ; then
+		# Build Bash and run its tests to generate profiles.
+		emake CFLAGS="${CFLAGS} -fprofile-generate=${T}/pgo -fprofile-dir=${T}/pgo"
+
+		# Used in test suite.
+		unset A
+
+		emake CFLAGS="${CFLAGS} -fprofile-generate=${T}/pgo -fprofile-dir=${T}/pgo" -k check
+
+		if tc-is-clang; then
+			llvm-profdata merge "${T}"/pgo --output="${T}"/pgo/default.profdata || die
+		fi
+
+		# Rebuild Bash using the profiling data we just generated.
+		emake clean
+		emake CFLAGS="${CFLAGS} -fprofile-use=${T}/pgo -fprofile-dir=${T}/pgo"
+
+		use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} -fprofile-use=${T}/pgo -fprofile-dir=${T}/pgo" all others
+	else
+		emake
+
+		use plugins && emake -C examples/loadables all others
+	fi
+}
+
+src_test() {
+	# Used in test suite.
+	unset A
+
+	default
+}
+
+src_install() {
+	local d f
+
+	default
+
+	dodir /bin
+	mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
+	dosym bash /bin/rbash
+
+	insinto /etc/bash
+	doins "${FILESDIR}"/bash_logout
+	doins "$(prefixify_ro "${FILESDIR}"/bashrc)"
+
+	keepdir /etc/bash/bashrc.d
+
+	insinto /etc/skel
+	for f in bash{_logout,_profile,rc} ; do
+		newins "${FILESDIR}"/dot-${f} .${f}
+	done
+
+	local sed_args=(
+		-e 's:#GNU#@::'
+		-e '/#@/d'
+	)
+
+	if ! use readline ; then
+		# bug #432338
+		sed_args+=(
+			-e '/^shopt -s histappend/s:^:#:'
+			-e 's:use_color=true:use_color=false:'
+		)
+	fi
+
+	sed -i \
+		"${sed_args[@]}" \
+		"${ED}"/etc/skel/.bashrc \
+		"${ED}"/etc/bash/bashrc || die
+
+	if use plugins ; then
+		exeinto /usr/$(get_libdir)/bash
+		doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
+
+		insinto /usr/include/bash-plugins
+		doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
+	fi
+
+	if use examples ; then
+		for d in examples/{functions,misc,scripts,startup-files} ; do
+			exeinto /usr/share/doc/${PF}/${d}
+			docinto ${d}
+			for f in ${d}/* ; do
+				if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
+					doexe ${f}
+				else
+					dodoc ${f}
+				fi
+			done
+		done
+	fi
+
+	# Install bash_builtins.1 and rbash.1
+	emake -C doc DESTDIR="${D}" install_builtins
+	sed 's:bash\.1:man1/&:' doc/rbash.1 > "${T}"/rbash.1 || die
+	doman "${T}"/rbash.1
+
+	newdoc CWRU/changelog ChangeLog
+	dosym bash.info /usr/share/info/bashref.info
+}
+
+pkg_preinst() {
+	if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
+		mkdir -p "${EROOT}"/etc/bash
+		mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
+	fi
+}
+
+pkg_postinst() {
+	# If /bin/sh does not exist, provide it
+	if [[ ! -e ${EROOT}/bin/sh ]] ; then
+		ln -sf bash "${EROOT}"/bin/sh
+	fi
+}

diff --git a/app-shells/bash/files/bash-5.2_p15-shell-parser-reset-issue.patch b/app-shells/bash/files/bash-5.2_p15-shell-parser-reset-issue.patch
new file mode 100644
index 000000000000..bef5586d0efc
--- /dev/null
+++ b/app-shells/bash/files/bash-5.2_p15-shell-parser-reset-issue.patch
@@ -0,0 +1,33 @@
+https://savannah.gnu.org/support/?110745
+https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00103.html
+
+Note that both documents make the claim that only interactive shells are
+affected. This is false, as is demonstrated below.
+
+$ bash -c '[[ ]]; echo fin'; echo $?
+0
+
+diff --git a/parse.y b/parse.y
+index 11b71d4..02b2af1 100644
+--- parse.y
++++ parse.y
+@@ -2899,7 +2899,7 @@ yylex ()
+ #if defined (YYERRCODE) && !defined (YYUNDEF)
+     current_token = YYERRCODE;
+ #else
+-    current_token = YYerror;
++    current_token = YYUNDEF;
+ #endif
+ 
+   return (current_token);
+@@ -4156,7 +4156,9 @@ parse_comsub (qc, open, close, lenp, flags)
+       shell_eof_token = ps.eof_token;
+       expand_aliases = ps.expand_aliases;
+ 
+-      /* yyparse() has already called yyerror() and reset_parser() */
++      /* yyparse() has already called yyerror() and reset_parser(), so we set
++	 PST_NOERROR to avoid a redundant error message. */
++      parser_state |= PST_NOERROR;
+       return (&matched_pair_error);
+     }
+   else if (r != 0)


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2023-02-09  4:08 Sam James
  0 siblings, 0 replies; 18+ messages in thread
From: Sam James @ 2023-02-09  4:08 UTC (permalink / raw
  To: gentoo-commits

commit:     a65512af125ca7433402246d1b6c6b62eb7d0936
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  9 04:08:13 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Feb  9 04:08:13 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a65512af

app-shells/bash: fix configure w/ clang 16

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...sh-5.2_p15-r1.ebuild => bash-5.2_p15-r2.ebuild} |  1 +
 .../files/bash-5.2_p15-configure-clang16.patch     | 37 ++++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/app-shells/bash/bash-5.2_p15-r1.ebuild b/app-shells/bash/bash-5.2_p15-r2.ebuild
similarity index 99%
rename from app-shells/bash/bash-5.2_p15-r1.ebuild
rename to app-shells/bash/bash-5.2_p15-r2.ebuild
index b0db51f7f0ce..8c7792de30c2 100644
--- a/app-shells/bash/bash-5.2_p15-r1.ebuild
+++ b/app-shells/bash/bash-5.2_p15-r2.ebuild
@@ -109,6 +109,7 @@ PATCHES=(
 	# Patches from Chet sent to bash-bug ml
 	"${FILESDIR}"/${PN}-5.0-syslog-history-extern.patch
 	"${FILESDIR}"/${PN}-5.2_p15-random-ub.patch
+	"${FILESDIR}"/${PN}-5.2_p15-configure-clang16.patch
 )
 
 pkg_setup() {

diff --git a/app-shells/bash/files/bash-5.2_p15-configure-clang16.patch b/app-shells/bash/files/bash-5.2_p15-configure-clang16.patch
new file mode 100644
index 000000000000..6005d39df59c
--- /dev/null
+++ b/app-shells/bash/files/bash-5.2_p15-configure-clang16.patch
@@ -0,0 +1,37 @@
+https://lists.gnu.org/archive/html/bug-bash/2023-02/msg00000.html)
+
+From 2cdf8b42885189b3cf7c47096b01f104e520546a Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Thu, 2 Feb 2023 05:43:37 +0000
+Subject: [PATCH] aclocal.m4: fix -Wimplicit-function-declaration in dup2 check
+
+dup2 requires a <unistd.h> include. Fixes the following when diffing config.log
+ when testing with a stricter compiler:
+```
+-warning: call to undeclared function 'dup2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
++error: call to undeclared function 'dup2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
+```
+--- aclocal.m4
++++ aclocal.m4
+@@ -238,6 +238,9 @@ AC_CACHE_VAL(bash_cv_dup2_broken,
+ #include <sys/types.h>
+ #include <fcntl.h>
+ #include <stdlib.h>
++#ifdef HAVE_UNISTD_H
++#include <unistd.h>
++#endif
+ int
+ main()
+ {
+--- configure
++++ configure
+@@ -18121,6 +18121,9 @@ else $as_nop
+ #include <sys/types.h>
+ #include <fcntl.h>
+ #include <stdlib.h>
++#ifdef HAVE_UNISTD_H
++#include <unistd.h>
++#endif
+ int
+ main()
+ {


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2022-10-08 13:25 Sam James
  0 siblings, 0 replies; 18+ messages in thread
From: Sam James @ 2022-10-08 13:25 UTC (permalink / raw
  To: gentoo-commits

commit:     47950445cddff736a1e6c0c1346a20ab6b326cc1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  8 13:24:32 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Oct  8 13:25:11 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=47950445

app-shells/bash: backport fixes for extglob in compat mode for 5.2

Bug: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00029.html
Closes: https://bugs.gentoo.org/873931
Thanks-to: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-shells/bash/bash-5.2_p2-r1.ebuild              | 345 +++++++++++++++++++++
 ...h-5.2_p2-fixes-for-extglob-in-compat-mode.patch | 320 +++++++++++++++++++
 2 files changed, 665 insertions(+)

diff --git a/app-shells/bash/bash-5.2_p2-r1.ebuild b/app-shells/bash/bash-5.2_p2-r1.ebuild
new file mode 100644
index 000000000000..e40e4b39547a
--- /dev/null
+++ b/app-shells/bash/bash-5.2_p2-r1.ebuild
@@ -0,0 +1,345 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/chetramey.asc
+inherit flag-o-matic toolchain-funcs prefix verify-sig
+
+# Uncomment if we have a patchset
+#GENTOO_PATCH_DEV="sam"
+#GENTOO_PATCH_VER="${PV}"
+
+# Official patchlevel
+# See ftp://ftp.cwru.edu/pub/bash/bash-5.1-patches/
+PLEVEL="${PV##*_p}"
+MY_PV="${PV/_p*}"
+MY_PV="${MY_PV/_/-}"
+MY_P="${PN}-${MY_PV}"
+MY_PATCHES=()
+
+is_release() {
+	case ${PV} in
+		9999|*_alpha*|*_beta*|*_rc*)
+			return 1
+			;;
+		*)
+			return 0
+			;;
+	esac
+}
+
+[[ ${PV} != *_p* ]] && PLEVEL=0
+
+# The version of readline this bash normally ships with.
+# Note: right now, we don't use the system copy of readline for bash for non-releases.
+READLINE_VER="8.2"
+
+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"
+
+if [[ ${PV} == 9999 ]] ; then
+	EGIT_REPO_URI="https://git.savannah.gnu.org/git/bash.git"
+	EGIT_BRANCH=devel
+	inherit git-r3
+elif is_release ; then
+	SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz"
+	SRC_URI+=" verify-sig? ( mirror://gnu/bash/${MY_P}.tar.gz.sig )"
+
+	if [[ ${PLEVEL} -gt 0 ]] ; then
+		# bash-5.1 -> bash51
+		my_p=${PN}$(ver_rs 1-2 '' $(ver_cut 1-2))
+
+		patch_url=
+		my_patch_index=
+
+		for ((my_patch_index=1; my_patch_index <= ${PLEVEL} ; my_patch_index++)) ; do
+			for url in mirror://gnu/${pn} ftp://ftp.cwru.edu/pub/bash ; do
+				patch_url=$(printf "${url}/${PN}-$(ver_cut 1-2)-patches/${my_p}-%03d" ${my_patch_index})
+				SRC_URI+=" ${patch_url}"
+				SRC_URI+=" verify-sig? ( ${patch_url}.sig )"
+			done
+
+			MY_PATCHES+=( "${DISTDIR}"/$(printf ${my_p}-%03d ${my_patch_index}) )
+		done
+
+		unset my_pn patch_url my_patch_index
+	fi
+else
+	SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
+	SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${MY_P}.tar.gz.sig ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )"
+fi
+
+if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+	SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
+fi
+
+LICENSE="GPL-3+"
+SLOT="0"
+if is_release ; then
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+IUSE="afs bashlogger examples mem-scramble +net nls plugins pgo +readline"
+
+DEPEND="
+	>=sys-libs/ncurses-5.2-r2:=
+	nls? ( virtual/libintl )
+"
+if is_release ; then
+	DEPEND+=" readline? ( >=sys-libs/readline-${READLINE_VER}:= )"
+fi
+RDEPEND="
+	${DEPEND}
+"
+# We only need yacc when the .y files get patched (bash42-005, bash51-011)
+BDEPEND="
+	virtual/yacc
+	pgo? ( dev-util/gperf )
+	verify-sig? ( sec-keys/openpgp-keys-chetramey )
+"
+
+S="${WORKDIR}/${MY_P}"
+
+# EAPI 8 tries to append it but it doesn't exist here
+QA_CONFIGURE_OPTIONS="--disable-static"
+
+PATCHES=(
+	#"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}/
+
+	# Patches from Chet sent to bash-bug ml
+	"${FILESDIR}"/${PN}-5.0-syslog-history-extern.patch
+	"${FILESDIR}"/${PN}-5.2_p2-fixes-for-extglob-in-compat-mode.patch
+)
+
+pkg_setup() {
+	# bug #7332
+	if is-flag -malign-double ; then
+		eerror "Detected bad CFLAGS '-malign-double'.  Do not use this"
+		eerror "as it breaks LFS (struct stat64) on x86."
+		die "remove -malign-double from your CFLAGS mr ricer"
+	fi
+
+	if use bashlogger ; then
+		ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
+		ewarn "This will log ALL output you enter into the shell, you have been warned."
+	fi
+}
+
+src_unpack() {
+	if [[ ${PV} == 9999 ]] ; then
+		git-r3_src_unpack
+	else
+		if use verify-sig ; then
+			verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.sig}
+		fi
+
+		unpack ${MY_P}.tar.gz
+
+		if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+			unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
+		fi
+	fi
+}
+
+src_prepare() {
+	# Include official patches
+	[[ ${PLEVEL} -gt 0 ]] && eapply -p0 "${MY_PATCHES[@]}"
+
+	# Clean out local libs so we know we use system ones w/releases.
+	if is_release ; then
+		rm -rf lib/{readline,termcap}/* || die
+		touch lib/{readline,termcap}/Makefile.in || die # for config.status
+		sed -ri -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
+
+	# Avoid regenerating docs after patches, bug #407985
+	sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
+	touch -r . doc/* || die
+
+	eapply -p0 "${PATCHES[@]}"
+	eapply_user
+}
+
+src_configure() {
+	local myconf=(
+		--disable-profiling
+
+		# Force linking with system curses ... the bundled termcap lib
+		# sucks bad compared to ncurses.  For the most part, ncurses
+		# is here because readline needs it.  But bash itself calls
+		# ncurses in one or two small places :(.
+		--with-curses
+
+		$(use_enable mem-scramble)
+		$(use_enable net net-redirections)
+		$(use_enable readline)
+		$(use_enable readline bang-history)
+		$(use_enable readline history)
+		$(use_with afs)
+		$(use_with mem-scramble bash-malloc)
+	)
+
+	# For descriptions of these, see config-top.h
+	# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
+	append-cppflags \
+		-DDEFAULT_PATH_VALUE=\'\"${EPREFIX}/usr/local/sbin:${EPREFIX}/usr/local/bin:${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin\"\' \
+		-DSTANDARD_UTILS_PATH=\'\"${EPREFIX}/bin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/usr/sbin\"\' \
+		-DSYS_BASHRC=\'\"${EPREFIX}/etc/bash/bashrc\"\' \
+		-DSYS_BASH_LOGOUT=\'\"${EPREFIX}/etc/bash/bash_logout\"\' \
+		-DNON_INTERACTIVE_LOGIN_SHELLS \
+		-DSSH_SOURCE_BASHRC \
+		$(use bashlogger && echo -DSYSLOG_HISTORY)
+
+	# Don't even think about building this statically without
+	# reading bug #7714 first.  If you still build it statically,
+	# don't come crying to us with bugs ;).
+	#use static && export LDFLAGS="${LDFLAGS} -static"
+	use nls || myconf+=( --disable-nls )
+
+	if is_release ; then
+		# Historically, we always used the builtin readline, but since
+		# our handling of SONAME upgrades has gotten much more stable
+		# in the PM (and the readline ebuild itself preserves the old
+		# libs during upgrades), linking against the system copy should
+		# be safe.
+		# Exact cached version here doesn't really matter as long as it
+		# is at least what's in the DEPEND up above.
+		export ac_cv_rl_version=${READLINE_VER%%_*}
+
+		# Use system readline only with released versions.
+		myconf+=( --with-installed-readline=. )
+	fi
+
+	if use plugins ; then
+		append-ldflags -Wl,-rpath,"${EPREFIX}"/usr/$(get_libdir)/bash
+	else
+		# Disable the plugins logic by hand since bash doesn't
+		# provide a way of doing it.
+		export ac_cv_func_dl{close,open,sym}=no \
+			ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
+
+		sed -i \
+			-e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
+			configure || die
+	fi
+
+	# bug #444070
+	tc-export AR
+
+	econf "${myconf[@]}"
+}
+
+src_compile() {
+	if use pgo ; then
+		# Build Bash and run its tests to generate profiles.
+		emake CFLAGS="${CFLAGS} -fprofile-generate=${T}/pgo -fprofile-dir=${T}/pgo"
+
+		# Used in test suite.
+		unset A
+
+		emake CFLAGS="${CFLAGS} -fprofile-generate=${T}/pgo -fprofile-dir=${T}/pgo" -k check
+
+		# Rebuild Bash using the profiling data we just generated.
+		emake clean
+		emake CFLAGS="${CFLAGS} -fprofile-use=${T}/pgo -fprofile-dir=${T}/pgo"
+
+		use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} -fprofile-use=${T}/pgo -fprofile-dir=${T}/pgo" all others
+	else
+		emake
+
+		use plugins && emake -C examples/loadables all others
+	fi
+}
+
+src_test() {
+	# Used in test suite.
+	unset A
+
+	default
+}
+
+src_install() {
+	local d f
+
+	default
+
+	dodir /bin
+	mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
+	dosym bash /bin/rbash
+
+	insinto /etc/bash
+	doins "${FILESDIR}"/bash_logout
+	doins "$(prefixify_ro "${FILESDIR}"/bashrc)"
+
+	keepdir /etc/bash/bashrc.d
+
+	insinto /etc/skel
+	for f in bash{_logout,_profile,rc} ; do
+		newins "${FILESDIR}"/dot-${f} .${f}
+	done
+
+	local sed_args=(
+		-e "s:#${USERLAND}#@::"
+		-e '/#@/d'
+	)
+
+	if ! use readline ; then
+		# bug #432338
+		sed_args+=(
+			-e '/^shopt -s histappend/s:^:#:'
+			-e 's:use_color=true:use_color=false:'
+		)
+	fi
+
+	sed -i \
+		"${sed_args[@]}" \
+		"${ED}"/etc/skel/.bashrc \
+		"${ED}"/etc/bash/bashrc || die
+
+	if use plugins ; then
+		exeinto /usr/$(get_libdir)/bash
+		doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
+
+		insinto /usr/include/bash-plugins
+		doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
+	fi
+
+	if use examples ; then
+		for d in examples/{functions,misc,scripts,startup-files} ; do
+			exeinto /usr/share/doc/${PF}/${d}
+			docinto ${d}
+			for f in ${d}/* ; do
+				if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
+					doexe ${f}
+				else
+					dodoc ${f}
+				fi
+			done
+		done
+	fi
+
+	# Install bash_builtins.1 and rbash.1
+	emake -C doc DESTDIR="${D}" install_builtins
+	sed 's:bash\.1:man1/&:' doc/rbash.1 > "${T}"/rbash.1 || die
+	doman "${T}"/rbash.1
+
+	newdoc CWRU/changelog ChangeLog
+	dosym bash.info /usr/share/info/bashref.info
+}
+
+pkg_preinst() {
+	if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
+		mkdir -p "${EROOT}"/etc/bash
+		mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
+	fi
+}
+
+pkg_postinst() {
+	# If /bin/sh does not exist, provide it
+	if [[ ! -e ${EROOT}/bin/sh ]] ; then
+		ln -sf bash "${EROOT}"/bin/sh
+	fi
+}

diff --git a/app-shells/bash/files/bash-5.2_p2-fixes-for-extglob-in-compat-mode.patch b/app-shells/bash/files/bash-5.2_p2-fixes-for-extglob-in-compat-mode.patch
new file mode 100644
index 000000000000..06415b5cdaa4
--- /dev/null
+++ b/app-shells/bash/files/bash-5.2_p2-fixes-for-extglob-in-compat-mode.patch
@@ -0,0 +1,320 @@
+https://bugs.gentoo.org/873931
+https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00001.html
+https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=22f21b760ed90eb77c3756e6ccf39b73c84f532a
+
+--- MANIFEST
++++ MANIFEST
+@@ -1131,6 +1131,7 @@ tests/extglob4.sub	f
+ tests/extglob5.sub	f
+ tests/extglob6.sub	f
+ tests/extglob7.sub	f
++tests/extglob8.sub	f
+ tests/func.tests	f
+ tests/func.right	f
+ tests/func1.sub		f
+--- builtins/common.h
++++ builtins/common.h
+@@ -257,6 +257,10 @@ extern int print_shift_error;
+ extern int expand_once_flag;
+ #endif
+ 
++#if defined (EXTENDED_GLOB)
++extern int extglob_flag;
++#endif
++
+ /* variables from source.def */
+ extern int source_searches_cwd;
+ extern int source_uses_path;
+--- builtins/shopt.def
++++ builtins/shopt.def
+@@ -1,7 +1,7 @@
+ This file is shopt.def, from which is created shopt.c.
+ It implements the Bash `shopt' builtin.
+ 
+-Copyright (C) 1994-2021 Free Software Foundation, Inc.
++Copyright (C) 1994-2022 Free Software Foundation, Inc.
+ 
+ This file is part of GNU Bash, the Bourne Again SHell.
+ 
+@@ -149,6 +149,11 @@ static int shopt_set_complete_direxpand PARAMS((char *, int));
+ static int set_assoc_expand PARAMS((char *, int));
+ #endif
+ 
++#if defined (EXTENDED_GLOB)
++int extglob_flag = EXTGLOB_DEFAULT;
++static int shopt_set_extglob PARAMS((char *, int));
++#endif
++
+ static int shopt_set_debug_mode PARAMS((char *, int));
+ 
+ static int shopt_login_shell;
+@@ -203,7 +208,7 @@ static struct {
+   { "extdebug", &debugging_mode, shopt_set_debug_mode },
+ #endif
+ #if defined (EXTENDED_GLOB)
+-  { "extglob", &extended_glob, (shopt_set_func_t *)NULL },
++  { "extglob", &extglob_flag, shopt_set_extglob },
+ #endif
+   { "extquote", &extended_quote, (shopt_set_func_t *)NULL },
+   { "failglob", &fail_glob_expansion, (shopt_set_func_t *)NULL },
+@@ -374,7 +379,7 @@ reset_shopt_options ()
+ #endif
+ 
+ #if defined (EXTENDED_GLOB)
+-  extended_glob = EXTGLOB_DEFAULT;
++  extended_glob = extglob_flag = EXTGLOB_DEFAULT;
+ #endif
+ 
+ #if defined (ARRAY_VARS)
+@@ -631,11 +636,24 @@ shopt_set_debug_mode (option_name, mode)
+   return (0);
+ }
+ 
++#if defined (EXTENDED_GLOB)
++static int
++shopt_set_extglob (option_name, mode)
++     char *option_name;
++     int mode;
++{
++  extended_glob = extglob_flag;
++  return 0;
++}
++#endif
++
+ #if defined (READLINE)
+ static int
+ shopt_enable_hostname_completion (option_name, mode)
+      char *option_name;
+      int mode;
++
++
+ {
+   return (enable_hostname_completion (mode));
+ }
+--- execute_cmd.c
++++ execute_cmd.c
+@@ -3990,13 +3990,11 @@ execute_cond_node (cond)
+       else
+ #endif /* COND_REGEXP */
+ 	{
+-	  int oe;
+-	  oe = extended_glob;
+ 	  extended_glob = 1;
+ 	  result = binary_test (cond->op->word, arg1, arg2, TEST_PATMATCH|TEST_ARITHEXP|TEST_LOCALE)
+ 				  ? EXECUTION_SUCCESS
+ 				  : EXECUTION_FAILURE;
+-	  extended_glob = oe;
++	  extended_glob = extglob_flag;
+ 	}
+       if (arg1 != nullstr)
+ 	free (arg1);
+--- parse.y
++++ parse.y
+@@ -125,7 +125,7 @@ do { \
+ } while (0)
+ 
+ #if defined (EXTENDED_GLOB)
+-extern int extended_glob;
++extern int extended_glob, extglob_flag;
+ #endif
+ 
+ #if defined (TRANSLATABLE_STRINGS)
+@@ -312,8 +312,6 @@ static int token_before_that;
+ /* The token read prior to token_before_that. */
+ static int two_tokens_ago;
+ 
+-static int global_extglob;
+-
+ /* The line number in a script where the word in a `case WORD', `select WORD'
+    or `for WORD' begins.  This is a nested command maximum, since the array
+    index is decremented after a case, select, or for command is parsed. */
+@@ -3304,7 +3302,7 @@ reset_parser ()
+ #if defined (EXTENDED_GLOB)
+   /* Reset to global value of extended glob */
+   if (parser_state & (PST_EXTPAT|PST_CMDSUBST))
+-    extended_glob = global_extglob;
++    extended_glob = extglob_flag;
+ #endif
+ 
+   parser_state = 0;
+@@ -4118,10 +4116,10 @@ parse_comsub (qc, open, close, lenp, flags)
+     expand_aliases = posixly_correct != 0;
+ #if defined (EXTENDED_GLOB)
+   /* If (parser_state & PST_EXTPAT), we're parsing an extended pattern for a
+-     conditional command and have already set global_extglob appropriately. */
++     conditional command and have already set extended_glob appropriately. */
+   if (shell_compatibility_level <= 51 && was_extpat == 0)
+     {
+-      local_extglob = global_extglob = extended_glob;
++      local_extglob = extended_glob;
+       extended_glob = 1;
+     }
+ #endif
+@@ -4229,7 +4227,7 @@ xparse_dolparen (base, string, indp, flags)
+ {
+   sh_parser_state_t ps;
+   sh_input_line_state_t ls;
+-  int orig_ind, nc, sflags, start_lineno;
++  int orig_ind, nc, sflags, start_lineno, local_extglob;
+   char *ret, *ep, *ostring;
+ 
+ /*debug_parser(1);*/
+@@ -4272,7 +4270,7 @@ xparse_dolparen (base, string, indp, flags)
+      old value will be restored by restore_parser_state(). */
+   expand_aliases = 0;
+ #if defined (EXTENDED_GLOB)
+-  global_extglob = extended_glob;		/* for reset_parser() */
++  local_extglob = extended_glob;
+ #endif
+ 
+   token_to_read = DOLPAREN;			/* let's trick the parser */
+@@ -4290,6 +4288,9 @@ xparse_dolparen (base, string, indp, flags)
+   restore_input_line_state (&ls);
+   restore_parser_state (&ps);
+ 
++#if defined (EXTENDED_GLOB)
++  extended_glob = local_extglob;
++#endif
+   token_to_read = 0;
+ 
+   /* If parse_string returns < 0, we need to jump to top level with the
+@@ -4724,12 +4725,16 @@ cond_term ()
+ 	}
+ 
+       /* rhs */
++#if defined (EXTENDED_GLOB)
+       local_extglob = extended_glob;
+       if (parser_state & PST_EXTPAT)
+ 	extended_glob = 1;
++#endif
+       tok = read_token (READ);
++#if defined (EXTENDED_GLOB)
+       if (parser_state & PST_EXTPAT)
+ 	extended_glob = local_extglob;
++#endif
+       parser_state &= ~(PST_REGEXP|PST_EXTPAT);
+ 
+       if (tok == WORD)
+@@ -4776,7 +4781,6 @@ parse_cond_command ()
+ {
+   COND_COM *cexp;
+ 
+-  global_extglob = extended_glob;
+   cexp = cond_expr ();
+   return (make_cond_command (cexp));
+ }
+--- patchlevel.h
++++ patchlevel.h
+@@ -1,6 +1,6 @@
+ /* patchlevel.h -- current bash patch level */
+ 
+-/* Copyright (C) 2001-2021 Free Software Foundation, Inc.
++/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
+ 
+    This file is part of GNU Bash, the Bourne Again SHell.
+ 
+--- subst.c
++++ subst.c
+@@ -1798,6 +1798,9 @@ extract_heredoc_dolbrace_string (string, sindex, quoted, flags)
+   return (result);
+ }
+ 
++#define PARAMEXPNEST_MAX	32	// for now
++static int dbstate[PARAMEXPNEST_MAX];
++
+ /* Extract a parameter expansion expression within ${ and } from STRING.
+    Obey the Posix.2 rules for finding the ending `}': count braces while
+    skipping over enclosed quoted strings and command substitutions.
+@@ -1828,6 +1831,8 @@ extract_dollar_brace_string (string, sindex, quoted, flags)
+   if (quoted == Q_HERE_DOCUMENT && dolbrace_state == DOLBRACE_QUOTE && (flags & SX_NOALLOC) == 0)
+     return (extract_heredoc_dolbrace_string (string, sindex, quoted, flags));
+ 
++  dbstate[0] = dolbrace_state;
++
+   pass_character = 0;
+   nesting_level = 1;
+   slen = strlen (string + *sindex) + *sindex;
+@@ -1852,6 +1857,8 @@ extract_dollar_brace_string (string, sindex, quoted, flags)
+ 
+       if (string[i] == '$' && string[i+1] == LBRACE)
+ 	{
++	  if (nesting_level < PARAMEXPNEST_MAX)
++	    dbstate[nesting_level] = dolbrace_state;
+ 	  nesting_level++;
+ 	  i += 2;
+ 	  if (dolbrace_state == DOLBRACE_QUOTE || dolbrace_state == DOLBRACE_WORD)
+@@ -1864,6 +1871,7 @@ extract_dollar_brace_string (string, sindex, quoted, flags)
+ 	  nesting_level--;
+ 	  if (nesting_level == 0)
+ 	    break;
++	  dolbrace_state = (nesting_level < PARAMEXPNEST_MAX) ? dbstate[nesting_level] : dbstate[0];	/* Guess using initial state */
+ 	  i++;
+ 	  continue;
+ 	}
+--- tests/extglob.right
++++ tests/extglob.right
+@@ -182,3 +182,10 @@ no dotglob: .a .foo bar
+ ? . .. .a .foo
+ *
+ bar
++extglob        	off
++x
++extglob        	off
++extglob        	off
++extglob        	off
++extglob        	off
++extglob        	off
+--- tests/extglob.tests
++++ tests/extglob.tests
+@@ -386,5 +386,6 @@ ${THIS_SH} ./extglob4.sub
+ ${THIS_SH} ./extglob5.sub
+ ${THIS_SH} ./extglob6.sub
+ ${THIS_SH} ./extglob7.sub
++${THIS_SH} ./extglob8.sub
+ 
+ exit 0
+--- /dev/null
++++ tests/extglob8.sub
+@@ -0,0 +1,33 @@
++#   This program is free software: you can redistribute it and/or modify
++#   it under the terms of the GNU General Public License as published by
++#   the Free Software Foundation, either version 3 of the License, or
++#   (at your option) any later version.
++#
++#   This program is distributed in the hope that it will be useful,
++#   but WITHOUT ANY WARRANTY; without even the implied warranty of
++#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++#   GNU General Public License for more details.
++#
++#   You should have received a copy of the GNU General Public License
++#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
++#
++# extglob option interaction with other parts of the shell that force
++# extended_glob on; only an issue in compatibility mode
++
++shopt -u extglob
++
++BASH_COMPAT=50
++shopt extglob
++
++echo $(echo $(echo $(echo $(echo $(echo x) ) ) ) )
++shopt extglob
++
++shopt -u extglob
++
++[[ '' = $(shopt extglob >&2) ]]
++shopt extglob
++
++shopt -u extglob
++
++[[ foo = $(: $(shopt extglob >&2)) ]]
++shopt extglob
+--- tests/run-extglob
++++ tests/run-extglob
+@@ -1,4 +1,4 @@
+ PATH=$PATH:`pwd`
+ export PATH
+-${THIS_SH} ./extglob.tests | grep -v '^expect' > ${BASH_TSTOUT}
++${THIS_SH} ./extglob.tests 2>&1 | grep -v '^expect' > ${BASH_TSTOUT}
+ diff ${BASH_TSTOUT} extglob.right && rm -f ${BASH_TSTOUT}
+


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2022-06-13 19:38 Sam James
  0 siblings, 0 replies; 18+ messages in thread
From: Sam James @ 2022-06-13 19:38 UTC (permalink / raw
  To: gentoo-commits

commit:     39a5d033d59067ce95cf212358e2ed7a03a2a94b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  7 11:02:21 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 13 19:38:10 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=39a5d033

app-shells/bash: switch to patch tarballs

Was taking up 129K in files/ before.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-shells/bash/Manifest                           |  11 +
 app-shells/bash/bash-2.05b_p13.ebuild              |  30 ++-
 app-shells/bash/bash-3.0_p22.ebuild                |  34 ++-
 app-shells/bash/bash-3.1_p23.ebuild                |  30 ++-
 app-shells/bash/bash-3.2_p57.ebuild                |  34 ++-
 app-shells/bash/bash-4.0_p44.ebuild                |  28 +-
 app-shells/bash/bash-4.1_p17.ebuild                |  18 +-
 app-shells/bash/bash-4.2_p53.ebuild                |  22 +-
 app-shells/bash/bash-4.3_p48-r2.ebuild             |  20 +-
 app-shells/bash/bash-4.4_p23-r2.ebuild             |  16 +-
 app-shells/bash/bash-5.0_p18.ebuild                |  16 +-
 app-shells/bash/bash-5.1_p16.ebuild                |  24 +-
 app-shells/bash/bash-5.2_beta.ebuild               |  19 +-
 app-shells/bash/bash-9999.ebuild                   |  19 +-
 app-shells/bash/files/autoconf-mktime-2.53.patch   | 199 ---------------
 app-shells/bash/files/autoconf-mktime-2.59.patch   | 197 ---------------
 app-shells/bash/files/bash-2.05b-destdir.patch     |  28 --
 .../bash/files/bash-2.05b-empty-herestring.patch   |  25 --
 .../bash/files/bash-2.05b-fix-job-warning.patch    |  14 -
 app-shells/bash/files/bash-2.05b-jobs.patch        |  28 --
 .../bash/files/bash-2.05b-parallel-build.patch     |  15 --
 app-shells/bash/files/bash-2.05b-protos.patch      |  25 --
 app-shells/bash/files/bash-2.05b-rbash.patch       |  27 --
 app-shells/bash/files/bash-3.0-afs.patch           |  20 --
 app-shells/bash/files/bash-3.0-crash.patch         |  46 ----
 app-shells/bash/files/bash-3.0-darwin-conn.patch   |  20 --
 .../bash/files/bash-3.0-histtimeformat.patch       |  56 ----
 app-shells/bash/files/bash-3.0-jobs.patch          |  56 ----
 app-shells/bash/files/bash-3.0-locale.patch        | 112 --------
 app-shells/bash/files/bash-3.0-manpage.patch       |  15 --
 app-shells/bash/files/bash-3.0-multibyteifs.patch  | 281 ---------------------
 app-shells/bash/files/bash-3.0-pgrp-pipe-fix.patch |  20 --
 app-shells/bash/files/bash-3.0-protos.patch        |  68 -----
 app-shells/bash/files/bash-3.0-pwd.patch           |  16 --
 app-shells/bash/files/bash-3.0-rbash.patch         |  18 --
 .../bash/files/bash-3.0-read-builtin-pipe.patch    |  20 --
 app-shells/bash/files/bash-3.0-read-memleak.patch  |  15 --
 app-shells/bash/files/bash-3.0-strnlen.patch       | 175 -------------
 app-shells/bash/files/bash-3.0-subshell.patch      |  39 ---
 .../bash/files/bash-3.0-trap-fg-signals.patch      |  23 --
 app-shells/bash/files/bash-3.0-ulimit.patch        | 186 --------------
 .../bash/files/bash-3.0-volatile-command.patch     |  16 --
 .../files/bash-3.1-dev-fd-buffer-overflow.patch    |  16 --
 .../bash/files/bash-3.1-dev-fd-test-as-user.patch  |  14 -
 .../bash/files/bash-3.1-fix-dash-login-shell.patch |  52 ----
 app-shells/bash/files/bash-3.1-protos.patch        |  67 -----
 app-shells/bash/files/bash-3.1-ulimit.patch        | 122 ---------
 .../bash/files/bash-3.2-dev-fd-test-as-user.patch  |  26 --
 .../bash/files/bash-3.2-ldflags-for-build.patch    |  37 ---
 app-shells/bash/files/bash-3.2-loadables.patch     | 239 ------------------
 app-shells/bash/files/bash-3.2-process-subst.patch |  12 -
 app-shells/bash/files/bash-3.2-protos.patch        |  57 -----
 .../bash/files/bash-3.2-session-leader.patch       |  65 -----
 app-shells/bash/files/bash-3.2-ulimit.patch        |  13 -
 app-shells/bash/files/bash-4.0-configure.patch     |  25 --
 .../bash/files/bash-4.0-ldflags-for-build.patch    |  15 --
 .../bash/files/bash-4.0-negative-return.patch      |  33 ---
 .../bash/files/bash-4.0-parallel-build.patch       |  65 -----
 app-shells/bash/files/bash-4.1-fbsd-eaccess.patch  |  29 ---
 .../bash/files/bash-4.1-parallel-build.patch       |  23 --
 .../files/bash-4.2-dev-fd-buffer-overflow.patch    |  46 ----
 .../bash/files/bash-4.2-execute-job-control.patch  |  24 --
 app-shells/bash/files/bash-4.2-no-readline.patch   |  19 --
 .../bash/files/bash-4.2-parallel-build.patch       | 106 --------
 app-shells/bash/files/bash-4.2-read-retry.patch    |  41 ---
 .../bash/files/bash-4.2-speed-up-read-N.patch      | 112 --------
 app-shells/bash/files/bash-4.3-arrayfunc.patch     |  15 --
 ....3-mapfile-improper-array-name-validation.patch |  13 -
 app-shells/bash/files/bash-4.3-protos.patch        |  10 -
 app-shells/bash/files/bash-4.4-jobs_overflow.patch |  14 -
 .../bash/files/bash-4.4-popd-offset-overflow.patch |  30 ---
 .../bash/files/bash-4.4-set-SHOBJ_STATUS.patch     |  14 -
 .../bash/files/bash-4.x-deferred-heredocs.patch    |  47 ----
 .../bash/files/bash-5.0-history-append.patch       |  34 ---
 74 files changed, 252 insertions(+), 3264 deletions(-)

diff --git a/app-shells/bash/Manifest b/app-shells/bash/Manifest
index f85c9cc6f7f4..36f166d3c882 100644
--- a/app-shells/bash/Manifest
+++ b/app-shells/bash/Manifest
@@ -1,15 +1,26 @@
 DIST bash-2.05b.tar.gz 1956216 BLAKE2B 15962417d13c6eec0db0861b601c33a6b13dc38d41672258f8f9fb8968a000ca1df7d5d3c99bbcb023e0b6b3e703d6c250291ac68ab3f24159eec7c2f0105b43 SHA512 595f84cfd38b239ff37f2c6fc22c669f8e1d4fea34400e30c4079ab657d05f735ee6b0e6af0db6c1b17dbf9cecec81805b467b4dbd45cc97044bfefac731aad6
+DIST bash-2.05b_p13-patches.tar.xz 4152 BLAKE2B 0f3d25f9b3a5df36a2da32b9cfc16d23901fd3b63578863903ff01530b9c524338d5cadd0ebe7d4fb79f7ac57945d77a3432578d7c2702a49f650d5774772453 SHA512 ef040ed2f53bae49cd84615adb513031a4dcbccef1af0669c2464ee7e3bd87615cd250d12342483fc895b0e8e6120bbc3b5c28b0d9b94cd3c6fe48d6c510d1f1
 DIST bash-3.0.tar.gz 2418293 BLAKE2B 7013cf7020e61987610933df55b1cf34036a2912c1844e87895535e7e77b28e2526b2a336365bd15cd2d528d9769783ff34c120c2d6932d8708e0b029ff68715 SHA512 2b56dc0531e908811e1cced23067d82505d57a3cf4651125a6e424649bc98f476366579306e03242388f0f5b17d2a09badc15b8358f70cde6f64c60b94015c9b
+DIST bash-3.0_p22-patches.tar.xz 13564 BLAKE2B b7107ffb3f9c592950f10369ea6c00f40e67eacbd42a23821a3db71f7326fba016a6b3e868cbe6f61fc00204a5ea02be27fa699aa3776afaa4b0aff5ba1f2f00 SHA512 146ab52e716cdb5c0896cf95b423662ed39acab5a0c34530cc1f9b3084dd68af8df52e9c69a7b206aa57b67911bdf138f2d46441b9cc1e533b028dfeceaa233c
 DIST bash-3.1.tar.gz 2533934 BLAKE2B 5cef5bb8a1b36688d578967e97bf19452f79f68012e4c720baceaf31cf1cd03d1dac0962d2b663a3b83bbea71b131ea54e15769fd22575ef1e610fd97efed615 SHA512 3b5d5f0de83d71c972e75267ab8f6b05a7e144acb39a7c6e14be7b4bcb9b67faeaf9a123fceebd957befa1222db05b9b539f524032d89eb1fb5936d9846c1c7e
+DIST bash-3.1_p23-patches.tar.xz 5792 BLAKE2B 239cd54b576101745f1d054b0de9bb7f8071329a99c46a04d35f1022cd0a8bfc86b871bb31637d924d8822f23de63922572966af548b6f76191490180592dd9e SHA512 26ac839cd00b19ccf4e170faf0ac044d31158d77c6cc00654cd92a6a4312eb5ded652fd2f3347d997dd1dc13916b1d5471ce2bcc6d1af5af21ccab25498febc4
 DIST bash-3.2.tar.gz 2529838 BLAKE2B 1e145f31231b0e5b0a2bbf2046e14df9718552856c01dc9699d75596b353ac0c8ac1d3bcfe4e0bd1a38aade6e775499f967925f74efe39f84611ac2b562ab47e SHA512 cc88b1a4dab9f752cf6a22153e40b8590f6d3408217730bb28f5eb431cbb5577c4d3befe8bd44669b8fa64433f299e0dd23511fd1ed8a820020e2f7f4a461758
+DIST bash-3.2_p57-patches.tar.xz 6060 BLAKE2B b6ed8271c8bd8dc765b1ca431ab524734f3a8486cacc54f7d1402a568f4dfe2569dad226bdecfad4aabdacb77491a9679070afaf9c80fa40bc44fd1e4d5c2f17 SHA512 aaec0d98cea6fbe8a34ea430d289314fa4db98c284eefa6dbb787da6061d13ed0b89ce982c0147fa7bd2e8935fd955f106a86c2ddb38476a9b8379404394e42b
 DIST bash-4.0.tar.gz 6230779 BLAKE2B 747614b0e7aa5aafec25850863e228837ac941a3285ec01e8adafde63ebb98c9211d1a8ae0782bc700340559a9884014c84c5ed2867cf40027886dd91de001bc SHA512 dccd099d11d649b26d5b5c2ab5fb8f33915631e1d86fba519a0464f2bd3a3289655e956cf161a0dc3671b8be193b6b065bede8a407d98af3012dd4b824711255
+DIST bash-4.0_p44-patches.tar.xz 3036 BLAKE2B 2dbff6f391b0b6a239b693578812541004de81c841d32eb6e4d7dbb2ab436a9d4052de4e44ec753fa669090fc1c4420bc2607839c533b7a7477c91cc7c5ace35 SHA512 d81a8d625e1522195c80ffa010b8862fe304f470187e1a12be673fd04cfd22d3605a30fb53b718817c07404e793c1738a5dcb94902566304c28a5f8eb679c395
 DIST bash-4.1.tar.gz 6598300 BLAKE2B 8ed70736071f7d946b939247dd43214059c7d545d99e4c7ec3388da263eb4f3faeeef939884ac8a489ded71fbfbaee15bb1cc6e29f3397f6e2c0d1e1d7097cda SHA512 2f2a053d98be9a31cd089e1293e3369ad05406f6543d1d1662d8b5807fdcfebc1dda79db9bf2c596a6351ea463fb9bd9c8943c1d45da9b82f2fd3bab0b8a581a
+DIST bash-4.1_p17-patches.tar.xz 1604 BLAKE2B 95dee794fd9890a47f5571a5921bb7abf0708da522a21bc7ee14a75461c0a618cfd54d86f3e210580395aa10c53e9435728a6bda97c58970108ba5414d93ba38 SHA512 1a31b8a0423fafd6449fbfd8d4eb11877e8016f0fb8eb53c48a821791bfe1f7755d9a9999b08cdced39afdfcd3b2058b91a555a31ff4aeae472fc076bd93120f
 DIST bash-4.2.tar.gz 7009201 BLAKE2B 52a4432ae401121ff187487a75a6541ce001c24d7d2251c3f0e33a58e93ff0c11b4c988003c6c740c13a51df0d752565023b8c39e79c96de52c73b49cc180523 SHA512 fdd3c230f4f7a687d36db1b8f7baab5e553cf55756e2d49a88ffaa4260c8cb949897dec9f48655e96608ef0093ac101b60c132060f06c711c0ab81aa3f148b5c
+DIST bash-4.2_p53-patches.tar.xz 4112 BLAKE2B bff4d8db9af567c0e5966f45941dee99562674c462670ee8339e8de4a68f5a2e4c4ace9dd7929c39df8dd24382cf99a750745612dac3b11e7dde8e4e321b9f32 SHA512 83f0fbf4943aa285c1c241854e6952669d078b17015c02c37e43e3f1b92b6f2bd9aa20c72ff6f4322089051035e81943885c22a059f2db63edb5c60970a65d12
 DIST bash-4.3.tar.gz 7955839 BLAKE2B 398461e90a1ab6fd726b1a9db41c4c2a1e184034e3b96029bd17097338f1f9869d1c2216bde0b5b3c8e561629824348a0da3045cc425914e8e024180a175efe4 SHA512 a852b8e46ee55568dce9d23a30a9dbd1c770c2d2a4bc91e1c3177d723b31b32c5d69d19704a93f165891b409b9dd2cc65723372044e2bd0ee49ed59a11512651
+DIST bash-4.3_p48-r2-patches.tar.xz 1080 BLAKE2B 2dfea3d3b24f6e03a2ba4643000599f7afda45bf07c78fcd748626304a6e31e3b55ca62043a41c9081d54cbe652e326d2ae90d1a07ae1f96ae99393e30dd6680 SHA512 a90886833c4b9962795fb3bf4b0b345e493fa90f0676ef6b618e8838cbb89ab8b298b0df0706bf1c11d817f56273222e1b44b1f4921e6d23f5b570bafdd0949c
 DIST bash-4.4.tar.gz 9377313 BLAKE2B ac0e481dd4f2d5b91eea4f0156f1fc398ef8bd1ccd941366aa9b041be576114c51e1ff1431ec871e96fb72257c2a05a0ebcbd88c43c221610fef7dfdb2502fc0 SHA512 73de3b425faaac55e45456b0f6f6d8077b5dfa7bb76e0d1894a19361b4a2b6bd4fbbe182117ddbfe9b07b4d898fba03537c261badc9533dd3c0da891764c7f29
+DIST bash-4.4_p23-r2-patches.tar.xz 664 BLAKE2B 4a5b71b95744be6b22807671ae3348aeb236b0c50d86d2dcaf142d847f3616d2b40858dae99fadbddfe1b206a86ad7730a7ef43a1864c18840b0ce97add52568 SHA512 0cddd5a251e0de52a8717cb7bfdc46745d9b3b5192d6cc81125afc5ac7d65748641af3d8e2241d3bbf642a485a23960fe02177901a6184135bc79b68bbdb04cc
 DIST bash-5.0.tar.gz 10135110 BLAKE2B a6c4d79144aa0c0f4a9433d618085c0d46b792b1de429b161f9f0266b55c099e13e44416c0886758a6f29411f5ceb79bfb0ec4eda47473f2713ae0b8081d6d3e SHA512 bb4519f06e278f271d08722b531e49d2e842cc3e0b02a6b3eee422e2efcb5b6226111af43f5e5eae56beb85ac8bfebcd6a4aacbabb8f609e529aa4d571890864
+DIST bash-5.0_p18-patches.tar.xz 804 BLAKE2B 89e615a08920a4cfc90f72d125a8256275b0677fb2d7abf208ca90ac80471d5fbf7efb86c814b6ccbbc65772370ed8fe82b7cee9b247ec881c0b664dee152f72 SHA512 538f817867ff3613f2177f2e6d9fecc69057152ac9cf35a5a7448ddc83960b94bc8e8f2987226ba68d14de376127ee5cf6c83f5374b74feb14fa1c5aab6105c7
 DIST bash-5.1.tar.gz 10458638 BLAKE2B 42059556694b604911b5b7936f94d42d8923f2931f3ebacefd95454274c7baadb1ec97629a524c1542e2e282dae66f1389334f8edc572ca8ee841cc3ac449ba7 SHA512 c44a0ce381469219548a3a27589af3fea4f22eda1ca4e9434b59fc16da81b471c29ce18e31590e0860a6a251a664b68c2b45e3a17d22cfc02799ffd9a208390c
 DIST bash-5.1.tar.gz.sig 95 BLAKE2B ac9209d6a4ab4436c511a7a195594e9036d7d1aef7887972f61a0e97378a9685b882621d7f95f5326b155dc155c41635417ce2ca41ac6d0dda78bd293ea4249f SHA512 3966404c0f683c7ef214fcf283b551e5441af3897009f778308c2e34067d98d57c95561453416a54ca5b1daf9a1288dbf950fe3f13353703cead12f5eec5fad8
+DIST bash-5.1_p16-patches.tar.xz 388 BLAKE2B 1575d54d311872c7ca71e13711fa0f7e3534fca16fd9d1ca045b6c696c9ca56f6a0ed5023a05d847ab5ddbefc22b8ef2c2a681f09571520f0294d83b495f0015 SHA512 c85e5b83f6ee1a7345647fa937d9718cab13be1a65886755d26a78d21fea4246650c7441a34fd729212e220366985b410562002d74c02c18de7ef0469b409ac7
 DIST bash-5.2-beta.tar.gz 10767207 BLAKE2B e3e0afd0d032dab002f3f7327cddbed56578d4d205e687c3408a9985038a4f24e7a728b874ff4ad960ca0c18e3174364e251658fb5ac8d1abed9907dd77764d2 SHA512 114fef0e3160d68fec977ccbe921b9e8a5ce468a8baefa1adb38c253da4528a3bd9a2791c667b01f0b7e248692044357d0506ee8a0b0ff2d4facc26112d0557d
 DIST bash-5.2-beta.tar.gz.sig 95 BLAKE2B 1c5a1ce4f6157593c40d931591dfa0c6b0baf8e871119fd94687d1fd17266be5e8445a174609075878f31f0e4d6722a6f19ae399a30bf3b5f254494aba5e21f7 SHA512 e0054cc76c9c5d066f6c4343ba8f144acb4f8792a1df1514845a9be4a1bd55b2b5bbf9f9318e8657d1efcd6dbe7b374eab757219d2334698a9ef56367bb4b4c1
 DIST bash205b-001 1132 BLAKE2B 0c5eef29777d54ef05957ea3d63b1556fb380bd20c238dc28993d822b37bc4e78ff4048ad069f6b8cd25da77ccdeb7aecd86c4349cb9d81e5e94c7001eeae5e6 SHA512 5ce4357468821b05e747201f3aa57225ad8f540c9e2c87051720490e039c30b478b9b662a68f14a0800fefe40184e4495e2645665200f9d75e9a115b2ac08071

diff --git a/app-shells/bash/bash-2.05b_p13.ebuild b/app-shells/bash/bash-2.05b_p13.ebuild
index 508333271bcc..ef9bd98f1080 100644
--- a/app-shells/bash/bash-2.05b_p13.ebuild
+++ b/app-shells/bash/bash-2.05b_p13.ebuild
@@ -5,6 +5,10 @@ EAPI=7
 
 inherit flag-o-matic toolchain-funcs
 
+# Uncomment if we have a patchset
+GENTOO_PATCH_DEV="sam"
+GENTOO_PATCH_VER="${PV}"
+
 # Official patchlevel
 # See ftp://ftp.cwru.edu/pub/bash/bash-2.05b-patches/
 PLEVEL="${PV##*_p}"
@@ -31,6 +35,10 @@ DESCRIPTION="The standard GNU Bourne again shell"
 HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html"
 SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
 
+if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+	SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
+fi
+
 LICENSE="GPL-2"
 SLOT="${MY_PV}"
 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86"
@@ -46,15 +54,15 @@ DEPEND="${RDEPEND}
 S="${WORKDIR}/${MY_P}"
 
 PATCHES=(
-	"${FILESDIR}"/${PN}-2.05b-destdir.patch
-	"${FILESDIR}"/autoconf-mktime-2.53.patch # bug #220040
-	"${FILESDIR}"/${PN}-2.05b-protos.patch
-	"${FILESDIR}"/${PN}-2.05b-empty-herestring.patch
-	"${FILESDIR}"/${PN}-2.05b-rbash.patch # bug #26854
-	"${FILESDIR}"/${PN}-2.05b-parallel-build.patch # bug #41002
-	"${FILESDIR}"/${PN}-2.05b-jobs.patch
-	"${FILESDIR}"/${PN}-2.05b-fix-job-warning.patch
-	"${FILESDIR}"/${PN}-3.1-dev-fd-buffer-overflow.patch # bug #431850
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-2.05b-destdir.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/autoconf-mktime-2.53.patch # bug #220040
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-2.05b-protos.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-2.05b-empty-herestring.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-2.05b-rbash.patch # bug #26854
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-2.05b-parallel-build.patch # bug #41002
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-2.05b-jobs.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-2.05b-fix-job-warning.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.1-dev-fd-buffer-overflow.patch # bug #431850
 )
 
 pkg_setup() {
@@ -68,6 +76,10 @@ pkg_setup() {
 
 src_unpack() {
 	unpack ${MY_P}.tar.gz
+
+	if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+		unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
+	fi
 }
 
 src_prepare() {

diff --git a/app-shells/bash/bash-3.0_p22.ebuild b/app-shells/bash/bash-3.0_p22.ebuild
index fa3951936d98..15629ba77d24 100644
--- a/app-shells/bash/bash-3.0_p22.ebuild
+++ b/app-shells/bash/bash-3.0_p22.ebuild
@@ -5,6 +5,10 @@ EAPI=7
 
 inherit flag-o-matic toolchain-funcs
 
+# Uncomment if we have a patchset
+GENTOO_PATCH_DEV="sam"
+GENTOO_PATCH_VER="${PV}"
+
 # Official patchlevel
 # See ftp://ftp.cwru.edu/pub/bash/bash-3.0-patches/
 PLEVEL="${PV##*_p}"
@@ -31,6 +35,10 @@ DESCRIPTION="The standard GNU Bourne again shell"
 HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html"
 SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
 
+if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+	SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
+fi
+
 LICENSE="GPL-2"
 SLOT="${MY_PV}"
 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86"
@@ -46,20 +54,20 @@ DEPEND="${RDEPEND}
 S="${WORKDIR}/${MY_P}"
 
 PATCHES=(
-	"${FILESDIR}"/autoconf-mktime-2.53.patch
-	"${FILESDIR}"/${PN}-3.0-protos.patch
-	"${FILESDIR}"/${PN}-3.0-rbash.patch # bug #26854
-	"${FILESDIR}"/${PN}-2.05b-parallel-build.patch # bug #41002
-	"${FILESDIR}"/${PN}-3.0-darwin-conn.patch # bug #79124
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/autoconf-mktime-2.53.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.0-protos.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.0-rbash.patch # bug #26854
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-2.05b-parallel-build.patch # bug #41002
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.0-darwin-conn.patch # bug #79124
 
 	# Read patch headers for more info ... many ripped from Fedora/Debian[17]/SuSe/upstream
-	"${FILESDIR}"/${PN}-3.0-{afs,crash,jobs,manpage,pwd,ulimit,histtimeformat,locale,multibyteifs,subshell,volatile-command}.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.0-{afs,crash,jobs,manpage,pwd,ulimit,histtimeformat,locale,multibyteifs,subshell,volatile-command}.patch
 
-	"${FILESDIR}"/${PN}-3.0-read-builtin-pipe.patch # bug #87093
-	"${FILESDIR}"/${PN}-3.0-trap-fg-signals.patch
-	"${FILESDIR}"/${PN}-3.0-pgrp-pipe-fix.patch # bug #92349
-	"${FILESDIR}"/${PN}-3.0-strnlen.patch
-	"${FILESDIR}"/${PN}-3.1-dev-fd-buffer-overflow.patch # bug #431850
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.0-read-builtin-pipe.patch # bug #87093
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.0-trap-fg-signals.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.0-pgrp-pipe-fix.patch # bug #92349
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.0-strnlen.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.1-dev-fd-buffer-overflow.patch # bug #431850
 )
 
 pkg_setup() {
@@ -73,6 +81,10 @@ pkg_setup() {
 
 src_unpack() {
 	unpack ${MY_P}.tar.gz
+
+	if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+		unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
+	fi
 }
 
 src_prepare() {

diff --git a/app-shells/bash/bash-3.1_p23.ebuild b/app-shells/bash/bash-3.1_p23.ebuild
index bc1b322a17e3..9e742a38c00b 100644
--- a/app-shells/bash/bash-3.1_p23.ebuild
+++ b/app-shells/bash/bash-3.1_p23.ebuild
@@ -5,6 +5,10 @@ EAPI=7
 
 inherit flag-o-matic toolchain-funcs
 
+# Uncomment if we have a patchset
+GENTOO_PATCH_DEV="sam"
+GENTOO_PATCH_VER="${PV}"
+
 # Official patchlevel
 # See ftp://ftp.cwru.edu/pub/bash/bash-3.1-patches/
 PLEVEL="${PV##*_p}"
@@ -31,6 +35,10 @@ DESCRIPTION="The standard GNU Bourne again shell"
 HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html"
 SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
 
+if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+	SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
+fi
+
 LICENSE="GPL-2"
 SLOT="${MY_PV}"
 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86"
@@ -46,15 +54,15 @@ DEPEND="${RDEPEND}
 S="${WORKDIR}/${MY_P}"
 
 PATCHES=(
-	"${FILESDIR}"/autoconf-mktime-2.53.patch # bug #220040
-	"${FILESDIR}"/${PN}-2.05b-parallel-build.patch # bug #41002
-	"${FILESDIR}"/${PN}-3.1-protos.patch
-	"${FILESDIR}"/${PN}-3.1-ulimit.patch
-	"${FILESDIR}"/${PN}-3.0-read-memleak.patch
-	"${FILESDIR}"/${PN}-3.0-trap-fg-signals.patch
-	"${FILESDIR}"/${PN}-3.1-fix-dash-login-shell.patch # bug #118257
-	"${FILESDIR}"/${PN}-3.1-dev-fd-test-as-user.patch # bug #131875
-	"${FILESDIR}"/${PN}-3.1-dev-fd-buffer-overflow.patch # bug #431850
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/autoconf-mktime-2.53.patch # bug #220040
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-2.05b-parallel-build.patch # bug #41002
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.1-protos.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.1-ulimit.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.0-read-memleak.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.0-trap-fg-signals.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.1-fix-dash-login-shell.patch # bug #118257
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.1-dev-fd-test-as-user.patch # bug #131875
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.1-dev-fd-buffer-overflow.patch # bug #431850
 )
 
 pkg_setup() {
@@ -68,6 +76,10 @@ pkg_setup() {
 
 src_unpack() {
 	unpack ${MY_P}.tar.gz
+
+	if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+		unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
+	fi
 }
 
 src_prepare() {

diff --git a/app-shells/bash/bash-3.2_p57.ebuild b/app-shells/bash/bash-3.2_p57.ebuild
index 8f054fd31d22..fd2dedaf8b86 100644
--- a/app-shells/bash/bash-3.2_p57.ebuild
+++ b/app-shells/bash/bash-3.2_p57.ebuild
@@ -5,6 +5,10 @@ EAPI=7
 
 inherit flag-o-matic toolchain-funcs
 
+# Uncomment if we have a patchset
+GENTOO_PATCH_DEV="sam"
+GENTOO_PATCH_VER="${PV}"
+
 # Official patchlevel
 # See ftp://ftp.cwru.edu/pub/bash/bash-3.2-patches/
 PLEVEL="${PV##*_p}"
@@ -31,6 +35,10 @@ DESCRIPTION="The standard GNU Bourne again shell"
 HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html"
 SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
 
+if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+	SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
+fi
+
 LICENSE="GPL-2"
 SLOT="${MY_PV}"
 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86"
@@ -46,17 +54,17 @@ DEPEND="${RDEPEND}
 S="${WORKDIR}/${MY_P}"
 
 PATCHES=(
-	"${FILESDIR}"/autoconf-mktime-2.59.patch # bug #220040
-	"${FILESDIR}"/${PN}-3.2-loadables.patch
-	"${FILESDIR}"/${PN}-2.05b-parallel-build.patch # bug #41002
-	"${FILESDIR}"/${PN}-3.2-protos.patch
-	"${FILESDIR}"/${PN}-3.2-session-leader.patch # bug #231775
-	"${FILESDIR}"/${PN}-3.2-ldflags-for-build.patch # bug #211947
-	"${FILESDIR}"/${PN}-3.2-process-subst.patch
-	"${FILESDIR}"/${PN}-3.2-ulimit.patch
-	"${FILESDIR}"/${PN}-3.0-trap-fg-signals.patch
-	"${FILESDIR}"/${PN}-3.2-dev-fd-test-as-user.patch # bug #131875
-	"${FILESDIR}"/${PN}-4.2-dev-fd-buffer-overflow.patch # bug #431850
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/autoconf-mktime-2.59.patch # bug #220040
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.2-loadables.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-2.05b-parallel-build.patch # bug #41002
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.2-protos.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.2-session-leader.patch # bug #231775
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.2-ldflags-for-build.patch # bug #211947
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.2-process-subst.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.2-ulimit.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.0-trap-fg-signals.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-3.2-dev-fd-test-as-user.patch # bug #131875
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.2-dev-fd-buffer-overflow.patch # bug #431850
 )
 
 pkg_setup() {
@@ -70,6 +78,10 @@ pkg_setup() {
 
 src_unpack() {
 	unpack ${MY_P}.tar.gz
+
+	if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+		unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
+	fi
 }
 
 src_prepare() {

diff --git a/app-shells/bash/bash-4.0_p44.ebuild b/app-shells/bash/bash-4.0_p44.ebuild
index 80f0e3193096..3e10f70b2b88 100644
--- a/app-shells/bash/bash-4.0_p44.ebuild
+++ b/app-shells/bash/bash-4.0_p44.ebuild
@@ -5,6 +5,10 @@ EAPI=7
 
 inherit flag-o-matic toolchain-funcs
 
+# Uncomment if we have a patchset
+GENTOO_PATCH_DEV="sam"
+GENTOO_PATCH_VER="${PV}"
+
 # Official patchlevel
 # See ftp://ftp.cwru.edu/pub/bash/bash-4.0-patches/
 PLEVEL="${PV##*_p}"
@@ -31,6 +35,10 @@ DESCRIPTION="The standard GNU Bourne again shell"
 HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html"
 SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
 
+if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+	SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
+fi
+
 LICENSE="GPL-3"
 SLOT="${MY_PV}"
 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86"
@@ -46,14 +54,14 @@ DEPEND="${RDEPEND}
 S="${WORKDIR}/${MY_P}"
 
 PATCHES=(
-	"${FILESDIR}"/${PN}-4.0-configure.patch # bug #304901
-	"${FILESDIR}"/${PN}-4.x-deferred-heredocs.patch
-
-	"${FILESDIR}"/${PN}-2.05b-parallel-build.patch # bug #41002
-	"${FILESDIR}"/${PN}-4.0-ldflags-for-build.patch # bug #211947
-	"${FILESDIR}"/${PN}-4.0-negative-return.patch
-	"${FILESDIR}"/${PN}-4.0-parallel-build.patch # bug #267613
-	"${FILESDIR}"/${PN}-4.2-dev-fd-buffer-overflow.patch #431850
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.0-configure.patch # bug #304901
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.x-deferred-heredocs.patch
+
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-2.05b-parallel-build.patch # bug #41002
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.0-ldflags-for-build.patch # bug #211947
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.0-negative-return.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.0-parallel-build.patch # bug #267613
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.2-dev-fd-buffer-overflow.patch #431850
 )
 
 pkg_setup() {
@@ -67,6 +75,10 @@ pkg_setup() {
 
 src_unpack() {
 	unpack ${MY_P}.tar.gz
+
+	if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+		unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
+	fi
 }
 
 src_prepare() {

diff --git a/app-shells/bash/bash-4.1_p17.ebuild b/app-shells/bash/bash-4.1_p17.ebuild
index 1f9fd413625e..5088a6d4f393 100644
--- a/app-shells/bash/bash-4.1_p17.ebuild
+++ b/app-shells/bash/bash-4.1_p17.ebuild
@@ -5,6 +5,10 @@ EAPI=7
 
 inherit flag-o-matic toolchain-funcs
 
+# Uncomment if we have a patchset
+GENTOO_PATCH_DEV="sam"
+GENTOO_PATCH_VER="${PV}"
+
 # Official patchlevel
 # See ftp://ftp.cwru.edu/pub/bash/bash-4.1-patches/
 PLEVEL="${PV##*_p}"
@@ -31,6 +35,10 @@ DESCRIPTION="The standard GNU Bourne again shell"
 HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html"
 SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
 
+if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+	SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
+fi
+
 LICENSE="GPL-3"
 SLOT="${MY_PV}"
 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86"
@@ -46,10 +54,10 @@ DEPEND="${RDEPEND}
 S="${WORKDIR}/${MY_P}"
 
 PATCHES=(
-	"${FILESDIR}"/${PN}-4.1-fbsd-eaccess.patch #bug #303411
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.1-fbsd-eaccess.patch #bug #303411
 
-	"${FILESDIR}"/${PN}-4.1-parallel-build.patch
-	"${FILESDIR}"/${PN}-4.2-dev-fd-buffer-overflow.patch #bug #431850
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.1-parallel-build.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.2-dev-fd-buffer-overflow.patch #bug #431850
 )
 
 pkg_setup() {
@@ -63,6 +71,10 @@ pkg_setup() {
 
 src_unpack() {
 	unpack ${MY_P}.tar.gz
+
+	if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+		unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
+	fi
 }
 
 src_prepare() {

diff --git a/app-shells/bash/bash-4.2_p53.ebuild b/app-shells/bash/bash-4.2_p53.ebuild
index d2f41d73b72e..e80e66616297 100644
--- a/app-shells/bash/bash-4.2_p53.ebuild
+++ b/app-shells/bash/bash-4.2_p53.ebuild
@@ -5,6 +5,10 @@ EAPI=7
 
 inherit flag-o-matic toolchain-funcs
 
+# Uncomment if we have a patchset
+GENTOO_PATCH_DEV="sam"
+GENTOO_PATCH_VER="${PV}"
+
 # Official patchlevel
 # See ftp://ftp.cwru.edu/pub/bash/bash-4.2-patches/
 PLEVEL="${PV##*_p}"
@@ -31,6 +35,10 @@ DESCRIPTION="The standard GNU Bourne again shell"
 HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html"
 SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
 
+if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+	SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
+fi
+
 LICENSE="GPL-3"
 SLOT="${MY_PV}"
 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86"
@@ -48,11 +56,11 @@ BDEPEND="virtual/yacc"
 S="${WORKDIR}/${MY_P}"
 
 PATCHES=(
-	"${FILESDIR}"/${PN}-4.2-execute-job-control.patch # bug #383237
-	"${FILESDIR}"/${PN}-4.2-parallel-build.patch
-	"${FILESDIR}"/${PN}-4.2-no-readline.patch
-	"${FILESDIR}"/${PN}-4.2-read-retry.patch # bug #447810
-	"${FILESDIR}"/${PN}-4.2-speed-up-read-N.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.2-execute-job-control.patch # bug #383237
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.2-parallel-build.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.2-no-readline.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.2-read-retry.patch # bug #447810
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-4.2-speed-up-read-N.patch
 )
 
 pkg_setup() {
@@ -66,6 +74,10 @@ pkg_setup() {
 
 src_unpack() {
 	unpack ${MY_P}.tar.gz
+
+	if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+		unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
+	fi
 }
 
 src_prepare() {

diff --git a/app-shells/bash/bash-4.3_p48-r2.ebuild b/app-shells/bash/bash-4.3_p48-r2.ebuild
index 907ee1c4df9b..4409129e3732 100644
--- a/app-shells/bash/bash-4.3_p48-r2.ebuild
+++ b/app-shells/bash/bash-4.3_p48-r2.ebuild
@@ -5,6 +5,10 @@ EAPI=7
 
 inherit flag-o-matic toolchain-funcs
 
+# Uncomment if we have a patchset
+GENTOO_PATCH_DEV="sam"
+GENTOO_PATCH_VER="${PV}-r2"
+
 # Official patchlevel
 # See ftp://ftp.cwru.edu/pub/bash/bash-4.3-patches/
 PLEVEL="${PV##*_p}"
@@ -35,6 +39,10 @@ HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html"
 SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
 [[ ${PV} == *_rc* ]] && SRC_URI+=" ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
 
+if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+	SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
+fi
+
 LICENSE="GPL-3"
 SLOT="${MY_PV}"
 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86"
@@ -49,10 +57,10 @@ RDEPEND="${DEPEND}
 BDEPEND="virtual/yacc"
 
 PATCHES=(
-	"${FILESDIR}"/${PN}-4.3-mapfile-improper-array-name-validation.patch
-	"${FILESDIR}"/${PN}-4.3-arrayfunc.patch
-	"${FILESDIR}"/${PN}-4.3-protos.patch
-	"${FILESDIR}"/${PN}-4.4-popd-offset-overflow.patch # bug #600174
+	"${WORKDIR}"/${P}-r2-patches/${PN}-4.3-mapfile-improper-array-name-validation.patch
+	"${WORKDIR}"/${P}-r2-patches/${PN}-4.3-arrayfunc.patch
+	"${WORKDIR}"/${P}-r2-patches/${PN}-4.3-protos.patch
+	"${WORKDIR}"/${P}-r2-patches/${PN}-4.4-popd-offset-overflow.patch # bug #600174
 )
 
 S="${WORKDIR}/${MY_P}"
@@ -73,6 +81,10 @@ pkg_setup() {
 
 src_unpack() {
 	unpack ${MY_P}.tar.gz
+
+	if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+		unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
+	fi
 }
 
 src_prepare() {

diff --git a/app-shells/bash/bash-4.4_p23-r2.ebuild b/app-shells/bash/bash-4.4_p23-r2.ebuild
index ee79d247e465..1cbb226099a8 100644
--- a/app-shells/bash/bash-4.4_p23-r2.ebuild
+++ b/app-shells/bash/bash-4.4_p23-r2.ebuild
@@ -5,6 +5,10 @@ EAPI=7
 
 inherit flag-o-matic toolchain-funcs prefix
 
+# Uncomment if we have a patchset
+GENTOO_PATCH_DEV="sam"
+GENTOO_PATCH_VER="${PV}-r2"
+
 # Official patchlevel
 # See ftp://ftp.cwru.edu/pub/bash/bash-4.4-patches/
 PLEVEL="${PV##*_p}"
@@ -44,6 +48,10 @@ else
 	SRC_URI="ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
 fi
 
+if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+	SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
+fi
+
 LICENSE="GPL-3"
 SLOT="${MY_PV}"
 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
@@ -78,14 +86,18 @@ pkg_setup() {
 
 src_unpack() {
 	unpack ${MY_P}.tar.gz
+
+	if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+		unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
+	fi
 }
 
 src_prepare() {
 	# Include official patches
 	[[ ${PLEVEL} -gt 0 ]] && eapply -p0 $(patches -s)
 
-	eapply "${FILESDIR}/${PN}-4.4-jobs_overflow.patch" # bug #644720
-	eapply "${FILESDIR}/${PN}-4.4-set-SHOBJ_STATUS.patch" # bug #644720
+	eapply "${WORKDIR}"/${P}-r2-patches/${PN}-4.4-jobs_overflow.patch # bug #644720
+	eapply "${WORKDIR}"/${P}-r2-patches/${PN}-4.4-set-SHOBJ_STATUS.patch # bug #644720
 
 	# Clean out local libs so we know we use system ones w/releases.
 	if is_release ; then

diff --git a/app-shells/bash/bash-5.0_p18.ebuild b/app-shells/bash/bash-5.0_p18.ebuild
index 55aa53be0667..55781d0923c2 100644
--- a/app-shells/bash/bash-5.0_p18.ebuild
+++ b/app-shells/bash/bash-5.0_p18.ebuild
@@ -5,6 +5,10 @@ EAPI=7
 
 inherit flag-o-matic toolchain-funcs prefix
 
+# Uncomment if we have a patchset
+GENTOO_PATCH_DEV="sam"
+GENTOO_PATCH_VER="${PV}"
+
 # Official patchlevel
 # See ftp://ftp.cwru.edu/pub/bash/bash-5.0-patches/
 PLEVEL="${PV##*_p}"
@@ -44,6 +48,10 @@ else
 	SRC_URI="ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
 fi
 
+if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+	SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
+fi
+
 LICENSE="GPL-3"
 SLOT="0"
 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
@@ -64,8 +72,8 @@ S="${WORKDIR}/${MY_P}"
 
 PATCHES=(
 	# Patches from Chet sent to bashbug ml
-	"${FILESDIR}"/${PN}-5.0-history-append.patch
-	"${FILESDIR}"/${PN}-5.0-syslog-history-extern.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-5.0-history-append.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-5.0-syslog-history-extern.patch
 )
 
 pkg_setup() {
@@ -84,6 +92,10 @@ pkg_setup() {
 
 src_unpack() {
 	unpack ${MY_P}.tar.gz
+
+	if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+		unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
+	fi
 }
 
 src_prepare() {

diff --git a/app-shells/bash/bash-5.1_p16.ebuild b/app-shells/bash/bash-5.1_p16.ebuild
index a274960e97fe..43292ec1f762 100644
--- a/app-shells/bash/bash-5.1_p16.ebuild
+++ b/app-shells/bash/bash-5.1_p16.ebuild
@@ -6,6 +6,10 @@ EAPI=7
 VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/chetramey.asc
 inherit flag-o-matic toolchain-funcs prefix verify-sig
 
+# Uncomment if we have a patchset
+GENTOO_PATCH_DEV="sam"
+GENTOO_PATCH_VER="${PV}"
+
 # Official patchlevel
 # See ftp://ftp.cwru.edu/pub/bash/bash-5.1-patches/
 PLEVEL="${PV##*_p}"
@@ -48,6 +52,10 @@ else
 	SRC_URI+=" verify-sig? ( ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )"
 fi
 
+if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+	SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
+fi
+
 LICENSE="GPL-3"
 SLOT="0"
 [[ "${PV}" == *_rc* ]] || \
@@ -70,7 +78,7 @@ S="${WORKDIR}/${MY_P}"
 
 PATCHES=(
 	# Patches from Chet sent to bashbug ml
-	"${FILESDIR}"/${PN}-5.0-syslog-history-extern.patch
+	"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}-patches/${PN}-5.0-syslog-history-extern.patch
 )
 
 pkg_setup() {
@@ -88,9 +96,19 @@ pkg_setup() {
 }
 
 src_unpack() {
-	verify-sig_src_unpack
+	if [[ ${PV} == 9999 ]] ; then
+		git-r3_src_unpack
+	else
+		if use verify-sig ; then
+			verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.sig}
+		fi
+
+		unpack ${MY_P}.tar.gz
 
-	unpack ${MY_P}.tar.gz
+		if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+			unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
+		fi
+	fi
 }
 
 src_prepare() {

diff --git a/app-shells/bash/bash-5.2_beta.ebuild b/app-shells/bash/bash-5.2_beta.ebuild
index 851264513714..9582f937a142 100644
--- a/app-shells/bash/bash-5.2_beta.ebuild
+++ b/app-shells/bash/bash-5.2_beta.ebuild
@@ -10,6 +10,10 @@ EAPI=7
 VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/chetramey.asc
 inherit flag-o-matic toolchain-funcs prefix verify-sig
 
+# Uncomment if we have a patchset
+#GENTOO_PATCH_DEV="sam"
+#GENTOO_PATCH_VER="${PV}"
+
 # Official patchlevel
 # See ftp://ftp.cwru.edu/pub/bash/bash-5.1-patches/
 PLEVEL="${PV##*_p}"
@@ -57,6 +61,10 @@ else
 	SRC_URI+=" verify-sig? ( ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )"
 fi
 
+if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+	SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
+fi
+
 LICENSE="GPL-3"
 SLOT="0"
 if is_release ; then
@@ -79,6 +87,8 @@ BDEPEND="verify-sig? ( sec-keys/openpgp-keys-chetramey )"
 S="${WORKDIR}/${MY_P}"
 
 PATCHES=(
+	#"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}/
+
 	# Patches from Chet sent to bashbug ml
 	"${FILESDIR}"/${PN}-5.0-syslog-history-extern.patch
 )
@@ -101,8 +111,15 @@ src_unpack() {
 	if [[ ${PV} == 9999 ]] ; then
 		git-r3_src_unpack
 	else
-		verify-sig_src_unpack
+		if use verify-sig ; then
+			verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.sig}
+		fi
+
 		unpack ${MY_P}.tar.gz
+
+		if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+			unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
+		fi
 	fi
 }
 

diff --git a/app-shells/bash/bash-9999.ebuild b/app-shells/bash/bash-9999.ebuild
index 851264513714..9582f937a142 100644
--- a/app-shells/bash/bash-9999.ebuild
+++ b/app-shells/bash/bash-9999.ebuild
@@ -10,6 +10,10 @@ EAPI=7
 VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/chetramey.asc
 inherit flag-o-matic toolchain-funcs prefix verify-sig
 
+# Uncomment if we have a patchset
+#GENTOO_PATCH_DEV="sam"
+#GENTOO_PATCH_VER="${PV}"
+
 # Official patchlevel
 # See ftp://ftp.cwru.edu/pub/bash/bash-5.1-patches/
 PLEVEL="${PV##*_p}"
@@ -57,6 +61,10 @@ else
 	SRC_URI+=" verify-sig? ( ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )"
 fi
 
+if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+	SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz"
+fi
+
 LICENSE="GPL-3"
 SLOT="0"
 if is_release ; then
@@ -79,6 +87,8 @@ BDEPEND="verify-sig? ( sec-keys/openpgp-keys-chetramey )"
 S="${WORKDIR}/${MY_P}"
 
 PATCHES=(
+	#"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}/
+
 	# Patches from Chet sent to bashbug ml
 	"${FILESDIR}"/${PN}-5.0-syslog-history-extern.patch
 )
@@ -101,8 +111,15 @@ src_unpack() {
 	if [[ ${PV} == 9999 ]] ; then
 		git-r3_src_unpack
 	else
-		verify-sig_src_unpack
+		if use verify-sig ; then
+			verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.sig}
+		fi
+
 		unpack ${MY_P}.tar.gz
+
+		if [[ -n ${GENTOO_PATCH_VER} ]] ; then
+			unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz
+		fi
 	fi
 }
 

diff --git a/app-shells/bash/files/autoconf-mktime-2.53.patch b/app-shells/bash/files/autoconf-mktime-2.53.patch
deleted file mode 100644
index 7632b63f4f79..000000000000
--- a/app-shells/bash/files/autoconf-mktime-2.53.patch
+++ /dev/null
@@ -1,199 +0,0 @@
-https://bugs.gentoo.org/220040
-
---- a/configure
-+++ b/configure
-@@ -12393,22 +12393,25 @@ else
- #line $LINENO "configure"
- #include "confdefs.h"
- /* Test program from Paul Eggert and Tony Leneis.  */
--#if TIME_WITH_SYS_TIME
-+#ifdef TIME_WITH_SYS_TIME
- # include <sys/time.h>
- # include <time.h>
- #else
--# if HAVE_SYS_TIME_H
-+# ifdef HAVE_SYS_TIME_H
- #  include <sys/time.h>
- # else
- #  include <time.h>
- # endif
- #endif
- 
--#if HAVE_UNISTD_H
-+#include <limits.h>
-+#include <stdlib.h>
-+
-+#ifdef HAVE_UNISTD_H
- # include <unistd.h>
- #endif
- 
--#if !HAVE_ALARM
-+#ifndef HAVE_ALARM
- # define alarm(X) /* empty */
- #endif
- 
-@@ -12416,6 +12419,7 @@ else
- #undef putenv
- 
- static time_t time_t_max;
-+static time_t time_t_min;
- 
- /* Values we'll use to set the TZ environment variable.  */
- static const char *const tz_strings[] = {
-@@ -12424,9 +12428,9 @@ static const char *const tz_strings[] = {
- };
- #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
- 
--/* Fail if mktime fails to convert a date in the spring-forward gap.
-+/* Return 0 if mktime fails to convert a date in the spring-forward gap.
-    Based on a problem report from Andreas Jaeger.  */
--static void
-+static int
- spring_forward_gap ()
- {
-   /* glibc (up to about 1998-10-07) failed this test. */
-@@ -12445,23 +12449,27 @@ spring_forward_gap ()
-   tm.tm_min = 0;
-   tm.tm_sec = 0;
-   tm.tm_isdst = -1;
--  if (mktime (&tm) == (time_t)-1)
--    exit (1);
-+  return mktime (&tm) != (time_t) -1;
- }
- 
--static void
--mktime_test (now)
-+static int
-+mktime_test1 (now)
-      time_t now;
- {
-   struct tm *lt;
--  if ((lt = localtime (&now)) && mktime (lt) != now)
--    exit (1);
--  now = time_t_max - now;
--  if ((lt = localtime (&now)) && mktime (lt) != now)
--    exit (1);
-+  return ! (lt = localtime (&now)) || mktime (lt) == now;
- }
- 
--static void
-+static int
-+mktime_test (now)
-+     time_t now;
-+{
-+  return (mktime_test1 (now)
-+	  && mktime_test1 ((time_t) (time_t_max - now))
-+	  && mktime_test1 ((time_t) (time_t_min + now)));
-+}
-+
-+static int
- irix_6_4_bug ()
- {
-   /* Based on code from Ariel Faigon.  */
-@@ -12474,11 +12482,10 @@ irix_6_4_bug ()
-   tm.tm_sec = 0;
-   tm.tm_isdst = -1;
-   mktime (&tm);
--  if (tm.tm_mon != 2 || tm.tm_mday != 31)
--    exit (1);
-+  return tm.tm_mon == 2 && tm.tm_mday == 31;
- }
- 
--static void
-+static int
- bigtime_test (j)
-      int j;
- {
-@@ -12500,8 +12507,39 @@ bigtime_test (j)
- 	     && lt->tm_wday == tm.tm_wday
- 	     && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
- 		  == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
--	exit (1);
-+	return 0;
-     }
-+  return 1;
-+}
-+
-+static int
-+year_2050_test ()
-+{
-+  /* The correct answer for 2050-02-01 00:00:00 in Pacific time,
-+     ignoring leap seconds.  */
-+  unsigned long int answer = 2527315200UL;
-+
-+  struct tm tm;
-+  time_t t;
-+  tm.tm_year = 2050 - 1900;
-+  tm.tm_mon = 2 - 1;
-+  tm.tm_mday = 1;
-+  tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
-+  tm.tm_isdst = -1;
-+
-+  /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
-+     instead of "TZ=America/Vancouver" in order to detect the bug even
-+     on systems that don't support the Olson extension, or don't have the
-+     full zoneinfo tables installed.  */
-+  putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
-+
-+  t = mktime (&tm);
-+
-+  /* Check that the result is either a failure, or close enough
-+     to the correct answer that we can assume the discrepancy is
-+     due to leap seconds.  */
-+  return (t == (time_t) -1
-+	  || (0 < t && answer - 120 <= t && t <= answer + 120));
- }
- 
- int
-@@ -12515,9 +12553,15 @@ main ()
-      isn't worth using anyway.  */
-   alarm (60);
- 
--  for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
--    continue;
--  time_t_max--;
-+  for (;;)
-+    {
-+      t = (time_t_max << 1) + 1;
-+      if (t <= time_t_max)
-+	break;
-+      time_t_max = t;
-+    }
-+  time_t_min = - ((time_t) ~ (time_t) 0 == (time_t) -1) - time_t_max;
-+
-   delta = time_t_max / 997; /* a suitable prime number */
-   for (i = 0; i < N_STRINGS; i++)
-     {
-@@ -12525,17 +12569,22 @@ main ()
- 	putenv (tz_strings[i]);
- 
-       for (t = 0; t <= time_t_max - delta; t += delta)
--	mktime_test (t);
--      mktime_test ((time_t) 60 * 60);
--      mktime_test ((time_t) 60 * 60 * 24);
--
--      for (j = 1; 0 < j; j *= 2)
--        bigtime_test (j);
--      bigtime_test (j - 1);
-+	if (! mktime_test (t))
-+	  return 1;
-+      if (! (mktime_test ((time_t) 1)
-+	     && mktime_test ((time_t) (60 * 60))
-+	     && mktime_test ((time_t) (60 * 60 * 24))))
-+	return 1;
-+
-+      for (j = 1; ; j <<= 1)
-+	if (! bigtime_test (j))
-+	  return 1;
-+	else if (INT_MAX / 2 < j)
-+	  break;
-+      if (! bigtime_test (INT_MAX))
-+	return 1;
-     }
--  irix_6_4_bug ();
--  spring_forward_gap ();
--  exit (0);
-+  return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ());
- }
- _ACEOF
- rm -f conftest$ac_exeext

diff --git a/app-shells/bash/files/autoconf-mktime-2.59.patch b/app-shells/bash/files/autoconf-mktime-2.59.patch
deleted file mode 100644
index 33055a7be61a..000000000000
--- a/app-shells/bash/files/autoconf-mktime-2.59.patch
+++ /dev/null
@@ -1,197 +0,0 @@
-http://bugs.gentoo.org/220040
---- a/configure
-+++ b/configure
-@@ -5299,26 +6059,25 @@
- cat >>conftest.$ac_ext <<_ACEOF
- /* end confdefs.h.  */
- /* Test program from Paul Eggert and Tony Leneis.  */
--#if TIME_WITH_SYS_TIME
-+#ifdef TIME_WITH_SYS_TIME
- # include <sys/time.h>
- # include <time.h>
- #else
--# if HAVE_SYS_TIME_H
-+# ifdef HAVE_SYS_TIME_H
- #  include <sys/time.h>
- # else
- #  include <time.h>
- # endif
- #endif
- 
--#if HAVE_STDLIB_H
--# include <stdlib.h>
--#endif
-+#include <limits.h>
-+#include <stdlib.h>
- 
--#if HAVE_UNISTD_H
-+#ifdef HAVE_UNISTD_H
- # include <unistd.h>
- #endif
- 
--#if !HAVE_ALARM
-+#ifndef HAVE_ALARM
- # define alarm(X) /* empty */
- #endif
- 
-@@ -5335,9 +6094,9 @@
- };
- #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
- 
--/* Fail if mktime fails to convert a date in the spring-forward gap.
-+/* Return 0 if mktime fails to convert a date in the spring-forward gap.
-    Based on a problem report from Andreas Jaeger.  */
--static void
-+static int
- spring_forward_gap ()
- {
-   /* glibc (up to about 1998-10-07) failed this test. */
-@@ -5356,29 +6115,27 @@
-   tm.tm_min = 0;
-   tm.tm_sec = 0;
-   tm.tm_isdst = -1;
--  if (mktime (&tm) == (time_t)-1)
--    exit (1);
-+  return mktime (&tm) != (time_t) -1;
- }
- 
--static void
-+static int
- mktime_test1 (now)
-      time_t now;
- {
-   struct tm *lt;
--  if ((lt = localtime (&now)) && mktime (lt) != now)
--    exit (1);
-+  return ! (lt = localtime (&now)) || mktime (lt) == now;
- }
- 
--static void
-+static int
- mktime_test (now)
-      time_t now;
- {
--  mktime_test1 (now);
--  mktime_test1 ((time_t) (time_t_max - now));
--  mktime_test1 ((time_t) (time_t_min + now));
-+  return (mktime_test1 (now)
-+	  && mktime_test1 ((time_t) (time_t_max - now))
-+	  && mktime_test1 ((time_t) (time_t_min + now)));
- }
- 
--static void
-+static int
- irix_6_4_bug ()
- {
-   /* Based on code from Ariel Faigon.  */
-@@ -5391,11 +6148,10 @@
-   tm.tm_sec = 0;
-   tm.tm_isdst = -1;
-   mktime (&tm);
--  if (tm.tm_mon != 2 || tm.tm_mday != 31)
--    exit (1);
-+  return tm.tm_mon == 2 && tm.tm_mday == 31;
- }
- 
--static void
-+static int
- bigtime_test (j)
-      int j;
- {
-@@ -5417,8 +6173,39 @@
- 	     && lt->tm_wday == tm.tm_wday
- 	     && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
- 		  == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
--	exit (1);
-+	return 0;
-     }
-+  return 1;
-+}
-+
-+static int
-+year_2050_test ()
-+{
-+  /* The correct answer for 2050-02-01 00:00:00 in Pacific time,
-+     ignoring leap seconds.  */
-+  unsigned long int answer = 2527315200UL;
-+
-+  struct tm tm;
-+  time_t t;
-+  tm.tm_year = 2050 - 1900;
-+  tm.tm_mon = 2 - 1;
-+  tm.tm_mday = 1;
-+  tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
-+  tm.tm_isdst = -1;
-+
-+  /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
-+     instead of "TZ=America/Vancouver" in order to detect the bug even
-+     on systems that don't support the Olson extension, or don't have the
-+     full zoneinfo tables installed.  */
-+  putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
-+
-+  t = mktime (&tm);
-+
-+  /* Check that the result is either a failure, or close enough
-+     to the correct answer that we can assume the discrepancy is
-+     due to leap seconds.  */
-+  return (t == (time_t) -1
-+	  || (0 < t && answer - 120 <= t && t <= answer + 120));
- }
- 
- int
-@@ -5432,12 +6219,15 @@
-      isn't worth using anyway.  */
-   alarm (60);
- 
--  for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
--    continue;
--  time_t_max--;
--  if ((time_t) -1 < 0)
--    for (time_t_min = -1; (time_t) (time_t_min * 2) < 0; time_t_min *= 2)
--      continue;
-+  for (;;)
-+    {
-+      t = (time_t_max << 1) + 1;
-+      if (t <= time_t_max)
-+	break;
-+      time_t_max = t;
-+    }
-+  time_t_min = - ((time_t) ~ (time_t) 0 == (time_t) -1) - time_t_max;
-+
-   delta = time_t_max / 997; /* a suitable prime number */
-   for (i = 0; i < N_STRINGS; i++)
-     {
-@@ -5445,18 +6235,22 @@
- 	putenv (tz_strings[i]);
- 
-       for (t = 0; t <= time_t_max - delta; t += delta)
--	mktime_test (t);
--      mktime_test ((time_t) 1);
--      mktime_test ((time_t) (60 * 60));
--      mktime_test ((time_t) (60 * 60 * 24));
--
--      for (j = 1; 0 < j; j *= 2)
--	bigtime_test (j);
--      bigtime_test (j - 1);
-+	if (! mktime_test (t))
-+	  return 1;
-+      if (! (mktime_test ((time_t) 1)
-+	     && mktime_test ((time_t) (60 * 60))
-+	     && mktime_test ((time_t) (60 * 60 * 24))))
-+	return 1;
-+
-+      for (j = 1; ; j <<= 1)
-+	if (! bigtime_test (j))
-+	  return 1;
-+	else if (INT_MAX / 2 < j)
-+	  break;
-+      if (! bigtime_test (INT_MAX))
-+	return 1;
-     }
--  irix_6_4_bug ();
--  spring_forward_gap ();
--  exit (0);
-+  return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ());
- }
- _ACEOF
- rm -f conftest$ac_exeext

diff --git a/app-shells/bash/files/bash-2.05b-destdir.patch b/app-shells/bash/files/bash-2.05b-destdir.patch
deleted file mode 100644
index a1089d293c16..000000000000
--- a/app-shells/bash/files/bash-2.05b-destdir.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-support DESTDIR install
-
---- bash-2.05b/Makefile.in
-+++ bash-2.05b/Makefile.in
-@@ -20,16 +20,16 @@
- all: .made
- 
- # Include some boilerplate Gnu makefile definitions.
--prefix = @prefix@
-+prefix = $(DESTDIR)@prefix@
- 
--exec_prefix = @exec_prefix@
--bindir = @bindir@
--libdir = @libdir@
--infodir = @infodir@
--includedir = @includedir@
-+exec_prefix = $(DESTDIR)@exec_prefix@
-+bindir = $(DESTDIR)@bindir@
-+libdir = $(DESTDIR)@libdir@
-+infodir = $(DESTDIR)@infodir@
-+includedir = $(DESTDIR)@includedir@
- datadir = @datadir@
- 
--mandir = @mandir@
-+mandir = $(DESTDIR)@mandir@
- manpfx = man
- 
- man1ext = .1

diff --git a/app-shells/bash/files/bash-2.05b-empty-herestring.patch b/app-shells/bash/files/bash-2.05b-empty-herestring.patch
deleted file mode 100644
index db868c49aea7..000000000000
--- a/app-shells/bash/files/bash-2.05b-empty-herestring.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-###################################################################
-# Added by Tavis Ormandy <taviso@gentoo.org> 01/05/2003
-# Reproduce with
-#
-#  $ xargs <<< ${EMTPY_VARIABLE}
-#  Segmentation fault.
-#
-# note: bash will still give you a "\n" with this patch, but this is
-# standard behaviour, if you need proof:
-#
-#  $ wc -l <<< ""
-###############################
-
---- bash-2.05b/redir.c
-+++ bash-2.05b/redir.c
-@@ -263,7 +263,7 @@
-   int herelen, n, e;
- 
-   herestr = expand_string_to_string (redirectee->word, 0);
--  herelen = strlen (herestr);
-+  herelen = (herestr == NULL) ? 0 : strlen (herestr);
- 
-   n = write (fd, herestr, herelen);
-   if (n == herelen)
-     {

diff --git a/app-shells/bash/files/bash-2.05b-fix-job-warning.patch b/app-shells/bash/files/bash-2.05b-fix-job-warning.patch
deleted file mode 100644
index fcec078d3d0c..000000000000
--- a/app-shells/bash/files/bash-2.05b-fix-job-warning.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-fix obvious error:
-common.c:247:5: warning: format '%s' expects a matching 'char *' argument [-Wformat=]
-
---- a/builtins/common.c
-+++ b/builtins/common.c
-@@ -244,7 +244,7 @@
-      char *s;
- {
-   if (s)
--    builtin_error ("%s: no job control");
-+    builtin_error ("%s: no job control", s);
-   else
-     builtin_error ("no job control");
- }

diff --git a/app-shells/bash/files/bash-2.05b-jobs.patch b/app-shells/bash/files/bash-2.05b-jobs.patch
deleted file mode 100644
index 4ed475eab799..000000000000
--- a/app-shells/bash/files/bash-2.05b-jobs.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-Fix using bash with post-20040808 glibc ebuilds (from fedora)
-
---- bash-2.05b/jobs.c
-+++ bash-2.05b/jobs.c
-@@ -2423,6 +2423,7 @@
-   PROCESS *child;
-   pid_t pid;
-   int call_set_current, last_stopped_job, job, children_exited, waitpid_flags;
-+  static int wcontinued_not_supported = 0;
- 
-   call_set_current = children_exited = 0;
-   last_stopped_job = NO_JOB;
-@@ -2436,7 +2437,15 @@
- 			: 0;
-       if (sigchld || block == 0)
- 	waitpid_flags |= WNOHANG;
-+    retry:
-+      if (wcontinued_not_supported)
-+	waitpid_flags &= ~WCONTINUED;
-       pid = WAITPID (-1, &status, waitpid_flags);
-+      if (pid == -1 && errno == EINVAL)
-+	{
-+	  wcontinued_not_supported = 1;
-+	  goto retry;
-+	}
- 
-       /* The check for WNOHANG is to make sure we decrement sigchld only
- 	 if it was non-zero before we called waitpid. */

diff --git a/app-shells/bash/files/bash-2.05b-parallel-build.patch b/app-shells/bash/files/bash-2.05b-parallel-build.patch
deleted file mode 100644
index 382ffd6dfd5e..000000000000
--- a/app-shells/bash/files/bash-2.05b-parallel-build.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Fix parallel make
-
-http://bugs.gentoo.org/41002
-
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -604,7 +604,7 @@
- 
- config.h:	stamp-h 
- 
--stamp-h:	config.status $(srcdir)/config.h.in $(srcdir)/config-top.h $(srcdir)/config-bot.h
-+stamp-h:	version.h config.status $(srcdir)/config.h.in $(srcdir)/config-top.h $(srcdir)/config-bot.h
- 	CONFIG_FILES= CONFIG_HEADERS=config.h $(SHELL) ./config.status
- 
- config.status:	$(srcdir)/configure

diff --git a/app-shells/bash/files/bash-2.05b-protos.patch b/app-shells/bash/files/bash-2.05b-protos.patch
deleted file mode 100644
index 2a42ced54711..000000000000
--- a/app-shells/bash/files/bash-2.05b-protos.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-move prototypes around so they show up when needed
-
---- a/externs.h
-+++ b/externs.h
-@@ -327,6 +327,9 @@
- #undef xstrchr
- extern char *xstrchr __P((const char *, int));
- 
-+/* declarations for functions defined in lib/sh/zcatfd.c */
-+extern int zcatfd __P((int, int, char *));
-+
- /* declarations for functions defined in lib/sh/zread.c */
- extern ssize_t zread __P((int, char *, size_t));
- extern ssize_t zreadintr __P((int, char *, size_t));
---- a/jobs.h
-+++ b/jobs.h
-@@ -175,6 +175,8 @@
- extern void ignore_tty_job_signals __P((void));
- extern void default_tty_job_signals __P((void));
- 
-+extern void close_pgrp_pipe __P((void));
-+
- #if defined (JOB_CONTROL)
- extern int job_control;
- #endif

diff --git a/app-shells/bash/files/bash-2.05b-rbash.patch b/app-shells/bash/files/bash-2.05b-rbash.patch
deleted file mode 100644
index 19b89ca35e2f..000000000000
--- a/app-shells/bash/files/bash-2.05b-rbash.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-Fix broken rbash functionality when used as a login shell via /etc/passwd
-
-http://bugs.gentoo.org/26854
-http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=170298
-
-Backported from bash-3.1
-
---- bash-2.05b/shell.c
-+++ bash-2.05b/shell.c
-@@ -1065,6 +1099,8 @@
-   if (restricted)
-     return 1;
-   temp = base_pathname (name);
-+  if (*temp == '-')
-+    temp++;
-   return (STREQ (temp, RESTRICTED_SHELL_NAME));
- }
- 
-@@ -1082,6 +1118,8 @@
-   char *temp;
- 
-   temp = base_pathname (name);
-+  if (*temp == '-')
-+    temp++;
-   if (restricted || (STREQ (temp, RESTRICTED_SHELL_NAME)))
-     {
-       set_var_read_only ("PATH");

diff --git a/app-shells/bash/files/bash-3.0-afs.patch b/app-shells/bash/files/bash-3.0-afs.patch
deleted file mode 100644
index f07371c39eb4..000000000000
--- a/app-shells/bash/files/bash-3.0-afs.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Ripped from Fedora
-
-- Fixed AFS support for output redirection, so that the correct errors
-  are reported for other filesystems (bug #155373).
-
-https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=155373
-
---- bash-3.0/redir.c.afs	2005-04-20 09:16:15.000000000 +0100
-+++ bash-3.0/redir.c	2005-04-20 09:16:58.000000000 +0100
-@@ -596,7 +596,9 @@
-       fd = open (filename, flags, mode);
- #if defined (AFS)
-       if ((fd < 0) && (errno == EACCES))
--	fd = open (filename, flags & ~O_CREAT, mode);
-+	if ((fd = open (filename, flags & ~O_CREAT, mode)) < 0)
-+	  /* Restore previous errno. */
-+	  errno = EACCES;
- #endif /* AFS */
-     }
- 

diff --git a/app-shells/bash/files/bash-3.0-crash.patch b/app-shells/bash/files/bash-3.0-crash.patch
deleted file mode 100644
index 38577e2a67ea..000000000000
--- a/app-shells/bash/files/bash-3.0-crash.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-> Machine Type: i686-pc-linux-gnu
-> 
-> Bash Version: 3.0
-> Patch Level: 0
-> Release Status: release
-> 
-> Description:
->         GNU bash, version 3.00.0(1)-release (i686-pc-linux-gnu)
->         (and
->         GNU bash, version 2.05b.0(1)-release (i386-redhat-linux-gnu)
-> 
->         dumps a core because of a null pointer "in make_bare_word 
->         at make_cmd.c:90" (see gdb output below)
-
-Thanks for the report.  Here's a quick fix:
-
-*** a/arrayfunc.c
---- b/arrayfunc.c
-***************
-*** 709,713 ****
-  	  return ((char *)NULL);
-  	}
-!       else if (var == 0)
-  	return ((char *)NULL);
-        else if (array_p (var) == 0)
---- 709,713 ----
-  	  return ((char *)NULL);
-  	}
-!       else if (var == 0 || value_cell (var) == 0)
-  	return ((char *)NULL);
-        else if (array_p (var) == 0)
-
-
-Chet
-
--- 
-``The lyf so short, the craft so long to lerne.'' - Chaucer
-( ``Discere est Dolere'' -- chet )
-						Live...Laugh...Love
-Chet Ramey, ITS, CWRU    chet@po.cwru.edu    http://tiswww.tis.cwru.edu/~chet/
-
-
-_______________________________________________
-Bug-bash mailing list
-Bug-bash@gnu.org
-http://lists.gnu.org/mailman/listinfo/bug-bash

diff --git a/app-shells/bash/files/bash-3.0-darwin-conn.patch b/app-shells/bash/files/bash-3.0-darwin-conn.patch
deleted file mode 100644
index f83e4c3f701d..000000000000
--- a/app-shells/bash/files/bash-3.0-darwin-conn.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Sune Foldager writes:
-On Darwin (Mac OS X), bash incorrectly assumed that it has been called over a
-network connection (such as ssh, rsh etc.), when stdin stems from the pipe()
-system call. This is because bash's heuristic code for determining if it's
-been started over a net connection is incorrect on Darwin kernels.
-
-http://bugs.gentoo.org/79124
-
---- a/lib/sh/netconn.c
-+++ b/lib/sh/netconn.c
-@@ -53,7 +53,8 @@
-   l = sizeof(sa);
-   rv = getpeername(fd, &sa, &l);
-   /* Solaris 2.5 getpeername() returns EINVAL if the fd is not a socket. */
--  return ((rv < 0 && (errno == ENOTSOCK || errno == EINVAL)) ? 0 : 1);
-+  /* Darwin 7.7.0 getpeername() returns ENOTCONN if the fd was created with pipe(). */
-+  return ((rv < 0 && (errno == ENOTSOCK || errno == ENOTCONN || errno == EINVAL)) ? 0 : 1);
- #else /* !HAVE_GETPEERNAME || SVR4_2 || __BEOS__ */
- #  if defined (SVR4) || defined (SVR4_2)
-   /* Sockets on SVR4 and SVR4.2 are character special (streams) devices. */

diff --git a/app-shells/bash/files/bash-3.0-histtimeformat.patch b/app-shells/bash/files/bash-3.0-histtimeformat.patch
deleted file mode 100644
index b910600fd896..000000000000
--- a/app-shells/bash/files/bash-3.0-histtimeformat.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-Ripped from Debian
-
-http://lists.gnu.org/archive/html/bug-bash/2004-08/msg00008.html
-
-From: Enrique Perez-Terron <enrio@online.no>
-To: bug-bash@gnu.org
-Subject: When using HISTTIMEFORMAT, the date and the command are run
-	together.
-Date: Sun, 01 Aug 2004 18:36:45 +0200
-
-Configuration Information [Automatically generated, do not change]:
-Machine: i586
-OS: linux-gnu
-Compiler: gcc
-Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i586'
--DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i586-pc-linux-gnu'
--DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale'
--DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib  
--g -O2
-uname output: Linux arabia.home.lan 2.6.6-1.435.2.3 #1 Thu Jul 1
-09:11:28 EDT 2004 i586 i586 i386 GNU/Linux
-Machine Type: i586-pc-linux-gnu
-
-# DP: Add space separating the time and the command in the
-# DP: output from the history builtin command.
-
-Bash Version: 3.0
-Patch Level: 0
-Release Status: release
-
-Description:
-	There is no space separating the time and the command in the 
-	output from the history builtin command.
-
-Repeat-By:
-	$ export HISTTIMEFORMAT=_A_format_string_
-	$ history 3
-	  997  _A_format_string_echo $BASH_VERSION
-	  998  _A_format_string_export HISTTIMEFORMAT=_A_format_string_
-	  999  _A_format_string_history 3
-
-Fix:
---- ./builtins/history.def.orig	2003-12-20 00:02:09.000000000 +0100
-+++ ./builtins/history.def	2004-08-01 18:18:02.652720102 +0200
-@@ -287,9 +287,10 @@
- 	  QUIT;
- 
- 	  timestr = (histtimefmt && *histtimefmt) ? histtime (hlist[i], histtimefmt) : (char *)NULL;
--	  printf ("%5d%c %s%s\n", i + history_base,
-+	  printf ("%5d%c %s%s%s\n", i + history_base,
- 		  histdata(i) ? '*' : ' ',
- 		  ((timestr && *timestr) ? timestr : ""),
-+		  ((timestr && *timestr) ? " " : ""),
- 		  histline(i));
- 	  i++;
- 	}

diff --git a/app-shells/bash/files/bash-3.0-jobs.patch b/app-shells/bash/files/bash-3.0-jobs.patch
deleted file mode 100644
index 72c149c71cf5..000000000000
--- a/app-shells/bash/files/bash-3.0-jobs.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-Ripped from Fedora
-
-* Wed Sep  8 2004 Tim Waugh <twaugh@redhat.com> 3.0-13
-- Check for EINVAL from waitpid() and avoid WCONTINUED in that case.
-- Fixed jobs4 test.
-
-From: 	Tim Waugh
-Subject: 	[patch] bash-3.0: avoid WCONTINUED if invalid
-Date: 	Wed, 8 Sep 2004 16:52:38 +0100
-User-agent: 	Mutt/1.4.1i
-
-Hi,
-
-GNU libc defines WCONTINUED, but (at least on Linux 2.4.x kernels)
-waitpid() returns -1 with errno set to EINVAL if WCONTINUED is
-supplied in options.
-
-Here is a patch to retry without WCONTINUED set in that case.
-
-Tim.
-
---- bash-3.0/tests/jobs4.sub
-+++ bash-3.0/tests/jobs4.sub
-@@ -18,5 +18,5 @@
- 
- wait
- 
--cat &
-+sleep 100 &
- kill -1 %% && echo i killed it || echo could not kill it
---- bash-3.0/jobs.c
-+++ bash-3.0/jobs.c
-@@ -2475,6 +2475,7 @@
-   PROCESS *child;
-   pid_t pid;
-   int call_set_current, last_stopped_job, job, children_exited, waitpid_flags;
-+  static int wcontinued_not_supported = 0;
- 
-   call_set_current = children_exited = 0;
-   last_stopped_job = NO_JOB;
-@@ -2488,7 +2489,15 @@
- 			: 0;
-       if (sigchld || block == 0)
- 	waitpid_flags |= WNOHANG;
-+    retry:
-+      if (wcontinued_not_supported)
-+	waitpid_flags &= ~WCONTINUED;
-       pid = WAITPID (-1, &status, waitpid_flags);
-+      if (pid == -1 && errno == EINVAL)
-+	{
-+	  wcontinued_not_supported = 1;
-+	  goto retry;
-+	}
- 
-       /* The check for WNOHANG is to make sure we decrement sigchld only
- 	 if it was non-zero before we called waitpid. */

diff --git a/app-shells/bash/files/bash-3.0-locale.patch b/app-shells/bash/files/bash-3.0-locale.patch
deleted file mode 100644
index ea1ef3deae36..000000000000
--- a/app-shells/bash/files/bash-3.0-locale.patch
+++ /dev/null
@@ -1,112 +0,0 @@
-Ripped from SuSe
-
-http://lists.gnu.org/archive/html/bug-bash/2004-08/msg00005.html
-
-From: schwab@suse.de
-To: bug-bash@gnu.org
-Subject: HISTTIMEFORMAT doesn't track locale changes
-Date: Sun,  1 Aug 2004 11:14:00 +0200 (CEST)
-
-Configuration Information [Automatically generated, do not change]:
-Machine: ia64
-OS: linux-gnu
-Compiler: gcc
-Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='ia64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='ia64-unknown-linux-gnu' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H  -I.  -I../bash-3.0 -I../bash-3.0/include -I../bash-3.0/lib   -O2 -g
-uname output: Linux sykes 2.6.5-22-default #1 SMP Fri Jul 2 13:43:23 UTC 2004 ia64 ia64 ia64 GNU/Linux
-Machine Type: ia64-unknown-linux-gnu
-
-Bash Version: 3.0
-Patch Level: 0
-Release Status: release
-
-Description:
-Bash doesn't use the current locale when formatting HISTTIMEFORMAT.
-
-Repeat-By:
-sykes:/tmp/bash/Build/:[0]$ locale
-LANG=de_DE.UTF-8
-LC_CTYPE="de_DE.UTF-8"
-LC_NUMERIC=POSIX
-LC_TIME=POSIX
-LC_COLLATE=POSIX
-LC_MONETARY="de_DE.UTF-8"
-LC_MESSAGES=en_US.UTF-8
-LC_PAPER="de_DE.UTF-8"
-LC_NAME="de_DE.UTF-8"
-LC_ADDRESS="de_DE.UTF-8"
-LC_TELEPHONE="de_DE.UTF-8"
-LC_MEASUREMENT="de_DE.UTF-8"
-LC_IDENTIFICATION="de_DE.UTF-8"
-LC_ALL=
-sykes:/tmp/bash/Build/:[0]$ history 1
- 1502  history 1
-sykes:/tmp/bash/Build/:[0]$ HISTTIMEFORMAT=%c
-sykes:/tmp/bash/Build/:[0]$ history 1
- 1504  Sun Aug  1 10:56:59 2004history 1
-sykes:/tmp/bash/Build/:[0]$ export LC_TIME=$LANG
-sykes:/tmp/bash/Build/:[0]$ history 1
- 1506  Sun Aug  1 10:57:24 2004history 1
-
---- bash-3.0/locale.c
-+++ bash-3.0/locale.c
-@@ -71,9 +71,10 @@ set_default_locale ()
-   textdomain (PACKAGE);
- }
- 
--/* Set default values for LC_CTYPE, LC_COLLATE, LC_MESSAGES and LC_NUMERIC
--   if they are not specified in the environment, but LC_ALL is.  This
--   should be called from main() after parsing the environment. */
-+/* Set default values for LC_CTYPE, LC_COLLATE, LC_MESSAGES, LC_NUMERIC
-+   and LC_TIME if they are not specified in the environment, but LC_ALL
-+   is.  This should be called from main() after parsing the
-+   environment. */
- void
- set_default_locale_vars ()
- {
-@@ -109,6 +110,12 @@ set_default_locale_vars ()
-     setlocale (LC_NUMERIC, lc_all);
- #  endif /* LC_NUMERIC */
- 
-+#  if defined (LC_TIME)
-+  val = get_string_value ("LC_TIME");
-+  if (val == 0 && lc_all && *lc_all)
-+    setlocale (LC_TIME, lc_all);
-+#  endif /* LC_TIME */
-+
- #endif /* HAVE_SETLOCALE */
- 
-   val = get_string_value ("TEXTDOMAIN");
-@@ -213,6 +220,13 @@ set_locale_var (var, value)
- 	return (setlocale (LC_NUMERIC, get_locale_var ("LC_NUMERIC")) != 0);
- #  endif /* LC_NUMERIC */
-     }
-+  else if (var[3] == 'T' && var[4] == 'I')	/* LC_TIME */
-+    {
-+#  if defined (LC_TIME)
-+      if (lc_all == 0 || *lc_all == '\0')
-+	return (setlocale (LC_TIME, get_locale_var ("LC_TIME")) != 0);
-+#  endif /* LC_TIME */
-+    }
- #endif /* HAVE_SETLOCALE */
- 
-   return (0);
-@@ -285,6 +299,9 @@ reset_locale_vars ()
- #  if defined (LC_NUMERIC)
-   setlocale (LC_NUMERIC, get_locale_var ("LC_NUMERIC"));
- #  endif
-+#  if defined (LC_TIME)
-+  setlocale (LC_TIME, get_locale_var ("LC_TIME"));
-+#  endif
- 
-   locale_setblanks ();  
- 
---- bash-3.0/variables.c
-+++ bash-3.0/variables.c
-@@ -3646,6 +3646,7 @@ static struct name_and_function special_
-   { "LC_CTYPE", sv_locale },
-   { "LC_MESSAGES", sv_locale },
-   { "LC_NUMERIC", sv_locale },
-+  { "LC_TIME", sv_locale },
- 
-   { "MAIL", sv_mail },
-   { "MAILCHECK", sv_mail },

diff --git a/app-shells/bash/files/bash-3.0-manpage.patch b/app-shells/bash/files/bash-3.0-manpage.patch
deleted file mode 100644
index 08e3143e5422..000000000000
--- a/app-shells/bash/files/bash-3.0-manpage.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Ripped from Fedora
-
-fix obvious display bug
-
---- bash-3.0/doc/bash.1
-+++ bash-3.0/doc/bash.1
-@@ -3929,7 +3929,7 @@
- .B SIGHUP
- to all jobs when an interactive login shell exits.
- .PP
--If \Bbash\fP is waiting for a command to complete and receives a signal
-+If \fBbash\fP is waiting for a command to complete and receives a signal
- for which a trap has been set, the trap will not be executed until
- the command completes. 
- When \fBbash\fP is waiting for an asynchronous command via the \fBwait\fP

diff --git a/app-shells/bash/files/bash-3.0-multibyteifs.patch b/app-shells/bash/files/bash-3.0-multibyteifs.patch
deleted file mode 100644
index 1e74832b638a..000000000000
--- a/app-shells/bash/files/bash-3.0-multibyteifs.patch
+++ /dev/null
@@ -1,281 +0,0 @@
-From: Tim Waugh <twaugh@redhat.com>
-To: bug-bash@gnu.org
-Subject: [patch] multibyte IFS values
-Date: Tue, 24 Aug 2004 13:34:59 +0100
-
-Hi,
-
-Here is a patch to address these problems:
-
-http://lists.gnu.org/archive/html/bug-bash/2004-07/msg00294.html
-http://lists.gnu.org/archive/html/bug-bash/2004-07/msg00296.html
-
-It works well for me at least.
-
-Tim.
-
---- bash-3.0/subst.c.multibyteifs	2004-08-20 15:22:48.366497771 +0100
-+++ bash-3.0/subst.c	2004-08-20 18:13:30.833624616 +0100
-@@ -124,7 +124,12 @@
- SHELL_VAR *ifs_var;
- char *ifs_value;
- unsigned char ifs_cmap[UCHAR_MAX + 1];
-+#if defined (HANDLE_MULTIBYTE)
-+unsigned char ifs_firstc[MB_LEN_MAX];
-+size_t ifs_firstc_len;
-+#else
- unsigned char ifs_firstc;
-+#endif
- 
- /* Extern functions and variables from different files. */
- extern int last_command_exit_value, last_command_exit_signal;
-@@ -862,8 +867,14 @@
-      char *charlist;
- {
-   register int i = *sindex;
-+  size_t slen;
-+#if defined (HANDLE_MULTIBYTE)
-+  size_t clen;
-+  wchar_t *wcharlist = NULL;
-+#endif
-   int c;
-   char *temp;
-+  DECLARE_MBSTATE;
- 
-   if (charlist[0] == '\'' && charlist[1] == '\0')
-     {
-@@ -872,18 +883,65 @@
-       return temp;
-     }
- 
--  for (i = *sindex; c = string[i]; i++)
-+  slen = strlen (string + *sindex) + *sindex;
-+  i = *sindex;
-+#if defined (HANDLE_MULTIBYTE)
-+  clen = strlen (charlist);
-+#endif
-+  while ((c = string[i]))
-     {
-+#if defined (HANDLE_MULTIBYTE)
-+      size_t mblength;
-+#endif
-+
-       if (c == CTLESC)
- 	{
--	  i++;
-+	  i += 2;
- 	  continue;
- 	}
- 
-+#if defined (HANDLE_MULTIBYTE)
-+      mblength = mblen (string + i, slen - i);
-+      if (mblength > 1)
-+	{
-+	  wchar_t wc;
-+	  size_t mblength = mbtowc (&wc, string + i, slen - i);
-+	  if (MB_INVALIDCH (mblength))
-+	    {
-+	      if (MEMBER (c, charlist))
-+		break;
-+	    }
-+	  else
-+	    {
-+	      if (!wcharlist)
-+		{
-+		  size_t len = mbstowcs (wcharlist, charlist, 0);
-+		  if (len == -1)
-+		    len = 0;
-+		  wcharlist = xmalloc (sizeof (wchar_t) * (len + 1));
-+		  mbstowcs (wcharlist, charlist, 1 + len);
-+		}
-+
-+	      if (wcschr (wcharlist, wc))
-+		{
-+		  break;
-+		}
-+	    }
-+	}
-+      else
-+#endif
-+
-       if (MEMBER (c, charlist))
- 	break;
-+
-+      ADVANCE_CHAR (string, slen, i);
-     }
- 
-+#if defined (HANDLE_MULTIBYTE)
-+  if (wcharlist)
-+    free (wcharlist);
-+#endif
-+
-   temp = substring (string, *sindex, i);
-   *sindex = i;
- 
-@@ -1456,11 +1514,36 @@
-   d2 = 0;
-   if (delims)
-     {
--      d2 = (char *)xmalloc (strlen (delims) + 1);
--      for (i = ts = 0; delims[i]; i++)
-+      size_t slength = strlen (delims);
-+#if defined (HANDLE_MULTIBYTE)
-+      size_t mblength = 1;
-+      DECLARE_MBSTATE;
-+#endif
-+
-+      d2 = (char *)xmalloc (slength + 1);
-+      i = ts = 0;
-+      while (delims[i])
- 	{
-+#if defined (HANDLE_MULTIBYTE)
-+	  mbstate_t state_bak = state;
-+	  mblength = mbrlen (delims + i, slength, &state);
-+
-+	  if (MB_INVALIDCH (mblength))
-+	    state = state_bak;
-+	  else if (mblength != 1)
-+	    {
-+	      memcpy (d2 + ts, delims + i, mblength);
-+	      ts += mblength;
-+	      i += mblength;
-+	      slength -= mblength;
-+	      continue;
-+	    }
-+#endif
-+
- 	  if (whitespace(delims[i]) == 0)
- 	    d2[ts++] = delims[i];
-+	  i++;
-+	  slength--;
- 	}
-       d2[ts] = '\0';
-     }
-@@ -1654,10 +1737,19 @@
- string_list_dollar_star (list)
-      WORD_LIST *list;
- {
-+#if defined (HANDLE_MULTIBYTE)
-+  char sep[MB_CUR_MAX + 1];
-+#else
-   char sep[2];
-+#endif
- 
-+#if defined (HANDLE_MULTIBYTE)
-+  memcpy (sep, ifs_firstc, ifs_firstc_len);
-+  sep[ifs_firstc_len] = '\0';
-+#else
-   sep[0] = ifs_firstc;
-   sep[1] = '\0';
-+#endif
- 
-   return (string_list_internal (list, sep));
- }
-@@ -1676,14 +1768,41 @@
-      WORD_LIST *list;
-      int quoted;
- {
--  char *ifs, sep[2];
-+  char *ifs;
-+#if defined (HANDLE_MULTIBYTE)
-+  char sep[MB_CUR_MAX + 1];
-+#else
-+  char sep[2];
-+#endif
-   WORD_LIST *tlist;
- 
-   /* XXX this could just be ifs = ifs_value; */
-   ifs = ifs_var ? value_cell (ifs_var) : (char *)0;
- 
-+#if defined (HANDLE_MULTIBYTE)
-+  if (ifs && *ifs)
-+    {
-+      size_t mblength = mblen (ifs, strnlen (ifs, MB_CUR_MAX));
-+      if (MB_INVALIDCH (mblength))
-+	{
-+	  sep[0] = *ifs;
-+	  sep[1] = '\0';
-+	}
-+      else
-+	{
-+	  memcpy (sep, ifs, mblength);
-+	  sep[mblength] = '\0';
-+	}
-+    }
-+  else
-+    {
-+      sep[0] = ' ';
-+      sep[1] = '\0';
-+    }
-+#else
-   sep[0] = (ifs == 0 || *ifs == 0) ? ' ' : *ifs;
-   sep[1] = '\0';
-+#endif
- 
-   tlist = ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || (ifs && *ifs == 0))
- 		? quote_list (list)
-@@ -1732,6 +1851,7 @@
-   WORD_DESC *t;
-   char *current_word, *s;
-   int sindex, sh_style_split, whitesep;
-+  size_t slen = 0;
- 
-   if (!string || !*string)
-     return ((WORD_LIST *)NULL);
-@@ -1805,7 +1925,12 @@
- 
-       /* Move past the current separator character. */
-       if (string[sindex])
--	sindex++;
-+	{
-+	  DECLARE_MBSTATE;
-+	  if (!slen)
-+	    slen = strlen (string);
-+	  ADVANCE_CHAR (string, slen, sindex);
-+	}
- 
-       /* Now skip sequences of space, tab, or newline characters if they are
- 	 in the list of separators. */
-@@ -6796,7 +6921,27 @@
-       ifs_cmap[uc] = 1;
-     }
- 
-+#if defined (HANDLE_MULTIBYTE)
-+  if (!ifs_value)
-+    {
-+      ifs_firstc[0] = '\0';
-+      ifs_firstc_len = 1;
-+    }
-+  else
-+    {
-+      size_t ifs_len = strnlen (ifs_value, MB_CUR_MAX);
-+      ifs_firstc_len = mblen (ifs_value, ifs_len);
-+      if (MB_INVALIDCH (ifs_firstc_len))
-+        {
-+          ifs_firstc[0] = '\0';
-+          ifs_firstc_len = 1;
-+        }
-+      else
-+        memcpy (ifs_firstc, ifs_value, ifs_firstc_len);
-+    }
-+#else
-   ifs_firstc = ifs_value ? *ifs_value : 0;
-+#endif
- }
- 
- char *
---- bash-3.0/subst.h.multibyteifs	2004-08-20 15:51:08.301074583 +0100
-+++ bash-3.0/subst.h	2004-08-20 15:51:39.070206473 +0100
-@@ -231,7 +231,12 @@
- extern SHELL_VAR *ifs_var;
- extern char *ifs_value;
- extern unsigned char ifs_cmap[];
-+#if defined (HANDLE_MULTIBYTE)
-+extern unsigned char ifs_firstc[];
-+extern size_t ifs_firstc_len;
-+#else
- extern unsigned char ifs_firstc;
-+#endif
- 
- /* Evaluates to 1 if C is a character in $IFS. */
- #define isifs(c)	(ifs_cmap[(unsigned char)(c)] != 0)

diff --git a/app-shells/bash/files/bash-3.0-pgrp-pipe-fix.patch b/app-shells/bash/files/bash-3.0-pgrp-pipe-fix.patch
deleted file mode 100644
index 46df6213b7a4..000000000000
--- a/app-shells/bash/files/bash-3.0-pgrp-pipe-fix.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Fix an error when using pipes and PGRP_PIPE is enabled.
-( exec 3>&1; : `echo >&3` )
-bash: 3: Bad file descriptor
-
-http://bugs.gentoo.org/92349
-
-Patch from upstream
-
-*** a/jobs.c
---- b/jobs.c
-***************
-*** 3456,3459 ****
---- 3901,3907 ----
-    stop_making_children ();
-    start_pipeline ();
-+ #if defined (PGRP_PIPE)
-+   pipe_close (pgrp_pipe);
-+ #endif
-    delete_all_jobs (0);
-    set_job_control (0);

diff --git a/app-shells/bash/files/bash-3.0-protos.patch b/app-shells/bash/files/bash-3.0-protos.patch
deleted file mode 100644
index b1337b203954..000000000000
--- a/app-shells/bash/files/bash-3.0-protos.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-move prototypes around so they show up when needed
-
---- a/externs.h
-+++ b/externs.h
-@@ -327,6 +327,9 @@
- #undef xstrchr
- extern char *xstrchr __P((const char *, int));
- 
-+/* declarations for functions defined in lib/sh/zcatfd.c */
-+extern int zcatfd __P((int, int, char *));
-+
- /* declarations for functions defined in lib/sh/zread.c */
- extern ssize_t zread __P((int, char *, size_t));
- extern ssize_t zreadintr __P((int, char *, size_t));
---- a/jobs.h
-+++ b/jobs.h
-@@ -175,6 +175,8 @@
- extern void ignore_tty_job_signals __P((void));
- extern void default_tty_job_signals __P((void));
- 
-+extern void close_pgrp_pipe __P((void));
-+
- #if defined (JOB_CONTROL)
- extern int job_control;
- #endif
---- a/general.c
-+++ b/general.c
-@@ -39,6 +39,8 @@
- #include "bashintl.h"
- 
- #include "shell.h"
-+#include "test.h"
-+
- #include <tilde/tilde.h>
- 
- #if !defined (errno)
---- a/builtins/evalfile.c
-+++ b/builtins/evalfile.c
-@@ -39,6 +39,7 @@
- #include "../flags.h"
- #include "../input.h"
- #include "../execute_cmd.h"
-+#include "../trap.h"
- 
- #if defined (HISTORY)
- #  include "../bashhist.h"
---- a/lib/glob/strmatch.c
-+++ b/lib/glob/strmatch.c
-@@ -25,9 +25,6 @@
- #include "strmatch.h"
- 
- extern int xstrmatch __P((char *, char *, int));
--#if defined (HAVE_MULTIBYTE)
--extern int internal_wstrmatch __P((wchar_t *, wchar_t *, int));
--#endif
- 
- int
- strmatch (pattern, string, flags)
---- a/lib/glob/strmatch.h
-+++ b/lib/glob/strmatch.h
-@@ -57,6 +57,7 @@
- 
- #if HANDLE_MULTIBYTE
- extern int wcsmatch __P((wchar_t *, wchar_t *, int));
-+extern int internal_wstrmatch __P((wchar_t *, wchar_t *, int));
- #endif
- 
- #endif /* _STRMATCH_H */

diff --git a/app-shells/bash/files/bash-3.0-pwd.patch b/app-shells/bash/files/bash-3.0-pwd.patch
deleted file mode 100644
index 77f0918fb4d8..000000000000
--- a/app-shells/bash/files/bash-3.0-pwd.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-Ripped from Fedora
-
-* Tue Mar 15 2005 Tim Waugh <twaugh@redhat.com> 3.0-30
-- Fix PS1 expansion crash when PWD is unset (bg #151116).
-
---- bash-3.0/parse.y.pwd	2005-03-15 14:22:36.000000000 +0000
-+++ bash-3.0/parse.y	2005-03-15 14:22:37.000000000 +0000
-@@ -4103,7 +4103,7 @@
- #define ROOT_PATH(x)	((x)[0] == '/' && (x)[1] == 0)
- #define DOUBLE_SLASH_ROOT(x)	((x)[0] == '/' && (x)[1] == '/' && (x)[2] == 0)
- 		/* Abbreviate \W as ~ if $PWD == $HOME */
--		if (c == 'W' && (((t = get_string_value ("HOME")) == 0) || STREQ (t, temp) == 0))
-+		if (c == 'W' && (((t = get_string_value ("HOME")) == 0) || STREQ (t, t_string) == 0))
- 		  {
- 		    if (ROOT_PATH (t_string) == 0 && DOUBLE_SLASH_ROOT (t_string) == 0)
- 		      {

diff --git a/app-shells/bash/files/bash-3.0-rbash.patch b/app-shells/bash/files/bash-3.0-rbash.patch
deleted file mode 100644
index e804d20f06a9..000000000000
--- a/app-shells/bash/files/bash-3.0-rbash.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Fix broken rbash functionality when used as a login shell via /etc/passwd
-
-http://bugs.gentoo.org/26854
-http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=170298
-
-Backported from bash-3.1
-
---- bash-3.0/shell.c
-+++ bash-3.0/shell.c
-@@ -1089,6 +1099,8 @@
-   if (restricted)
-     return 1;
-   temp = base_pathname (name);
-+  if (*temp == '-')
-+    temp++;
-   return (STREQ (temp, RESTRICTED_SHELL_NAME));
- }
- 

diff --git a/app-shells/bash/files/bash-3.0-read-builtin-pipe.patch b/app-shells/bash/files/bash-3.0-read-builtin-pipe.patch
deleted file mode 100644
index 0b90cc3dc2b2..000000000000
--- a/app-shells/bash/files/bash-3.0-read-builtin-pipe.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Description:
-When using 'read -u 3' or the like, and the pipe-buf already contains
-more than one line, the first line is returned, and bytes up to the next
-multiple of 128 are skipped.
-
-http://lists.gnu.org/archive/html/bug-bash/2005-03/msg00168.html
-http://lists.gnu.org/archive/html/bug-bash/2005-03/msg00173.html
-http://bugs.gentoo.org/show_bug.cgi?id=87093
-
---- a/builtins/read.def
-+++ b/builtins/read.def
-@@ -276,7 +276,7 @@
-   input_is_tty = isatty (fd);
-   if (input_is_tty == 0)
- #ifndef __CYGWIN__
--    input_is_pipe = (lseek (0, 0L, SEEK_CUR) < 0) && (errno == ESPIPE);
-+    input_is_pipe = (lseek (fd, 0L, SEEK_CUR) < 0) && (errno == ESPIPE);
- #else
-     input_is_pipe = 1;
- #endif

diff --git a/app-shells/bash/files/bash-3.0-read-memleak.patch b/app-shells/bash/files/bash-3.0-read-memleak.patch
deleted file mode 100644
index 6cb769f3af34..000000000000
--- a/app-shells/bash/files/bash-3.0-read-memleak.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Ripped from Fedora
-
-http://lists.gnu.org/archive/html/bug-bash/2005-12/msg00013.html
-https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=173283
-
---- bash-3.0/builtins/read.def
-+++ bash-3.0/builtins/read.def
-@@ -461,6 +461,7 @@
-   if (retval < 0)
-     {
-       builtin_error (_("read error: %d: %s"), fd, strerror (errno));
-+      run_unwind_frame ("read_builtin");
-       return (EXECUTION_FAILURE);
-     }
- #endif

diff --git a/app-shells/bash/files/bash-3.0-strnlen.patch b/app-shells/bash/files/bash-3.0-strnlen.patch
deleted file mode 100644
index 056e00b3de57..000000000000
--- a/app-shells/bash/files/bash-3.0-strnlen.patch
+++ /dev/null
@@ -1,175 +0,0 @@
-Add strnlen function for non-glibc systems, as one of Fedora's patches requires it.
-
---- bash-3.0/configure.in
-+++ bash-3.0/configure.in
-@@ -613,6 +613,9 @@
-   AC_LIBOBJ(vprint)
- fi
- 
-+AC_CHECK_FUNCS([strnlen])
-+AC_LIBOBJ(strnlen)
-+
- dnl signal stuff
- AC_TYPE_SIGNAL
- 
---- /dev/null
-+++ bash-3.0/lib/sh/strnlen.c
-@@ -0,0 +1,27 @@
-+/*
-+  Copyright (C) 2005 Gentoo Foundation
-+
-+  This program is free software; you can redistribute it and/or
-+  modify it under the terms of the GNU General Public License
-+  as published by the Free Software Foundation; either version 2
-+  of the License, or (at your option) any later version.
-+
-+  This program is distributed in the hope that it will be useful,
-+  but WITHOUT ANY WARRANTY; without even the implied warranty of
-+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+  GNU General Public License for more details.
-+
-+  You should have received a copy of the GNU General Public License
-+  along with this program; if not, write to the Free Software
-+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, US
-+*/
-+
-+#include <stdlib.h>
-+
-+size_t strnlen(const char *s, size_t n)
-+{
-+        int i;
-+        for (i=0; s[i] && i<n; i++)
-+                /* noop */ ;
-+        return i;
-+}
---- bash-3.0/configure
-+++ bash-3.0/configure
-@@ -10696,9 +10696,127 @@ _ACEOF
- fi
- 
- if test "$ac_cv_func_vprintf" = no && test "$ac_cv_func__doprnt" = "yes"; then
--  LIBOBJS="$LIBOBJS vprint.$ac_objext"
-+  case $LIBOBJS in
-+    "vprint.$ac_objext"   | \
-+  *" vprint.$ac_objext"   | \
-+    "vprint.$ac_objext "* | \
-+  *" vprint.$ac_objext "* ) ;;
-+  *) LIBOBJS="$LIBOBJS vprint.$ac_objext" ;;
-+esac
-+
- fi
- 
-+
-+for ac_func in strnlen
-+do
-+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-+echo "$as_me:$LINENO: checking for $ac_func" >&5
-+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-+if eval "test \"\${$as_ac_var+set}\" = set"; then
-+  echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+  cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h.  */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h.  */
-+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-+#define $ac_func innocuous_$ac_func
-+
-+/* System header to define __stub macros and hopefully few prototypes,
-+    which can conflict with char $ac_func (); below.
-+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-+    <limits.h> exists even on freestanding compilers.  */
-+
-+#ifdef __STDC__
-+# include <limits.h>
-+#else
-+# include <assert.h>
-+#endif
-+
-+#undef $ac_func
-+
-+/* Override any gcc2 internal prototype to avoid an error.  */
-+#ifdef __cplusplus
-+extern "C"
-+{
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+   builtin and then its argument prototype would still apply.  */
-+char $ac_func ();
-+/* The GNU C library defines this for functions which it implements
-+    to always fail with ENOSYS.  Some functions are actually named
-+    something starting with __ and the normal name is an alias.  */
-+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-+choke me
-+#else
-+char (*f) () = $ac_func;
-+#endif
-+#ifdef __cplusplus
-+}
-+#endif
-+
-+int
-+main ()
-+{
-+return f != $ac_func;
-+  ;
-+  return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+  (eval $ac_link) 2>conftest.er1
-+  ac_status=$?
-+  grep -v '^ *+' conftest.er1 >conftest.err
-+  rm -f conftest.er1
-+  cat conftest.err >&5
-+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+  (exit $ac_status); } &&
-+	 { ac_try='test -z "$ac_c_werror_flag"
-+			 || test ! -s conftest.err'
-+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+  (eval $ac_try) 2>&5
-+  ac_status=$?
-+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+  (exit $ac_status); }; } &&
-+	 { ac_try='test -s conftest$ac_exeext'
-+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+  (eval $ac_try) 2>&5
-+  ac_status=$?
-+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+  (exit $ac_status); }; }; then
-+  eval "$as_ac_var=yes"
-+else
-+  echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+eval "$as_ac_var=no"
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+      conftest$ac_exeext conftest.$ac_ext
-+fi
-+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-+if test `eval echo '${'$as_ac_var'}'` = yes; then
-+  cat >>confdefs.h <<_ACEOF
-+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-+_ACEOF
-+
-+fi
-+done
-+
-+case $LIBOBJS in
-+    "strnlen.$ac_objext"   | \
-+  *" strnlen.$ac_objext"   | \
-+    "strnlen.$ac_objext "* | \
-+  *" strnlen.$ac_objext "* ) ;;
-+  *) LIBOBJS="$LIBOBJS strnlen.$ac_objext" ;;
-+esac
-+
-+
- echo "$as_me:$LINENO: checking return type of signal handlers" >&5
- echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6
- if test "${ac_cv_type_signal+set}" = set; then

diff --git a/app-shells/bash/files/bash-3.0-subshell.patch b/app-shells/bash/files/bash-3.0-subshell.patch
deleted file mode 100644
index a1d7dfe7d342..000000000000
--- a/app-shells/bash/files/bash-3.0-subshell.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Ripped from Fedora which took this from upstream
-
-* Tue Nov 22 2005 Tim Waugh <twaugh@redhat.com>  3.0-37
-- Applied patch from upstream to fix parsing problem (bug #146638).
-
-http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=146638
-
---- bash-3.0/parse.y.subshell	2005-11-22 13:19:11.000000000 +0000
-+++ bash-3.0/parse.y	2005-11-22 13:19:24.000000000 +0000
-@@ -2055,14 +2055,6 @@
-   if (uc)
-     shell_input_line_index++;
- 
--  if MBTEST(uc == '\\' && remove_quoted_newline && shell_input_line[shell_input_line_index] == '\n')
--    {
--	if (SHOULD_PROMPT ())
--	  prompt_again ();
--	line_number++;
--	goto restart_read;
--    }
--
- #if defined (ALIAS) || defined (DPAREN_ARITHMETIC)
-   /* If UC is NULL, we have reached the end of the current input string.  If
-      pushed_string_list is non-empty, it's time to pop to the previous string
-@@ -2078,6 +2070,14 @@
-     }
- #endif /* ALIAS || DPAREN_ARITHMETIC */
- 
-+  if MBTEST(uc == '\\' && remove_quoted_newline && shell_input_line[shell_input_line_index] == '\n')
-+    {
-+	if (SHOULD_PROMPT ())
-+	  prompt_again ();
-+	line_number++;
-+	goto restart_read;
-+    }
-+
-   if (!uc && shell_input_line_terminator == EOF)
-     return ((shell_input_line_index != 0) ? '\n' : EOF);
- 

diff --git a/app-shells/bash/files/bash-3.0-trap-fg-signals.patch b/app-shells/bash/files/bash-3.0-trap-fg-signals.patch
deleted file mode 100644
index c7010511853f..000000000000
--- a/app-shells/bash/files/bash-3.0-trap-fg-signals.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Don't barf on handled signals inside of scripts.  Makes for nicer output.
-
-patch by Martin Schlemmer <azarah@gentoo.org>
-
---- a/jobs.c
-+++ b/jobs.c
-@@ -2893,11 +2893,11 @@
- 		}
- 	      else if (IS_FOREGROUND (job))
- 		{
--#if !defined (DONT_REPORT_SIGPIPE)
--		  if (termsig && WIFSIGNALED (s) && termsig != SIGINT)
--#else
--		  if (termsig && WIFSIGNALED (s) && termsig != SIGINT && termsig != SIGPIPE)
--#endif
-+		  if (termsig && WIFSIGNALED (s) && termsig != SIGINT &&
-+#if defined (DONT_REPORT_SIGPIPE)
-+		  termsig != SIGPIPE &&
-+#endif
-+		  signal_is_trapped (termsig) == 0)
- 		    {
- 		      fprintf (stderr, "%s", j_strsignal (termsig));
- 

diff --git a/app-shells/bash/files/bash-3.0-ulimit.patch b/app-shells/bash/files/bash-3.0-ulimit.patch
deleted file mode 100644
index 8202b95d2769..000000000000
--- a/app-shells/bash/files/bash-3.0-ulimit.patch
+++ /dev/null
@@ -1,186 +0,0 @@
-Ripped from Fedora
-
---- bash-3.0/builtins/ulimit.def
-+++ bash-3.0/builtins/ulimit.def
-@@ -34,15 +34,20 @@
-     -a	all current limits are reported
-     -c	the maximum size of core files created
-     -d	the maximum size of a process's data segment
-+    -e	the maximum scheduling priority (`nice')
-     -f	the maximum size of files created by the shell
-+    -i	the maximum number of pending signals
-     -l	the maximum size a process may lock into memory
-     -m	the maximum resident set size
-     -n	the maximum number of open file descriptors
-     -p	the pipe buffer size
-+    -q	the maximum number of bytes in POSIX message queues
-+    -r	the maximum rt priority
-     -s	the maximum stack size
-     -t	the maximum amount of cpu time in seconds
-     -u	the maximum number of user processes
-     -v	the size of virtual memory 
-+    -x	the maximum number of file locks
- 
- If LIMIT is given, it is the new value of the specified resource;
- the special LIMIT values `soft', `hard', and `unlimited' stand for
-@@ -199,7 +204,13 @@
- #ifdef RLIMIT_DATA
-   { 'd',	RLIMIT_DATA,  1024,	"data seg size",	"kbytes" },
- #endif
-+#ifdef RLIMIT_NICE
-+  { 'e',	RLIMIT_NICE, 1,		"max nice",		(char *)NULL},
-+#endif /* RLIMIT_NICE */
-   { 'f',	RLIMIT_FILESIZE, 1024,	"file size",		"blocks" },
-+#ifdef RLIMIT_SIGPENDING
-+  { 'i',	RLIMIT_SIGPENDING, 1,	"pending signals",	(char *)NULL},
-+#endif
- #ifdef RLIMIT_MEMLOCK
-   { 'l',	RLIMIT_MEMLOCK, 1024,	"max locked memory",	"kbytes" },
- #endif
-@@ -208,6 +219,12 @@
- #endif /* RLIMIT_RSS */
-   { 'n',	RLIMIT_OPENFILES, 1,	"open files",		(char *)NULL},
-   { 'p',	RLIMIT_PIPESIZE, 512,	"pipe size", 		"512 bytes" },
-+#ifdef RLIMIT_MSGQUEUE
-+  { 'q',	RLIMIT_MSGQUEUE, 1,	"POSIX message queues",	"bytes" },
-+#endif
-+#ifdef RLIMIT_RTPRIO
-+  { 'r',	RLIMIT_RTPRIO, 1,	"max rt priority",	(char *)NULL},
-+#endif /* RLIMIT_RTPRIO */
- #ifdef RLIMIT_STACK
-   { 's',	RLIMIT_STACK, 1024,	"stack size",		"kbytes" },
- #endif
-@@ -221,6 +238,9 @@
- #ifdef RLIMIT_SWAP
-   { 'w',	RLIMIT_SWAP,	1024,	"swap size",		"kbytes" },
- #endif
-+#ifdef RLIMIT_LOCKS
-+  { 'x',	RLIMIT_LOCKS, 1,	"file locks",		(char *)NULL},
-+#endif
-   { -1, -1, -1, (char *)NULL, (char *)NULL }
- };
- #define NCMDS	(sizeof(limits) / sizeof(limits[0]))
-@@ -647,11 +667,11 @@
- 
-   for (i = 0; limits[i].option > 0; i++)
-     {
--      if (get_limit (i, &softlim, &hardlim) < 0)
-+      if (get_limit (i, &softlim, &hardlim) == 0)
-+	printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1);
-+      else if (errno != EINVAL)
- 	builtin_error ("%s: cannot get limit: %s", limits[i].description,
- 						   strerror (errno));
--      else
--	printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1);
-     }
- }
- 
-@@ -670,7 +690,7 @@
-       else
-         sprintf (unitstr, "(-%c) ", limits[limind].option);
- 
--      printf ("%-18s %16s", limits[limind].description, unitstr);
-+      printf ("%-20s %16s", limits[limind].description, unitstr);
-     }
-   if (curlim == RLIM_INFINITY)
-     puts ("unlimited");
---- bash-3.0/doc/bashref.texi
-+++ bash-3.0/doc/bashref.texi
-@@ -3793,7 +3793,7 @@
- @item ulimit
- @btindex ulimit
- @example
--ulimit [-acdflmnpstuvSH] [@var{limit}]
-+ulimit [-acdeflmnpqrstuvxSH] [@var{limit}]
- @end example
- @code{ulimit} provides control over the resources available to processes
- started by the shell, on systems that allow such control.  If an
-@@ -3814,9 +3814,15 @@
- @item -d
- The maximum size of a process's data segment.
- 
-+@item -e
-+The maximum scheduling priority.
-+
- @item -f
- The maximum size of files created by the shell.
- 
-+@item -i
-+The maximum number of pending signals.
-+
- @item -l
- The maximum size that may be locked into memory.
- 
-@@ -3829,6 +3835,12 @@
- @item -p
- The pipe buffer size.
- 
-+@item -q
-+The maximum number of bytes in POSIX message queues.
-+
-+@item -r
-+The maximum RT priority.
-+
- @item -s
- The maximum stack size.
- 
-@@ -3841,6 +3853,9 @@
- @item -v
- The maximum amount of virtual memory available to the process.
- 
-+@item -x
-+The maximum amount of file locks.
-+
- @end table
- 
- If @var{limit} is given, it is the new value of the specified resource;
---- bash-3.0/doc/bash.1
-+++ bash-3.0/doc/bash.1
-@@ -8362,7 +8362,7 @@
- returns true if any of the arguments are found, false if
- none are found.
- .TP
--\fBulimit\fP [\fB\-SHacdflmnpstuv\fP [\fIlimit\fP]]
-+\fBulimit\fP [\fB\-SHacdefilmnpqrstuvx\fP [\fIlimit\fP]]
- Provides control over the resources available to the shell and to
- processes started by it, on systems that allow such control.
- The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is
-@@ -8398,9 +8398,15 @@
- .B \-d
- The maximum size of a process's data segment
- .TP
-+.B \-e
-+The maximum scheduling priority (`nice')
-+.TP
- .B \-f
- The maximum size of files created by the shell
- .TP
-+.B \-i
-+The maximum number of pending signals
-+.TP
- .B \-l
- The maximum size that may be locked into memory
- .TP
-@@ -8414,6 +8420,12 @@
- .B \-p
- The pipe size in 512-byte blocks (this may not be set)
- .TP
-+.B \-q
-+The maximum number of bytes in POSIX message queues
-+.TP
-+.B \-r
-+The maximum rt priority
-+.TP
- .B \-s
- The maximum stack size
- .TP
-@@ -8425,6 +8437,9 @@
- .TP
- .B \-v
- The maximum amount of virtual memory available to the shell
-+.TP
-+.B \-x
-+The maximum number of file locks
- .PD
- .PP
- If

diff --git a/app-shells/bash/files/bash-3.0-volatile-command.patch b/app-shells/bash/files/bash-3.0-volatile-command.patch
deleted file mode 100644
index 87b9f25ffc21..000000000000
--- a/app-shells/bash/files/bash-3.0-volatile-command.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-Ripped from Debian
-
-# DP: current_command must be declared volatile to prevent assignments from
-#     being optimized away as dead code.  In reality, the use of setjmp/longjmp
-#     makes it not dead code at all.
-
---- a/eval.c
-+++ b/eval.c
-@@ -63,7 +63,7 @@
- reader_loop ()
- {
-   int our_indirection_level;
--  COMMAND *current_command = (COMMAND *)NULL;
-+  COMMAND * volatile current_command = (COMMAND *)NULL;
- 
-   USE_VAR(current_command);

diff --git a/app-shells/bash/files/bash-3.1-dev-fd-buffer-overflow.patch b/app-shells/bash/files/bash-3.1-dev-fd-buffer-overflow.patch
deleted file mode 100644
index 9d08856e5b00..000000000000
--- a/app-shells/bash/files/bash-3.1-dev-fd-buffer-overflow.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-https://bugs.gentoo.org/431850
-
-this is a backport of the upstream bash42-033 patch for bash 3.1/3.0/2.05
-
---- a/test.c
-+++ b/test.c
-@@ -194,7 +194,8 @@
-      trailing slash.  Make sure /dev/fd/xx really uses DEV_FD_PREFIX/xx.
-      On most systems, with the notable exception of linux, this is
-      effectively a no-op. */
--      char pbuf[32];
-+      static char *pbuf = 0;
-+      pbuf = xrealloc (pbuf, sizeof (DEV_FD_PREFIX) + strlen (path + 8));
-       strcpy (pbuf, DEV_FD_PREFIX);
-       strcat (pbuf, path + 8);
-       return (stat (pbuf, finfo));

diff --git a/app-shells/bash/files/bash-3.1-dev-fd-test-as-user.patch b/app-shells/bash/files/bash-3.1-dev-fd-test-as-user.patch
deleted file mode 100644
index 80a4b0a1a034..000000000000
--- a/app-shells/bash/files/bash-3.1-dev-fd-test-as-user.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Fix the /dev/fd test when running as a non root user
-after logging in as a root user #131875
-
---- bash-3.1/configure
-+++ bash-3.1/configure
-@@ -23098,7 +23098,7 @@
-   if test -d /dev/fd  && test -r /dev/fd/0 < /dev/null; then
- # check for systems like FreeBSD 5 that only provide /dev/fd/[012]
-    exec 3<&0
--   if test -r /dev/fd/3; then
-+   if test -e /dev/fd/3; then
-      bash_cv_dev_fd=standard
-    else
-      bash_cv_dev_fd=absent

diff --git a/app-shells/bash/files/bash-3.1-fix-dash-login-shell.patch b/app-shells/bash/files/bash-3.1-fix-dash-login-shell.patch
deleted file mode 100644
index 3ca7518fbb50..000000000000
--- a/app-shells/bash/files/bash-3.1-fix-dash-login-shell.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-http://lists.gnu.org/archive/html/bug-bash/2006-01/msg00054.html
-http://bugs.gentoo.org/118257
-
-Date: Fri, 13 Jan 2006 17:11:10 +0000
-From: Tim Waugh <twaugh@redhat.com>
-To: bug-bash@gnu.org
-Subject: [patch] fix 'exec -l /bin/bash'
-
-Configuration Information [Automatically generated, do not change]:
-Machine: i386
-OS: linux-gnu
-Compiler: i386-redhat-linux-gcc
-Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables
-uname output: Linux gene.surrey.redhat.com 2.6.13-1.1597_FC5 #1 Thu Oct 6 02:13:06 EDT 2005 i686 i686 i386 GNU/Linux
-Machine Type: i386-redhat-linux-gnu
-
-Bash Version: 3.1
-Patch Level: 1
-Release Status: release
-
-Description:
-	If bash has argv[0] as '-/bin/bash' it does not become a login
-	shell.
-
-Repeat-By:
-	exec -l /bin/bash
-	shopt
-
-Fix:
-
---- bash-3.1/shell.c.login	2006-01-13 16:52:14.000000000 +0000
-+++ bash-3.1/shell.c	2006-01-13 16:52:15.000000000 +0000
-@@ -1543,9 +1543,10 @@
-      any startup files; just try to be more like /bin/sh. */
-   shell_name = argv0 ? base_pathname (argv0) : PROGRAM;
- 
--  if (*shell_name == '-')
-+  if (argv0 && *argv0 == '-')
-     {
--      shell_name++;
-+      if (*shell_name == '-')
-+        shell_name++;
-       login_shell++;
-     }
- 
-
-
-_______________________________________________
-Bug-bash mailing list
-Bug-bash@gnu.org
-http://lists.gnu.org/mailman/listinfo/bug-bash
-

diff --git a/app-shells/bash/files/bash-3.1-protos.patch b/app-shells/bash/files/bash-3.1-protos.patch
deleted file mode 100644
index 32ae8cfe91a3..000000000000
--- a/app-shells/bash/files/bash-3.1-protos.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-move prototypes around so they show up when needed
-
---- a/jobs.h
-+++ b/jobs.h
-@@ -182,6 +182,7 @@
- 
- extern int count_all_jobs __P((void));
- 
-+extern void close_pgrp_pipe __P((void));
- extern void terminate_current_pipeline __P((void));
- extern void terminate_stopped_jobs __P((void));
- extern void hangup_all_jobs __P((void));
---- a/lib/glob/strmatch.c
-+++ b/lib/glob/strmatch.c
-@@ -25,9 +25,6 @@
- #include "strmatch.h"
- 
- extern int xstrmatch __P((char *, char *, int));
--#if defined (HAVE_MULTIBYTE)
--extern int internal_wstrmatch __P((wchar_t *, wchar_t *, int));
--#endif
- 
- int
- strmatch (pattern, string, flags)
---- a/lib/glob/strmatch.h
-+++ b/lib/glob/strmatch.h
-@@ -57,6 +57,7 @@
- 
- #if HANDLE_MULTIBYTE
- extern int wcsmatch __P((wchar_t *, wchar_t *, int));
-+extern int internal_wstrmatch __P((wchar_t *, wchar_t *, int));
- #endif
- 
- #endif /* _STRMATCH_H */
---- a/builtins/echo.def
-+++ b/builtins/echo.def
-@@ -31,6 +31,8 @@
- #include <stdio.h>
- #include "../shell.h"
- 
-+#include "common.h"
-+
- $BUILTIN echo
- $FUNCTION echo_builtin
- $DEPENDS_ON V9_ECHO
---- a/lib/sh/winsize.c
-+++ b/lib/sh/winsize.c
-@@ -55,6 +55,7 @@
- #if defined (READLINE)
- extern void rl_set_screen_size __P((int, int));
- #endif
-+extern void sh_set_lines_and_columns __P((int, int));
- 
- void
- get_new_window_size (from_sig, rp, cp)
---- a/support/bashversion.c
-+++ b/support/bashversion.c
-@@ -47,6 +47,9 @@
- extern char *dist_version;
- extern int patch_level;
- 
-+extern char *shell_version_string __P((void));
-+extern void show_shell_version __P((int));
-+
- char *shell_name = "bash";
- char *progname;
- 

diff --git a/app-shells/bash/files/bash-3.1-ulimit.patch b/app-shells/bash/files/bash-3.1-ulimit.patch
deleted file mode 100644
index 8c2474825cf1..000000000000
--- a/app-shells/bash/files/bash-3.1-ulimit.patch
+++ /dev/null
@@ -1,122 +0,0 @@
-Ripped from Fedora
-
-Add support for RLIMIT_NICE/RLIMIT_RTPRIO and add missing documentation
-for many other options
-
---- a/builtins/ulimit.def
-+++ b/builtins/ulimit.def
-@@ -24,7 +24,7 @@
- $BUILTIN ulimit
- $FUNCTION ulimit_builtin
- $DEPENDS_ON !_MINIX
--$SHORT_DOC ulimit [-SHacdfilmnpqstuvx] [limit]
-+$SHORT_DOC ulimit [-SHacdefilmnpqrstuvx] [limit]
- Ulimit provides control over the resources available to processes
- started by the shell, on systems that allow such control.  If an
- option is given, it is interpreted as follows:
-@@ -34,18 +34,20 @@
-     -a	all current limits are reported
-     -c	the maximum size of core files created
-     -d	the maximum size of a process's data segment
-+    -e	the maximum scheduling priority (`nice')
-     -f	the maximum size of files created by the shell
--    -i  the maximum number of pending signals
-+    -i	the maximum number of pending signals
-     -l	the maximum size a process may lock into memory
-     -m	the maximum resident set size
-     -n	the maximum number of open file descriptors
-     -p	the pipe buffer size
--    -q  the maximum number of bytes in POSIX message queues
-+    -q	the maximum number of bytes in POSIX message queues
-+    -r	the maximum rt priority
-     -s	the maximum stack size
-     -t	the maximum amount of cpu time in seconds
-     -u	the maximum number of user processes
-     -v	the size of virtual memory
--    -x  the maximum number of file locks
-+    -x	the maximum number of file locks
- 
- If LIMIT is given, it is the new value of the specified resource;
- the special LIMIT values `soft', `hard', and `unlimited' stand for
-@@ -202,6 +204,9 @@
- #ifdef RLIMIT_DATA
-   { 'd',	RLIMIT_DATA,  1024,	"data seg size",	"kbytes" },
- #endif
-+#ifdef RLIMIT_NICE
-+  { 'e',	RLIMIT_NICE,  1,	"max nice",	(char *)NULL},
-+#endif
-   { 'f',	RLIMIT_FILESIZE, 1024,	"file size",		"blocks" },
- #ifdef RLIMIT_SIGPENDING
-   { 'i',	RLIMIT_SIGPENDING, 1,	"pending signals",	(char *)NULL },
-@@ -217,6 +222,9 @@
- #ifdef RLIMIT_MSGQUEUE
-   { 'q',	RLIMIT_MSGQUEUE, 1,	"POSIX message queues",	"bytes" },
- #endif
-+#ifdef RLIMIT_RTPRIO
-+  { 'r',	RLIMIT_RTPRIO, 1,	"max rt priority",	(char *)NULL},
-+#endif
- #ifdef RLIMIT_STACK
-   { 's',	RLIMIT_STACK, 1024,	"stack size",		"kbytes" },
- #endif
---- a/doc/bashref.texi
-+++ b/doc/bashref.texi
-@@ -3833,7 +3833,7 @@
- @item ulimit
- @btindex ulimit
- @example
--ulimit [-acdfilmnpqstuvxSH] [@var{limit}]
-+ulimit [-acdefilmnpqrstuvxSH] [@var{limit}]
- @end example
- @code{ulimit} provides control over the resources available to processes
- started by the shell, on systems that allow such control.  If an
-@@ -3854,6 +3854,9 @@
- @item -d
- The maximum size of a process's data segment.
- 
-+@item -e
-+The maximum scheduling priority.
-+
- @item -f
- The maximum size of files created by the shell.
- 
-@@ -3875,6 +3878,9 @@
- @item -q
- The maximum number of bytes in POSIX message queues.
- 
-+@item -r
-+The maximum RT priority.
-+
- @item -s
- The maximum stack size.
- 
---- a/doc/bash.1
-+++ b/doc/bash.1
-@@ -8490,7 +8490,7 @@
- returns true if any of the arguments are found, false if
- none are found.
- .TP
--\fBulimit\fP [\fB\-SHacdfilmnpqstuvx\fP [\fIlimit\fP]]
-+\fBulimit\fP [\fB\-SHacdefilmnpqrstuvx\fP [\fIlimit\fP]]
- Provides control over the resources available to the shell and to
- processes started by it, on systems that allow such control.
- The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is
-@@ -8526,6 +8526,9 @@
- .B \-d
- The maximum size of a process's data segment
- .TP
-+.B \-e
-+The maximum scheduling priority (`nice')
-+.TP
- .B \-f
- The maximum size of files created by the shell
- .TP
-@@ -8548,6 +8551,9 @@
- .B \-q
- The maximum number of bytes in POSIX message queues
- .TP
-+.B \-r
-+The maximum rt priority
-+.TP
- .B \-s
- The maximum stack size
- .TP

diff --git a/app-shells/bash/files/bash-3.2-dev-fd-test-as-user.patch b/app-shells/bash/files/bash-3.2-dev-fd-test-as-user.patch
deleted file mode 100644
index 8aca7767161d..000000000000
--- a/app-shells/bash/files/bash-3.2-dev-fd-test-as-user.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff -ur bash-3.2.orig/aclocal.m4 bash-3.2/aclocal.m4
---- bash-3.2.orig/aclocal.m4    2006-12-30 20:00:31 +0000
-+++ bash-3.2/aclocal.m4 2006-12-30 20:02:02 +0000
-@@ -1544,7 +1544,8 @@
- if test -d /dev/fd  && test -r /dev/fd/0 < /dev/null; then
- # check for systems like FreeBSD 5 that only provide /dev/fd/[012]
-    exec 3</dev/null
--   if test -r /dev/fd/3; then
-+   # bash test builtin always works here, so we use the test binary
-+   if `which test || echo test` -e /dev/fd/3; then
-      bash_cv_dev_fd=standard
-    else
-      bash_cv_dev_fd=absent
-diff -ur bash-3.2.orig/configure bash-3.2/configure
---- bash-3.2.orig/configure     2006-12-30 20:03:24 +0000
-+++ bash-3.2/configure  2006-12-30 20:01:50 +0000
-@@ -27179,7 +27179,8 @@
- if test -d /dev/fd  && test -r /dev/fd/0 < /dev/null; then
- # check for systems like FreeBSD 5 that only provide /dev/fd/[012]
-    exec 3</dev/null
--   if test -r /dev/fd/3; then
-+   # bash test builtin always works here, so we use the test binary
-+   if `which test || echo test` -e /dev/fd/3; then
-      bash_cv_dev_fd=standard
-    else
-      bash_cv_dev_fd=absent

diff --git a/app-shells/bash/files/bash-3.2-ldflags-for-build.patch b/app-shells/bash/files/bash-3.2-ldflags-for-build.patch
deleted file mode 100644
index 2dc1dd6ef790..000000000000
--- a/app-shells/bash/files/bash-3.2-ldflags-for-build.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-http://bugs.gentoo.org/211947
-
-fix from Takashi YOSHII: dont use target ldflags for build apps
-
---- bash/builtins/Makefile.in
-+++ bash/builtins/Makefile.in
-@@ -63,7 +63,7 @@
- 
- LIBS = @LIBS@
- LDFLAGS = @LDFLAGS@ $(LOCAL_LDFLAGS) $(CFLAGS)
--LDFLAGS_FOR_BUILD = $(LDFLAGS)
-+LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD)
- LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
- #LIBS_FOR_BUILD = @LIBS_FOR_BUILD@
- LIBS_FOR_BUILD = $(LIBS)
---- bash/support/Makefile.in
-+++ bash/support/Makefile.in
-@@ -58,7 +58,7 @@
- 
- LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
- LDFLAGS = @LDFLAGS@ $(LOCAL_LDFLAGS) $(CFLAGS)
--LDFLAGS_FOR_BUILD = $(LDFLAGS)
-+LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD)
- 
- INCLUDES = -I${BUILD_DIR} -I${topdir}
- 
---- bash/Makefile.in
-+++ bash/Makefile.in
-@@ -143,7 +143,7 @@
- CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
- 
- LDFLAGS = @LDFLAGS@ $(STATIC_LD) $(LOCAL_LDFLAGS) $(PROFILE_FLAGS) $(CFLAGS)
--LDFLAGS_FOR_BUILD = $(LDFLAGS)
-+LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD)
- 
- INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC)
- 

diff --git a/app-shells/bash/files/bash-3.2-loadables.patch b/app-shells/bash/files/bash-3.2-loadables.patch
deleted file mode 100644
index cd0e1e1a8e9e..000000000000
--- a/app-shells/bash/files/bash-3.2-loadables.patch
+++ /dev/null
@@ -1,239 +0,0 @@
---- bash-3.2/examples/loadables/basename.c
-+++ bash-3.2/examples/loadables/basename.c
-@@ -11,6 +11,7 @@
- #include <stdio.h>
- #include "builtins.h"
- #include "shell.h"
-+#include "common.h"
- 
- basename_builtin (list)
-      WORD_LIST *list;
---- bash-3.2/examples/loadables/cut.c
-+++ bash-3.2/examples/loadables/cut.c
-@@ -63,6 +63,7 @@
- #include "builtins.h"
- #include "shell.h"
- #include "bashgetopt.h"
-+#include "common.h"
- 
- #if !defined (errno)
- extern int	errno;
---- bash-3.2/examples/loadables/dirname.c
-+++ bash-3.2/examples/loadables/dirname.c
-@@ -11,6 +11,7 @@
- #include <stdio.h>
- #include "builtins.h"
- #include "shell.h"
-+#include "common.h"
- 
- dirname_builtin (list)
-      WORD_LIST *list;
---- bash-3.2/examples/loadables/finfo.c
-+++ bash-3.2/examples/loadables/finfo.c
-@@ -12,6 +12,7 @@
- #include <pwd.h>
- #include <grp.h>
- #include <errno.h>
-+#include <time.h>
- 
- #include "bashansi.h"
- #include "shell.h"
---- bash-3.2/examples/loadables/head.c
-+++ bash-3.2/examples/loadables/head.c
-@@ -21,6 +21,7 @@
- #include "builtins.h"
- #include "shell.h"
- #include "bashgetopt.h"
-+#include "common.h"
- 
- #if !defined (errno)
- extern int errno;
---- bash-3.2/examples/loadables/ln.c
-+++ bash-3.2/examples/loadables/ln.c
-@@ -18,6 +18,7 @@
- #include "builtins.h"
- #include "shell.h"
- #include "bashgetopt.h"
-+#include "common.h"
- 
- #if !defined (errno)
- extern int errno;
---- bash-3.2/examples/loadables/logname.c
-+++ bash-3.2/examples/loadables/logname.c
-@@ -11,6 +11,7 @@
- 
- #include "builtins.h"
- #include "shell.h"
-+#include "common.h"
- 
- #if !defined (errno)
- extern int errno;
---- bash-3.2/examples/loadables/mkdir.c
-+++ bash-3.2/examples/loadables/mkdir.c
-@@ -16,6 +16,7 @@
- #include "builtins.h"
- #include "shell.h"
- #include "bashgetopt.h"
-+#include "common.h"
- 
- #if !defined (errno)
- extern int errno;
---- bash-3.2/examples/loadables/pathchk.c
-+++ bash-3.2/examples/loadables/pathchk.c
-@@ -45,6 +45,7 @@
- #include "stdc.h"
- #include "bashgetopt.h"
- #include "maxpath.h"
-+#include "common.h"
- 
- #if !defined (errno)
- extern int errno;
---- bash-3.2/examples/loadables/print.c
-+++ bash-3.2/examples/loadables/print.c
-@@ -17,6 +17,8 @@
- #include "builtins.h"
- #include "stdc.h"
- #include "bashgetopt.h"
-+#include "builtext.h"
-+#include "common.h"
- 
- #if !defined (errno)
- extern int errno;
---- bash-3.2/examples/loadables/printenv.c
-+++ bash-3.2/examples/loadables/printenv.c
-@@ -11,6 +11,7 @@
- #include "builtins.h"
- #include "shell.h"
- #include "bashgetopt.h"
-+#include "common.h"
- 
- extern char **export_env;
- 
---- bash-3.2/examples/loadables/push.c
-+++ bash-3.2/examples/loadables/push.c
-@@ -11,6 +11,7 @@
- #include "shell.h"
- #include "jobs.h"
- #include "bashgetopt.h"
-+#include "common.h"
- 
- #ifndef errno
- extern int errno;
---- bash-3.2/examples/loadables/realpath.c
-+++ bash-3.2/examples/loadables/realpath.c
-@@ -34,6 +34,7 @@
- #include "builtins.h"
- #include "shell.h"
- #include "bashgetopt.h"
-+#include "common.h"
- 
- #ifndef errno
- extern int	errno;
-@@ -67,14 +68,14 @@
- 			vflag = 1;
- 			break;
- 		default:
--			usage();
-+			builtin_usage();
- 		}
- 	}
- 
- 	list = loptend;
- 
- 	if (list == 0)
--		usage();
-+		builtin_usage();
- 
- 	for (es = EXECUTION_SUCCESS; list; list = list->next) {
- 		p = list->word->word;
---- bash-3.2/examples/loadables/rmdir.c
-+++ bash-3.2/examples/loadables/rmdir.c
-@@ -8,6 +8,7 @@
- #include <errno.h>
- #include "builtins.h"
- #include "shell.h"
-+#include "common.h"
- 
- #if !defined (errno)
- extern int errno;
---- bash-3.2/examples/loadables/sleep.c
-+++ bash-3.2/examples/loadables/sleep.c
-@@ -27,6 +27,7 @@
- 
- #include "shell.h"
- #include "builtins.h"
-+#include "common.h"
- 
- #define RETURN(x) \
- 	do { \
---- bash-3.2/examples/loadables/tee.c
-+++ bash-3.2/examples/loadables/tee.c
-@@ -22,6 +22,7 @@
- #include "builtins.h"
- #include "shell.h"
- #include "bashgetopt.h"
-+#include "common.h"
- 
- #if !defined (errno)
- extern int errno;
---- bash-3.2/examples/loadables/truefalse.c
-+++ bash-3.2/examples/loadables/truefalse.c
-@@ -1,5 +1,7 @@
- /* true and false builtins */
- 
-+#include <config.h>
-+
- #include "bashtypes.h"
- #include "shell.h"
- #include "builtins.h"
---- bash-3.2/examples/loadables/tty.c
-+++ bash-3.2/examples/loadables/tty.c
-@@ -8,6 +8,7 @@
- #include "builtins.h"
- #include "shell.h"
- #include "bashgetopt.h"
-+#include "common.h"
- 
- extern char *ttyname ();
- 
---- bash-3.2/examples/loadables/uname.c
-+++ bash-3.2/examples/loadables/uname.c
-@@ -27,6 +27,7 @@
- #include "builtins.h"
- #include "shell.h"
- #include "bashgetopt.h"
-+#include "common.h"
- 
- #define FLAG_SYSNAME	0x01	/* -s */
- #define FLAG_NODENAME	0x02	/* -n */
---- bash-3.2/examples/loadables/unlink.c
-+++ bash-3.2/examples/loadables/unlink.c
-@@ -14,6 +14,7 @@
- 
- #include "builtins.h"
- #include "shell.h"
-+#include "common.h"
- 
- #ifndef errno
- extern int errno;
---- bash-3.2/examples/loadables/whoami.c
-+++ bash-3.2/examples/loadables/whoami.c
-@@ -8,6 +8,7 @@
- #include "builtins.h"
- #include "shell.h"
- #include "bashgetopt.h"
-+#include "common.h"
- 
- whoami_builtin (list)
-      WORD_LIST *list;
---- bash-3.2/examples/loadables/Makefile.in
-+++ bash-3.2/examples/loadables/Makefile.in
-@@ -68,7 +68,7 @@
- SHOBJ_CC = @SHOBJ_CC@
- SHOBJ_CFLAGS = @SHOBJ_CFLAGS@
- SHOBJ_LD = @SHOBJ_LD@
--SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@
-+SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@ @LDFLAGS@
- SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@
- SHOBJ_LIBS = @SHOBJ_LIBS@
- SHOBJ_STATUS = @SHOBJ_STATUS@

diff --git a/app-shells/bash/files/bash-3.2-process-subst.patch b/app-shells/bash/files/bash-3.2-process-subst.patch
deleted file mode 100644
index 94877c62b316..000000000000
--- a/app-shells/bash/files/bash-3.2-process-subst.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-Fix process substitution on BSD
-
---- a/execute_cmd.c
-+++ b/execute_cmd.c
-@@ -2672,6 +2672,7 @@
- 
- 	  do_piping (pipe_in, pipe_out);
- 
-+	  subshell_environment = 0;
- 	  if (async)
- 	    subshell_environment |= SUBSHELL_ASYNC;
- 	  if (pipe_in != NO_PIPE || pipe_out != NO_PIPE)

diff --git a/app-shells/bash/files/bash-3.2-protos.patch b/app-shells/bash/files/bash-3.2-protos.patch
deleted file mode 100644
index 0a9ea74adfb0..000000000000
--- a/app-shells/bash/files/bash-3.2-protos.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-move prototypes around so they show up when needed
-
---- a/jobs.h
-+++ b/jobs.h
-@@ -182,6 +182,7 @@
- 
- extern int count_all_jobs __P((void));
- 
-+extern void close_pgrp_pipe __P((void));
- extern void terminate_current_pipeline __P((void));
- extern void terminate_stopped_jobs __P((void));
- extern void hangup_all_jobs __P((void));
---- a/lib/glob/strmatch.c
-+++ b/lib/glob/strmatch.c
-@@ -25,9 +25,6 @@
- #include "strmatch.h"
- 
- extern int xstrmatch __P((char *, char *, int));
--#if defined (HAVE_MULTIBYTE)
--extern int internal_wstrmatch __P((wchar_t *, wchar_t *, int));
--#endif
- 
- int
- strmatch (pattern, string, flags)
---- a/lib/glob/strmatch.h
-+++ b/lib/glob/strmatch.h
-@@ -57,6 +57,7 @@
- 
- #if HANDLE_MULTIBYTE
- extern int wcsmatch __P((wchar_t *, wchar_t *, int));
-+extern int internal_wstrmatch __P((wchar_t *, wchar_t *, int));
- #endif
- 
- #endif /* _STRMATCH_H */
---- a/quit.h
-+++ b/quit.h
-@@ -21,6 +21,8 @@
- #if !defined (_QUIT_H_)
- #define _QUIT_H_
- 
-+#include "sig.h"
-+
- /* Non-zero means SIGINT has already ocurred. */
- extern volatile int interrupt_state;
- extern volatile int terminating_signal;
---- a/support/bashversion.c
-+++ b/support/bashversion.c
-@@ -47,6 +47,9 @@
- extern char *dist_version;
- extern int patch_level;
- 
-+extern char *shell_version_string __P((void));
-+extern void show_shell_version __P((int));
-+
- char *shell_name = "bash";
- char *progname;
- 

diff --git a/app-shells/bash/files/bash-3.2-session-leader.patch b/app-shells/bash/files/bash-3.2-session-leader.patch
deleted file mode 100644
index 2e9286f34d40..000000000000
--- a/app-shells/bash/files/bash-3.2-session-leader.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-http://bugs.gentoo.org/231775
-http://lists.gnu.org/archive/html/bug-bash/2008-07/msg00010.html
-
-A parent bash shell sometimes will set the session leader tty (using tcsetpgrp)
-back to itself, taking control away from a child bash shell, due to a race
-condition.  A result is that the child can then not then execute some commands
-(like stty) from its init script (e.g. .bashrc).  The result I (and others)
-have seen is that the bash shell will hang while reading the init script.
-
-*** a/jobs.c
---- b/jobs.c
-***************
-*** 266,269 ****
---- 266,270 ----
-  static void set_job_running __P((int));
-  static void setjstatus __P((int));
-+ static int maybe_give_terminal_to __P((pid_t, pid_t, int));
-  static void mark_all_jobs_as_dead __P((void));
-  static void mark_dead_jobs_as_notified __P((int));
-***************
-*** 637,641 ****
-  	   */
-  	  if (job_control && newjob->pgrp && (subshell_environment&SUBSHELL_ASYNC) == 0)
-! 	    give_terminal_to (newjob->pgrp, 0);
-  	}
-      }
---- 638,642 ----
-  	   */
-  	  if (job_control && newjob->pgrp && (subshell_environment&SUBSHELL_ASYNC) == 0)
-! 	    maybe_give_terminal_to (shell_pgrp, newjob->pgrp, 0);
-  	}
-      }
-***************
-*** 3833,3836 ****
---- 3834,3863 ----
-  }
-  
-+ /* Give terminal to NPGRP iff it's currently owned by OPGRP.  FLAGS are the
-+    flags to pass to give_terminal_to(). */
-+ static int
-+ maybe_give_terminal_to (opgrp, npgrp, flags)
-+      pid_t opgrp, npgrp;
-+      int flags;
-+ {
-+   int tpgrp;
-+ 
-+   tpgrp = tcgetpgrp (shell_tty);
-+   if (tpgrp == npgrp)
-+     {
-+       terminal_pgrp = npgrp;
-+       return 0;
-+     }
-+   else if (tpgrp != opgrp)
-+     {
-+ #if defined (DEBUG)
-+       internal_warning ("maybe_give_terminal_to: terminal pgrp == %d shell pgrp = %d", tpgrp, opgrp);
-+ #endif
-+       return -1;
-+     }
-+   else
-+     return (give_terminal_to (npgrp, flags));     
-+ }
-+ 
-  /* Clear out any jobs in the job array.  This is intended to be used by
-     children of the shell, who should not have any job structures as baggage

diff --git a/app-shells/bash/files/bash-3.2-ulimit.patch b/app-shells/bash/files/bash-3.2-ulimit.patch
deleted file mode 100644
index 19ea7e6e5e33..000000000000
--- a/app-shells/bash/files/bash-3.2-ulimit.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-add missing docs for -e and -r options
-
---- a/builtins/ulimit.def
-+++ b/builtins/ulimit.def
-@@ -24,7 +24,7 @@
- $BUILTIN ulimit
- $FUNCTION ulimit_builtin
- $DEPENDS_ON !_MINIX
--$SHORT_DOC ulimit [-SHacdfilmnpqstuvx] [limit]
-+$SHORT_DOC ulimit [-SHacdefilmnpqrstuvx] [limit]
- Ulimit provides control over the resources available to processes
- started by the shell, on systems that allow such control.  If an
- option is given, it is interpreted as follows:

diff --git a/app-shells/bash/files/bash-4.0-configure.patch b/app-shells/bash/files/bash-4.0-configure.patch
deleted file mode 100644
index e57cb6b2402e..000000000000
--- a/app-shells/bash/files/bash-4.0-configure.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-http://bugs.gentoo.org/304901
-
-newer patches touch configure ... we don't want autotool deps, so update
-the files ourselves
-
---- bash-4.0/configure
-+++ bash-4.0/configure
-@@ -5806,7 +5806,7 @@
- 		# static version specified as -llibname to override the
- 		# dynamic version
- 		case "${host_os}" in
--		darwin[89]*)	READLINE_LIB='${READLINE_LIBRARY}' ;;
-+ 		darwin[89]*|darwin10*) READLINE_LIB='${READLINE_LIBRARY}' ;;
- 		*)		READLINE_LIB=-lreadline ;;
- 		esac
- 	fi
-@@ -5847,7 +5847,7 @@
- 		# static version specified as -llibname to override the
- 		# dynamic version
- 		case "${host_os}" in
--		darwin[89]*)	HISTORY_LIB='${HISTORY_LIBRARY}' ;;
-+ 		darwin[89]*|darwin10*) HISTORY_LIB='${HISTORY_LIBRARY}' ;;
- 		*)		HISTORY_LIB=-lhistory ;;
- 		esac
- 	fi

diff --git a/app-shells/bash/files/bash-4.0-ldflags-for-build.patch b/app-shells/bash/files/bash-4.0-ldflags-for-build.patch
deleted file mode 100644
index 089264f97e40..000000000000
--- a/app-shells/bash/files/bash-4.0-ldflags-for-build.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-http://bugs.gentoo.org/211947
-
-fix from Takashi YOSHII: dont use target ldflags for build apps
-
---- bash/Makefile.in
-+++ bash/Makefile.in
-@@ -143,7 +143,7 @@
- CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
- 
- LDFLAGS = @LDFLAGS@ $(STATIC_LD) $(LOCAL_LDFLAGS) $(PROFILE_FLAGS) $(CFLAGS)
--LDFLAGS_FOR_BUILD = $(LDFLAGS)
-+LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD)
- 
- INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC)
- 

diff --git a/app-shells/bash/files/bash-4.0-negative-return.patch b/app-shells/bash/files/bash-4.0-negative-return.patch
deleted file mode 100644
index 32affa18c179..000000000000
--- a/app-shells/bash/files/bash-4.0-negative-return.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-http://lists.gnu.org/archive/html/bug-bash/2009-02/msg00158.html
-
-make `return` accept negative values again
-
-hack by me (vapier@gentoo.org) ... i'm not familiar with bash source code, so
-i imagine this isn't the best way to do it ...
-
---- bash/builtins/return.def
-+++ bash/builtins/return.def
-@@ -60,9 +60,23 @@
- return_builtin (list)
-      WORD_LIST *list;
- {
-+	int neg = 0;
-+	if (list && list->word && list->word->word) {
-+		char *word = list->word->word;
-+		if (*word == '-') {
-+			while (*word++)
-+				if (!isdigit(*word))
-+					break;
-+			if (!*word)
-+				neg = 1;
-+		}
-+	}
-+
-+	if (!neg) {
-   if (no_options (list))
-     return (EX_USAGE);
-   list = loptend;	/* skip over possible `--' */
-+	}
- 
-   return_catch_value = get_exitstat (list);
- 

diff --git a/app-shells/bash/files/bash-4.0-parallel-build.patch b/app-shells/bash/files/bash-4.0-parallel-build.patch
deleted file mode 100644
index 8384e2c9019c..000000000000
--- a/app-shells/bash/files/bash-4.0-parallel-build.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-http://bugs.gentoo.org/267613
-
-add missing dep
-
-patch by Peter Alfredsen
-
---- bash-4.0/Makefile.in
-+++ bash-4.0/Makefile.in
-@@ -1022,10 +1022,11 @@
- subst.o: flags.h jobs.h siglist.h execute_cmd.h ${BASHINCDIR}/filecntl.h trap.h pathexp.h
- subst.o: mailcheck.h input.h $(DEFSRC)/getopt.h $(DEFSRC)/common.h
- subst.o: bashline.h bashhist.h ${GLOB_LIBSRC}/strmatch.h
- subst.o: ${BASHINCDIR}/chartypes.h
- subst.o: ${BASHINCDIR}/shmbutil.h
-+subst.o: ${DEFDIR}/builtext.h
- test.o: bashtypes.h ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h
- test.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
- test.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
- test.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
- test.o: make_cmd.h subst.h sig.h pathnames.h externs.h test.h
-
-http://bugs.gentoo.org/284633
-
-and another ...
-
---- bash-4.0/lib/sh/Makefile.in
-+++ bash-4.0/lib/sh/Makefile.in
-@@ -136,6 +136,9 @@
- ${BUILD_DIR}/version.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile
- 	-( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} version.h )
- 
-+${BUILD_DIR}/pathnames.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile
-+	-( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} pathnames.h )
-+
- # rules for losing makes, like SunOS
- casemod.o: casemod.c
- clktck.o: clktck.c
-
-http://bugs.gentoo.org/300143
-
-and another ...
-
---- bash-4.0/lib/glob/Makefile.in
-+++ bash-4.0/lib/glob/Makefile.in
-@@ -119,6 +119,11 @@
- mostlyclean: clean
- 	-( cd doc && $(MAKE) $(MFLAGS) $@ )
- 
-+# Dependencies
-+
-+${BUILD_DIR}/pathnames.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile
-+	-( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} pathnames.h )
-+
- ######################################################################
- #								     #
- #  Dependencies for the object files which make up this library.     #
-@@ -136,7 +141,7 @@
- strmatch.o: $(BUILD_DIR)/config.h
- strmatch.o: $(BASHINCDIR)/stdc.h
- 
--glob.o: $(BUILD_DIR)/config.h
-+glob.o: $(BUILD_DIR)/config.h $(topdir)/shell.h $(BUILD_DIR)/pathnames.h
- glob.o: $(topdir)/bashtypes.h $(BASHINCDIR)/ansi_stdlib.h $(topdir)/bashansi.h
- glob.o: $(BASHINCDIR)/posixstat.h $(BASHINCDIR)/memalloc.h
- glob.o: strmatch.h glob.h

diff --git a/app-shells/bash/files/bash-4.1-fbsd-eaccess.patch b/app-shells/bash/files/bash-4.1-fbsd-eaccess.patch
deleted file mode 100644
index 3c5b5dd98d9b..000000000000
--- a/app-shells/bash/files/bash-4.1-fbsd-eaccess.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-Bash built-in test fails to correctly report exeuctable status for non-
-executable files when run by root on FreeBSD.
-
-See http://bugs.gentoo.org/303411
-
-Patch from Johan Hattne <johan.hattne@utsuthwestern.edu>
---- a/lib/sh/eaccess.c.orig
-+++ b/lib/sh/eaccess.c
-@@ -198,11 +198,19 @@
-      char *path;
-      int mode;
- {
-+  struct stat s;
-+  int ret;
-+
-   if (path_is_devfd (path))
-     return (sh_stataccess (path, mode));
- 
- #if defined (HAVE_EACCESS)		/* FreeBSD */
--  return (eaccess (path, mode));
-+  if (stat (path, &s) != 0)
-+    return (-1);
-+  ret = eaccess (path, mode);
-+  if (mode == X_OK && ret == 0 && !S_ISDIR(s.st_mode) && geteuid() == 0)
-+    return ((s.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0 ? -1 : 0);
-+  return (ret);
- #elif defined (EFF_ONLY_OK)		/* SVR4(?), SVR4.2 */
-   return access (path, mode|EFF_ONLY_OK);
- #else

diff --git a/app-shells/bash/files/bash-4.1-parallel-build.patch b/app-shells/bash/files/bash-4.1-parallel-build.patch
deleted file mode 100644
index ae44bcc0cf6d..000000000000
--- a/app-shells/bash/files/bash-4.1-parallel-build.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- bash-4.1/lib/glob/Makefile.in
-+++ bash-4.1/lib/glob/Makefile.in
-@@ -119,6 +119,11 @@
- mostlyclean: clean
- 	-( cd doc && $(MAKE) $(MFLAGS) $@ )
- 
-+# Dependencies
-+
-+${BUILD_DIR}/pathnames.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile
-+	-( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} pathnames.h )
-+
- ######################################################################
- #								     #
- #  Dependencies for the object files which make up this library.     #
-@@ -136,7 +141,7 @@
- strmatch.o: $(BUILD_DIR)/config.h
- strmatch.o: $(BASHINCDIR)/stdc.h
- 
--glob.o: $(BUILD_DIR)/config.h
-+glob.o: $(BUILD_DIR)/config.h $(topdir)/shell.h $(BUILD_DIR)/pathnames.h
- glob.o: $(topdir)/bashtypes.h $(BASHINCDIR)/ansi_stdlib.h $(topdir)/bashansi.h
- glob.o: $(BASHINCDIR)/posixstat.h $(BASHINCDIR)/memalloc.h
- glob.o: strmatch.h glob.h

diff --git a/app-shells/bash/files/bash-4.2-dev-fd-buffer-overflow.patch b/app-shells/bash/files/bash-4.2-dev-fd-buffer-overflow.patch
deleted file mode 100644
index d50c269b7e71..000000000000
--- a/app-shells/bash/files/bash-4.2-dev-fd-buffer-overflow.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-https://bugs.gentoo.org/431850
-
-this is a minor tweak to the upstream patch to also apply to bash 4.1/4.0/3.2
-
-			     BASH PATCH REPORT
-			     =================
-
-Bash-Release:	4.2
-Patch-ID:	bash42-033
-
-Bug-Reported-by:	David Leverton <levertond@googlemail.com>
-Bug-Reference-ID:	<4FCCE737.1060603@googlemail.com>
-Bug-Reference-URL:
-
-Bug-Description:
-
-Bash uses a static buffer when expanding the /dev/fd prefix for the test
-and conditional commands, among other uses, when it should use a dynamic
-buffer to avoid buffer overflow.
-
-Patch (apply with `patch -p0'):
-
-*** bash-4.2/lib/sh/eaccess.c
---- bash-4.2/lib/sh/eaccess.c
-***************
-*** 83,86 ****
---- 83,88 ----
-       struct stat *finfo;
-  {
-+   static char *pbuf = 0;
-+ 
-    if (*path == '\0')
-      {
-***************
-*** 107,111 ****
-       On most systems, with the notable exception of linux, this is
-       effectively a no-op. */
-!       char pbuf[32];
-        strcpy (pbuf, DEV_FD_PREFIX);
-        strcat (pbuf, path + 8);
---- 109,113 ----
-       On most systems, with the notable exception of linux, this is
-       effectively a no-op. */
-!       pbuf = xrealloc (pbuf, sizeof (DEV_FD_PREFIX) + strlen (path + 8));
-        strcpy (pbuf, DEV_FD_PREFIX);
-        strcat (pbuf, path + 8);

diff --git a/app-shells/bash/files/bash-4.2-execute-job-control.patch b/app-shells/bash/files/bash-4.2-execute-job-control.patch
deleted file mode 100644
index 82b73e5157ca..000000000000
--- a/app-shells/bash/files/bash-4.2-execute-job-control.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-fix build when job control is disabled
-
-http://lists.gnu.org/archive/html/bug-bash/2011-06/msg00110.html
-http://lists.gnu.org/archive/html/bug-bash/2011-07/msg00057.html
-http://lists.gnu.org/archive/html/bug-bash/2011-09/msg00039.html
-https://bugs.gentoo.org/383237
-
-should be fixed in next release of bash ...
-
---- a/execute_cmd.c
-+++ b/execute_cmd.c
-@@ -2202,7 +2202,11 @@
-   /* If the `lastpipe' option is set with shopt, and job control is not
-      enabled, execute the last element of non-async pipelines in the
-      current shell environment. */
--  if (lastpipe_opt && job_control == 0 && asynchronous == 0 && pipe_out == NO_PIPE && prev > 0)
-+  if (lastpipe_opt && 
-+#if defined(JOB_CONTROL)
-+		job_control == 0 && 
-+#endif
-+		asynchronous == 0 && pipe_out == NO_PIPE && prev > 0)
-     {
-       lstdin = move_to_high_fd (0, 0, 255);
-       if (lstdin > 0)

diff --git a/app-shells/bash/files/bash-4.2-no-readline.patch b/app-shells/bash/files/bash-4.2-no-readline.patch
deleted file mode 100644
index 14eb6bf421e9..000000000000
--- a/app-shells/bash/files/bash-4.2-no-readline.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-fix building when readline is disabled
-
---- a/builtins/complete.def
-+++ b/builtins/complete.def
-@@ -49,6 +49,8 @@ $END
- 
- #include <config.h>
- 
-+#ifdef READLINE
-+
- #include <stdio.h>
- 
- #include "../bashtypes.h"
-@@ -867,3 +869,5 @@ compopt_builtin (list)
- 
-   return (ret);
- }
-+
-+#endif

diff --git a/app-shells/bash/files/bash-4.2-parallel-build.patch b/app-shells/bash/files/bash-4.2-parallel-build.patch
deleted file mode 100644
index ab2de86206a3..000000000000
--- a/app-shells/bash/files/bash-4.2-parallel-build.patch
+++ /dev/null
@@ -1,106 +0,0 @@
-https://lists.gnu.org/archive/html/bug-bash/2011-10/msg00036.html
-
-the current yacc rules allow multiple runs to generate the same files.  usually
-this doesn't come up as the generated files are shipped in the tarball, but
-when you modify parse.y (applying a patch or developing or whatever), you can
-hit this problem.
-
-simple way of showing this:
-	make -j y.tab.{c,h}
-a correct system would not show the yacc parser running twice :)
-
-simple patch is to have the .h file depend on the .c file, and have the .h file
-itself issue a dummy rule (to avoid make thinking things changed).
-
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -579,16 +579,17 @@
- 
- # old rules
- GRAM_H = parser-built
--y.tab.o: y.tab.c ${GRAM_H} command.h ${BASHINCDIR}/stdc.h input.h
-+y.tab.o: y.tab.h y.tab.c ${GRAM_H} command.h ${BASHINCDIR}/stdc.h input.h
- ${GRAM_H}:	y.tab.h
- 	@-if test -f y.tab.h ; then \
- 		cmp -s $@ y.tab.h 2>/dev/null || cp -p y.tab.h $@; \
- 	fi
--y.tab.c y.tab.h: parse.y
-+y.tab.c: parse.y
- #	-if test -f y.tab.h; then mv -f y.tab.h old-y.tab.h; fi
- 	$(YACC) -d $(srcdir)/parse.y
- 	touch parser-built
- #	-if cmp -s old-y.tab.h y.tab.h; then mv old-y.tab.h y.tab.h; else cp -p y.tab.h ${GRAM_H}; fi
-+y.tab.h: y.tab.c ; @true
- 
- # experimental new rules - work with GNU make but not BSD (or OSF) make
- #y.tab.o: y.tab.c y.tab.h
-
-https://lists.gnu.org/archive/html/bug-bash/2011-10/msg00037.html
-
-the current code generates a bunch of local libraries in subdirs and then
-links bash against that.  those subdirs sometimes need version.h.  so they
-have a rule to change back up to the parent dir and build version.h (which is
-fine).  the trouble is that the top level objects and the subdirs are allowed
-to build in parallel, so it's possible for multiple children to see that
-version.h is not available and that it needs to be created, so they all do.
-
-there is even more trouble is that version.h depends on all the top level
-sources, some of which are compiled (like syntax.c).  so these parallel
-children all kick off a job to generate syntax.c which in turn requires the
-mksyntax helper executable.  obviously multiple processes rm-ing, compiling,
-and linking the same files quickly falls apart.
-
-so tweak the subdirs to all depend on the .build target which in turn depends
-on all of these top level files being generated.  now the subdirs won't try and
-recursively enter the top level.
-
-(noticed by David James)
-
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -597,6 +598,11 @@
- #	$(YACC) -d $(srcdir)/parse.y
- #	-if cmp -s old-y.tab.h y.tab.h; then mv old-y.tab.h y.tab.h; fi
- 
-+# Subdirs will often times want version.h, so they'll change back up to
-+# the top level and try to create it.  This causes parallel build issues
-+# so just force top level sanity before we descend.
-+$(LIBDEP): .build
-+
- $(READLINE_LIBRARY): config.h $(READLINE_SOURCE)
- 	@echo making $@ in ${RL_LIBDIR}
- 	@( { test "${RL_LIBDIR}" = "${libdir}" && exit 0; } || \
-
-http://lists.gnu.org/archive/html/bug-bash/2011-10/msg00107.html
-
-the top level Makefile will recurse into the defdir for multiple targets
-(libbuiltins.a, common.o, bashgetopt.o, builtext.h), and since these do
-not have any declared interdependencies, parallel makes will recurse into
-the subdir and build the respective targets.
-
-nothing depends on common.o or bashgetopt.o, so those targets don't get
-used normally.  this leaves libbuiltins.a and builtext.h.  at a glance,
-this shouldn't be a big deal, but when we look closer, there's a subtle
-failure lurking.
-
-most of the objects in the defdir need to be generated which means they
-need to build+link the local mkbuiltins helper.  the builtext.h header
-also needs to be generated by the mkbuiltins helper.  so when the top
-level launches a child for libbuiltins.a and a child for builtext.h, we
-can hit a race condition where the two try to generate mkbuiltins, and
-the build randomly fails.
-
-so update libbuiltins.a to depend on builtext.h.  this should be fairly
-simple since it's only a single target.
-
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -674,7 +674,7 @@
- 	$(RM) $@
- 	./mksyntax$(EXEEXT) -o $@
- 
--$(BUILTINS_LIBRARY): $(BUILTIN_DEFS) $(BUILTIN_C_SRC) config.h ${BASHINCDIR}/memalloc.h version.h
-+$(BUILTINS_LIBRARY): $(BUILTIN_DEFS) $(BUILTIN_C_SRC) config.h ${BASHINCDIR}/memalloc.h ${DEFDIR}/builtext.h version.h
- 	@(cd $(DEFDIR) && $(MAKE) $(MFLAGS) DEBUG=${DEBUG} libbuiltins.a ) || exit 1
- 
- # these require special rules to circumvent make builtin rules

diff --git a/app-shells/bash/files/bash-4.2-read-retry.patch b/app-shells/bash/files/bash-4.2-read-retry.patch
deleted file mode 100644
index 44903c68afe1..000000000000
--- a/app-shells/bash/files/bash-4.2-read-retry.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-https://bugs.gentoo.org/447810
-
-fix from upstream to workaround broken BSD kernels
-
-commit 208fdb509e072977ae7a621e916dfcd32c76047d
-Author: Chet Ramey <chet@caleb.ins.cwru.edu>
-Date:   Mon Mar 4 08:09:29 2013 -0500
-
-    commit bash-20130201 snapshot
-
-diff --git a/redir.c b/redir.c
-index d7da2f3..aa3d16d 100644
---- a/redir.c
-+++ b/redir.c
-@@ -650,7 +650,7 @@ redir_open (filename, flags, mode, ri)
-      int flags, mode;
-      enum r_instruction ri;
- {
--  int fd, r;
-+  int fd, r, e;
- 
-   r = find_string_in_alist (filename, _redir_special_filenames, 1);
-   if (r >= 0)
-@@ -666,7 +666,16 @@ redir_open (filename, flags, mode, ri)
-     }
-   else
-     {
--      fd = open (filename, flags, mode);
-+      do
-+	{
-+	  fd = open (filename, flags, mode);
-+	  e = errno;
-+	  if (fd < 0 && e == EINTR)
-+	    QUIT;
-+	  errno = e;
-+	}
-+      while (fd < 0 && errno == EINTR);
-+
- #if defined (AFS)
-       if ((fd < 0) && (errno == EACCES))
- 	{

diff --git a/app-shells/bash/files/bash-4.2-speed-up-read-N.patch b/app-shells/bash/files/bash-4.2-speed-up-read-N.patch
deleted file mode 100644
index b96ad0c887e1..000000000000
--- a/app-shells/bash/files/bash-4.2-speed-up-read-N.patch
+++ /dev/null
@@ -1,112 +0,0 @@
-http://lists.gnu.org/archive/html/bug-bash/2012-11/msg00034.html
-
-From 530d4988afd68ea9d2cf1b0267d4dc821d0d204f Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <vapier@gentoo.org>
-Date: Mon, 19 Nov 2012 17:58:51 -0500
-Subject: [PATCH] bash: speed up `read -N`
-
-Rather than using 1 byte reads, use the existing cache read logic.
-This could be sped up more, but this change is not as invasive and
-should (hopefully) be fairly safe.
-
-Signed-off-by: Mike Frysinger <vapier@gentoo.org>
----
- builtins/read.def | 21 ++++++++++++++++-----
- externs.h         |  1 +
- lib/sh/zread.c    | 15 +++++++++++++--
- 3 files changed, 30 insertions(+), 7 deletions(-)
-
-diff --git a/builtins/read.def b/builtins/read.def
-index e32dec7..81a1b3f 100644
---- a/builtins/read.def
-+++ b/builtins/read.def
-@@ -457,7 +457,10 @@ read_builtin (list)
-   interrupt_immediately++;
-   terminate_immediately++;
- 
--  unbuffered_read = (nchars > 0) || (delim != '\n') || input_is_pipe;
-+  if ((nchars > 0) && !input_is_tty && ignore_delim)
-+    unbuffered_read = 2;
-+  else if ((nchars > 0) || (delim != '\n') || input_is_pipe)
-+    unbuffered_read = 1;
- 
-   if (prompt && edit == 0)
-     {
-@@ -505,10 +508,18 @@ read_builtin (list)
- 	  print_ps2 = 0;
- 	}
- 
--      if (unbuffered_read)
--	retval = zread (fd, &c, 1);
--      else
--	retval = zreadc (fd, &c);
-+      switch (unbuffered_read)
-+	{
-+	case 2:
-+	  retval = zreadcn (fd, &c, nchars - nr);
-+	  break;
-+	case 1:
-+	  retval = zread (fd, &c, 1);
-+	  break;
-+	default:
-+	  retval = zreadc (fd, &c);
-+	  break;
-+	}
- 
-       if (retval <= 0)
- 	{
-diff --git a/externs.h b/externs.h
-index 09244fa..a5ad645 100644
---- a/externs.h
-+++ b/externs.h
-@@ -479,6 +479,7 @@ extern ssize_t zread __P((int, char *, size_t));
- extern ssize_t zreadretry __P((int, char *, size_t));
- extern ssize_t zreadintr __P((int, char *, size_t));
- extern ssize_t zreadc __P((int, char *));
-+extern ssize_t zreadcn __P((int, char *, int));
- extern ssize_t zreadcintr __P((int, char *));
- extern void zreset __P((void));
- extern void zsyncfd __P((int));
-diff --git a/lib/sh/zread.c b/lib/sh/zread.c
-index 5db21a9..af7d02b 100644
---- a/lib/sh/zread.c
-+++ b/lib/sh/zread.c
-@@ -101,15 +101,18 @@ static char lbuf[128];
- static size_t lind, lused;
- 
- ssize_t
--zreadc (fd, cp)
-+zreadcn (fd, cp, len)
-      int fd;
-      char *cp;
-+     int len;
- {
-   ssize_t nr;
- 
-   if (lind == lused || lused == 0)
-     {
--      nr = zread (fd, lbuf, sizeof (lbuf));
-+      if (len > sizeof (lbuf))
-+	len = sizeof (lbuf);
-+      nr = zread (fd, lbuf, len);
-       lind = 0;
-       if (nr <= 0)
- 	{
-@@ -123,6 +126,14 @@ zreadc (fd, cp)
-   return 1;
- }
- 
-+ssize_t
-+zreadc (fd, cp)
-+     int fd;
-+     char *cp;
-+{
-+  return zreadcn (fd, cp, sizeof (lbuf));
-+}
-+
- /* Don't mix calls to zreadc and zreadcintr in the same function, since they
-    use the same local buffer. */
- ssize_t
--- 
-1.7.12.4
-

diff --git a/app-shells/bash/files/bash-4.3-arrayfunc.patch b/app-shells/bash/files/bash-4.3-arrayfunc.patch
deleted file mode 100644
index f44d18478454..000000000000
--- a/app-shells/bash/files/bash-4.3-arrayfunc.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-http://lists.gnu.org/archive/html/bug-bash/2014-11/msg00178.html
-
-diff --git a/arrayfunc.c b/arrayfunc.c
-index 804e6da..0f900aa 100644
---- a/arrayfunc.c
-+++ b/arrayfunc.c
-@@ -498,7 +498,7 @@ assign_compound_array_list (var, nlist, flags)
- 
-   for (list = nlist; list; list = list->next)
-     {
--      iflags = flags;
-+      iflags = (flags & ~ASS_APPEND);
-       w = list->word->word;
- 
-       /* We have a word of the form [ind]=value */

diff --git a/app-shells/bash/files/bash-4.3-mapfile-improper-array-name-validation.patch b/app-shells/bash/files/bash-4.3-mapfile-improper-array-name-validation.patch
deleted file mode 100644
index 20bf340fdbd3..000000000000
--- a/app-shells/bash/files/bash-4.3-mapfile-improper-array-name-validation.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-http://lists.gnu.org/archive/html/bug-bash/2014-11/msg00097.html
-
---- bash-4.3/builtins/mapfile.def
-+++ bash-4.3/builtins/mapfile.def
-@@ -339,7 +339,7 @@
-   else
-     array_name = list->word->word;
-   
--  if (legal_identifier (array_name) == 0 && valid_array_reference (array_name) == 0)
-+  if (legal_identifier (array_name) == 0)
-     {
-       sh_invalidid (array_name);
-       return (EXECUTION_FAILURE);

diff --git a/app-shells/bash/files/bash-4.3-protos.patch b/app-shells/bash/files/bash-4.3-protos.patch
deleted file mode 100644
index 7af84ff707f3..000000000000
--- a/app-shells/bash/files/bash-4.3-protos.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/redir.c
-+++ b/redir.c
-@@ -31,6 +31,7 @@
- #endif
- #include "filecntl.h"
- #include "posixstat.h"
-+#include "trap.h"
- 
- #if defined (HAVE_UNISTD_H)
- #  include <unistd.h>

diff --git a/app-shells/bash/files/bash-4.4-jobs_overflow.patch b/app-shells/bash/files/bash-4.4-jobs_overflow.patch
deleted file mode 100644
index 8753d62ec6c1..000000000000
--- a/app-shells/bash/files/bash-4.4-jobs_overflow.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-https://lists.gnu.org/archive/html/bug-bash/2017-12/msg00025.html
-https://bugs.gentoo.org/644720
-
---- bash-4.4/jobs.c
-+++ bash-4.4/jobs.c
-@@ -750,7 +750,7 @@
-   else
-     nsize = bgpids.nalloc;
- 
--  while (nsize < js.c_childmax)
-+  while (nsize < (ps_index_t)js.c_childmax)
-     nsize *= 2;
- 
-   if (bgpids.nalloc < js.c_childmax)

diff --git a/app-shells/bash/files/bash-4.4-popd-offset-overflow.patch b/app-shells/bash/files/bash-4.4-popd-offset-overflow.patch
deleted file mode 100644
index cc6b622eca34..000000000000
--- a/app-shells/bash/files/bash-4.4-popd-offset-overflow.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-https://bugs.gentoo.org/600174
-https://lists.gnu.org/archive/html/bug-bash/2016-11/msg00099.html
-
-*** bash-4.4/builtins/pushd.def
---- bash-4.4/builtins/pushd.def
-***************
-*** 366,370 ****
-      }
-  
-!   if (which > directory_list_offset || (directory_list_offset == 0 && which == 0))
-      {
-        pushd_error (directory_list_offset, which_word ? which_word : "");
---- 366,370 ----
-      }
-  
-!   if (which > directory_list_offset || (which < -directory_list_offset) || (directory_list_offset == 0 && which == 0))
-      {
-        pushd_error (directory_list_offset, which_word ? which_word : "");
-***************
-*** 388,391 ****
---- 388,396 ----
-  	 of the list into place. */
-        i = (direction == '+') ? directory_list_offset - which : which;
-+       if (i < 0 || i > directory_list_offset)
-+ 	{
-+ 	  pushd_error (directory_list_offset, which_word ? which_word : "");
-+ 	  return (EXECUTION_FAILURE);
-+ 	}
-        free (pushd_directory_list[i]);
-        directory_list_offset--;

diff --git a/app-shells/bash/files/bash-4.4-set-SHOBJ_STATUS.patch b/app-shells/bash/files/bash-4.4-set-SHOBJ_STATUS.patch
deleted file mode 100644
index 96302c2030e7..000000000000
--- a/app-shells/bash/files/bash-4.4-set-SHOBJ_STATUS.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-http://lists.gnu.org/archive/html/bug-bash/2016-10/msg00004.html
-
---- a/configure
-+++ b/configure
-@@ -16124,6 +16124,9 @@ $as_echo_n "checking shared object configuration for loadable builtins... " >&6;
- 
- 	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHOBJ_STATUS" >&5
- $as_echo "$SHOBJ_STATUS" >&6; }
-+else
-+	SHOBJ_STATUS=unsupported
-+
- fi
- 
- # try to create a directory tree if the source is elsewhere

diff --git a/app-shells/bash/files/bash-4.x-deferred-heredocs.patch b/app-shells/bash/files/bash-4.x-deferred-heredocs.patch
deleted file mode 100644
index c6a6de44d36d..000000000000
--- a/app-shells/bash/files/bash-4.x-deferred-heredocs.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-http://bugs.gentoo.org/310197
-http://lists.gnu.org/archive/html/bug-bash/2010-03/msg00063.html
-
-fix heredocs handling in `set` output
-
-*** bash-4.1/print_cmd.c
---- bash-4.1/print_cmd.c
-***************
-*** 114,117 ****
---- 114,123 ----
-  #define CHECK_XTRACE_FP	xtrace_fp = (xtrace_fp ? xtrace_fp : stderr)
-  
-+ #define PRINT_DEFERRED_HEREDOCS(x) \
-+   do { \
-+     if (deferred_heredocs) \
-+       print_deferred_heredocs (x); \
-+   } while (0)
-+ 
-  /* Non-zero means the stuff being printed is inside of a function def. */
-  static int inside_function_def;
-***************
-*** 561,571 ****
-  {
-    print_for_command_head (for_command);
-- 
-    cprintf (";");
-    newline ("do\n");
-    indentation += indentation_amount;
-    make_command_string_internal (for_command->action);
-    semicolon ();
-    indentation -= indentation_amount;
-    newline ("done");
-  }
---- 566,578 ----
-  {
-    print_for_command_head (for_command);
-    cprintf (";");
-    newline ("do\n");
-+ 
-    indentation += indentation_amount;
-    make_command_string_internal (for_command->action);
-+   PRINT_DEFERRED_HEREDOCS ("");
-    semicolon ();
-    indentation -= indentation_amount;
-+ 
-    newline ("done");
-  }

diff --git a/app-shells/bash/files/bash-5.0-history-append.patch b/app-shells/bash/files/bash-5.0-history-append.patch
deleted file mode 100644
index 20f78bfe9f03..000000000000
--- a/app-shells/bash/files/bash-5.0-history-append.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-*** ../bash-5.0-patched/bashhist.c	2018-07-05 22:41:14.000000000 -0400
---- bashhist.c	2019-02-23 17:12:02.000000000 -0500
-***************
-*** 437,445 ****
-       char *filename;
-  {
-!   int fd, result;
-    struct stat buf;
-  
-    result = EXECUTION_SUCCESS;
-!   if (history_lines_this_session > 0 && (history_lines_this_session <= where_history ()))
-      {
-        /* If the filename was supplied, then create it if necessary. */
---- 437,445 ----
-       char *filename;
-  {
-!   int fd, result, histlen;
-    struct stat buf;
-  
-    result = EXECUTION_SUCCESS;
-!   if (history_lines_this_session > 0)
-      {
-        /* If the filename was supplied, then create it if necessary. */
-***************
-*** 454,457 ****
---- 454,461 ----
-  	  close (fd);
-  	}
-+       /* cap the number of lines we write at the length of the history list */
-+       histlen = where_history ();
-+       if (histlen > 0 && history_lines_this_session > histlen)
-+ 	history_lines_this_session = histlen;	/* reset below anyway */
-        result = append_history (history_lines_this_session, filename);
-        /* Pretend we already read these lines from the file because we just


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2021-01-07  0:48 Lars Wendler
  0 siblings, 0 replies; 18+ messages in thread
From: Lars Wendler @ 2021-01-07  0:48 UTC (permalink / raw
  To: gentoo-commits

commit:     ba53be405112d10b85e88cc2637156804b88bd91
Author:     Hank Leininger <hlein <AT> korelogic <DOT> com>
AuthorDate: Wed Dec 11 22:06:45 2019 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Thu Jan  7 00:48:45 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba53be40

app-shells/bash: fix CVE-2019-18276 (priv-dropping bug)

Cherry-picked the relevant parts of
https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=951bdaad7a18cc0dc1036bba86b18b90874d39ff
and modified the patches to apply.

Note that the existing bash-5.0*patch files are applied with -p0, which
is not the norm for eapply, etc.  I simply followed what was required
to work with the rest of the existing patches.

Signed-off-by: Hank Leininger <hlein <AT> korelogic.com>
Bug: https://bugs.gentoo.org/702488
Package-Manager: Portage-2.3.81, Repoman-2.3.18
Closes: https://github.com/gentoo/gentoo/pull/13941
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 app-shells/bash/bash-5.0_p11-r1.ebuild             | 266 +++++++++++++++++++++
 .../files/bash-5.0_p11-disable_priv_mode.patch     |  85 +++++++
 2 files changed, 351 insertions(+)

diff --git a/app-shells/bash/bash-5.0_p11-r1.ebuild b/app-shells/bash/bash-5.0_p11-r1.ebuild
new file mode 100644
index 00000000000..a6cf9c086ce
--- /dev/null
+++ b/app-shells/bash/bash-5.0_p11-r1.ebuild
@@ -0,0 +1,266 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit flag-o-matic toolchain-funcs multilib prefix
+
+# Official patchlevel
+# See ftp://ftp.cwru.edu/pub/bash/bash-5.0-patches/
+PLEVEL=${PV##*_p}
+MY_PV=${PV/_p*}
+MY_PV=${MY_PV/_/-}
+MY_P=${PN}-${MY_PV}
+is_release() {
+	case ${PV} in
+	*_alpha*|*_beta*|*_rc*) return 1 ;;
+	*) return 0 ;;
+	esac
+}
+[[ ${PV} != *_p* ]] && PLEVEL=0
+patches() {
+	local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}}
+	[[ ${plevel} -eq 0 ]] && return 1
+	eval set -- {1..${plevel}}
+	set -- $(printf "${pn}${pv/\.}-%03d " "$@")
+	if [[ ${opt} == -s ]] ; then
+		echo "${@/#/${DISTDIR}/}"
+	else
+		local u
+		for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do
+			printf "${u}/${pn}-${pv}-patches/%s " "$@"
+		done
+	fi
+}
+
+# The version of readline this bash normally ships with.
+READLINE_VER="8.0"
+
+DESCRIPTION="The standard GNU Bourne again shell"
+HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html"
+if is_release ; then
+	SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
+else
+	SRC_URI="ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
+fi
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline"
+
+DEPEND="
+	>=sys-libs/ncurses-5.2-r2:0=
+	nls? ( virtual/libintl )
+	readline? ( >=sys-libs/readline-${READLINE_VER}:0= )
+"
+RDEPEND="
+	${DEPEND}
+	!<sys-apps/portage-2.1.6.7_p1
+"
+# we only need yacc when the .y files get patched (bash42-005)
+#DEPEND+=" virtual/yacc"
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=(
+	# Patches from Chet sent to bashbug ml
+	"${FILESDIR}"/${PN}-5.0-history-append.patch
+	"${FILESDIR}"/${PN}-5.0-syslog-history-extern.patch
+	# fix CVE-2019-18276 #702488
+	"${FILESDIR}"/${PN}-5.0_p11-disable_priv_mode.patch
+)
+
+pkg_setup() {
+	if is-flag -malign-double ; then #7332
+		eerror "Detected bad CFLAGS '-malign-double'.  Do not use this"
+		eerror "as it breaks LFS (struct stat64) on x86."
+		die "remove -malign-double from your CFLAGS mr ricer"
+	fi
+	if use bashlogger ; then
+		ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
+		ewarn "This will log ALL output you enter into the shell, you have been warned."
+	fi
+}
+
+src_unpack() {
+	unpack ${MY_P}.tar.gz
+}
+
+src_prepare() {
+	# Include official patches
+	[[ ${PLEVEL} -gt 0 ]] && eapply -p0 $(patches -s)
+
+	# Clean out local libs so we know we use system ones w/releases.
+	if is_release ; then
+		rm -rf lib/{readline,termcap}/*
+		touch lib/{readline,termcap}/Makefile.in # for config.status
+		sed -ri -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
+
+	# Avoid regenerating docs after patches #407985
+	sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
+	touch -r . doc/*
+
+	eapply -p0 "${PATCHES[@]}"
+	eapply_user
+}
+
+src_configure() {
+	local myconf=(
+		--disable-profiling
+		--docdir='$(datarootdir)'/doc/${PF}
+		--htmldir='$(docdir)/html'
+		--with-curses
+		$(use_enable mem-scramble)
+		$(use_enable net net-redirections)
+		$(use_enable readline)
+		$(use_enable readline bang-history)
+		$(use_enable readline history)
+		$(use_with afs)
+		$(use_with mem-scramble bash-malloc)
+	)
+
+	# For descriptions of these, see config-top.h
+	# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
+	append-cppflags \
+		-DDEFAULT_PATH_VALUE=\'\"${EPREFIX}/usr/local/sbin:${EPREFIX}/usr/local/bin:${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin\"\' \
+		-DSTANDARD_UTILS_PATH=\'\"${EPREFIX}/bin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/usr/sbin\"\' \
+		-DSYS_BASHRC=\'\"${EPREFIX}/etc/bash/bashrc\"\' \
+		-DSYS_BASH_LOGOUT=\'\"${EPREFIX}/etc/bash/bash_logout\"\' \
+		-DNON_INTERACTIVE_LOGIN_SHELLS \
+		-DSSH_SOURCE_BASHRC \
+		$(use bashlogger && echo -DSYSLOG_HISTORY)
+
+	# Don't even think about building this statically without
+	# reading Bug 7714 first.  If you still build it statically,
+	# don't come crying to us with bugs ;).
+	#use static && export LDFLAGS="${LDFLAGS} -static"
+	use nls || myconf+=( --disable-nls )
+
+	# Historically, we always used the builtin readline, but since
+	# our handling of SONAME upgrades has gotten much more stable
+	# in the PM (and the readline ebuild itself preserves the old
+	# libs during upgrades), linking against the system copy should
+	# be safe.
+	# Exact cached version here doesn't really matter as long as it
+	# is at least what's in the DEPEND up above.
+	export ac_cv_rl_version=${READLINE_VER%%_*}
+
+	# Force linking with system curses ... the bundled termcap lib
+	# sucks bad compared to ncurses.  For the most part, ncurses
+	# is here because readline needs it.  But bash itself calls
+	# ncurses in one or two small places :(.
+
+	if is_release ; then
+		# Use system readline only with released versions.
+		myconf+=( --with-installed-readline=. )
+	fi
+
+	if use plugins; then
+		append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
+	else
+		# Disable the plugins logic by hand since bash doesn't
+		# provide a way of doing it.
+		export ac_cv_func_dl{close,open,sym}=no \
+			ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
+		sed -i \
+			-e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
+			configure || die
+	fi
+	tc-export AR #444070
+	econf "${myconf[@]}"
+}
+
+src_compile() {
+	emake
+
+	if use plugins ; then
+		emake -C examples/loadables all others
+	fi
+}
+
+src_install() {
+	local d f
+
+	default
+
+	dodir /bin
+	mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
+	dosym bash /bin/rbash
+
+	insinto /etc/bash
+	doins "${FILESDIR}"/bash_logout
+	doins "$(prefixify_ro "${FILESDIR}"/bashrc)"
+	keepdir /etc/bash/bashrc.d
+	insinto /etc/skel
+	for f in bash{_logout,_profile,rc} ; do
+		newins "${FILESDIR}"/dot-${f} .${f}
+	done
+
+	local sed_args=(
+		-e "s:#${USERLAND}#@::"
+		-e '/#@/d'
+	)
+	if ! use readline ; then
+		sed_args+=( #432338
+			-e '/^shopt -s histappend/s:^:#:'
+			-e 's:use_color=true:use_color=false:'
+		)
+	fi
+	sed -i \
+		"${sed_args[@]}" \
+		"${ED}"/etc/skel/.bashrc \
+		"${ED}"/etc/bash/bashrc || die
+
+	if use plugins ; then
+		exeinto /usr/$(get_libdir)/bash
+		doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
+		insinto /usr/include/bash-plugins
+		doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
+	fi
+
+	if use examples ; then
+		for d in examples/{functions,misc,scripts,startup-files} ; do
+			exeinto /usr/share/doc/${PF}/${d}
+			insinto /usr/share/doc/${PF}/${d}
+			for f in ${d}/* ; do
+				if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
+					doexe ${f}
+				else
+					doins ${f}
+				fi
+			done
+		done
+	fi
+
+	doman doc/*.1
+	newdoc CWRU/changelog ChangeLog
+	dosym bash.info /usr/share/info/bashref.info
+}
+
+pkg_preinst() {
+	if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
+		mkdir -p "${EROOT}"/etc/bash
+		mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
+	fi
+
+	if [[ -L ${EROOT}/bin/sh ]] ; then
+		# rewrite the symlink to ensure that its mtime changes. having /bin/sh
+		# missing even temporarily causes a fatal error with paludis.
+		local target=$(readlink "${EROOT}"/bin/sh)
+		local tmp=$(emktemp "${EROOT}"/bin)
+		ln -sf "${target}" "${tmp}"
+		mv -f "${tmp}" "${EROOT}"/bin/sh
+	fi
+}
+
+pkg_postinst() {
+	# If /bin/sh does not exist, provide it
+	if [[ ! -e ${EROOT}/bin/sh ]] ; then
+		ln -sf bash "${EROOT}"/bin/sh
+	fi
+}

diff --git a/app-shells/bash/files/bash-5.0_p11-disable_priv_mode.patch b/app-shells/bash/files/bash-5.0_p11-disable_priv_mode.patch
new file mode 100644
index 00000000000..9a05c8b8613
--- /dev/null
+++ b/app-shells/bash/files/bash-5.0_p11-disable_priv_mode.patch
@@ -0,0 +1,85 @@
+diff -urP ../bash-5.0.orig/config.h.in config.h.in
+--- ../bash-5.0.orig/config.h.in	2018-12-04 09:54:17.000000000 -0700
++++ config.h.in	2019-12-10 11:34:42.157926317 -0700
+@@ -1,6 +1,6 @@
+ /* config.h -- Configuration file for bash. */
+ 
+-/* Copyright (C) 1987-2009,2011-2012 Free Software Foundation, Inc.
++/* Copyright (C) 1987-2009,2011-2012,2013-2019 Free Software Foundation, Inc.
+ 
+    This file is part of GNU Bash, the Bourne Again SHell.
+ 
+@@ -807,6 +807,14 @@
+ #undef HAVE_SETREGID
+ #undef HAVE_DECL_SETREGID
+ 
++/* Define if you have the setregid function.  */
++#undef HAVE_SETRESGID
++#undef HAVE_DECL_SETRESGID
++
++/* Define if you have the setresuid function.  */
++#undef HAVE_SETRESUID
++#undef HAVE_DECL_SETRESUID
++
+ /* Define if you have the setvbuf function.  */
+ #undef HAVE_SETVBUF
+ 
+diff -urP ../bash-5.0.orig/configure configure
+--- ../bash-5.0.orig/configure	2019-01-02 07:43:31.000000000 -0700
++++ configure	2019-12-10 11:34:42.166926317 -0700
+@@ -10281,6 +10281,17 @@
+ #define HAVE_DECL_SETREGID $ac_have_decl
+ _ACEOF
+ 
++ac_fn_c_check_decl "$LINENO" "" "ac_cv_have_decl_" "$ac_includes_default"
++if test "x$ac_cv_have_decl_" = xyes; then :
++  ac_have_decl=1
++else
++  ac_have_decl=0
++fi
++
++cat >>confdefs.h <<_ACEOF
++#define HAVE_DECL_ $ac_have_decl
++_ACEOF
++(setresuid, setresgid)
+ ac_fn_c_check_decl "$LINENO" "strcpy" "ac_cv_have_decl_strcpy" "$ac_includes_default"
+ if test "x$ac_cv_have_decl_strcpy" = xyes; then :
+   ac_have_decl=1
+diff -urP ../bash-5.0.orig/configure.ac configure.ac
+--- ../bash-5.0.orig/configure.ac	2019-01-02 07:39:11.000000000 -0700
++++ configure.ac	2019-12-10 11:34:42.168926317 -0700
+@@ -810,6 +810,7 @@
+ AC_CHECK_DECLS([printf])
+ AC_CHECK_DECLS([sbrk])
+ AC_CHECK_DECLS([setregid])
++AC_CHECK_DECLS[(setresuid, setresgid])
+ AC_CHECK_DECLS([strcpy])
+ AC_CHECK_DECLS([strsignal])
+ 
+diff -urP ../bash-5.0.orig/shell.c shell.c
+--- ../bash-5.0.orig/shell.c	2018-12-06 09:28:21.000000000 -0700
++++ shell.c	2019-12-10 11:34:42.170926317 -0700
+@@ -1293,7 +1293,11 @@
+ {
+   int e;
+ 
++#if HAVE_DECL_SETRESUID
++  if (setresuid (current_user.uid, current_user.uid, current_user.uid) < 0)
++#else
+   if (setuid (current_user.uid) < 0)
++#endif
+     {
+       e = errno;
+       sys_error (_("cannot set uid to %d: effective uid %d"), current_user.uid, current_user.euid);
+@@ -1302,7 +1306,11 @@
+ 	exit (e);
+ #endif
+     }
++#if HAVE_DECL_SETRESGID
++  if (setresgid (current_user.gid, current_user.gid, current_user.gid) < 0)
++#else
+   if (setgid (current_user.gid) < 0)
++#endif
+     sys_error (_("cannot set gid to %d: effective gid %d"), current_user.gid, current_user.egid);
+ 
+   current_user.euid = current_user.uid;


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2020-12-07 13:18 Lars Wendler
  0 siblings, 0 replies; 18+ messages in thread
From: Lars Wendler @ 2020-12-07 13:18 UTC (permalink / raw
  To: gentoo-commits

commit:     4c2ebbf4b8bc660beb98cc2d845c73375d6e4f50
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Mon Dec  7 12:49:21 2020 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Mon Dec  7 13:18:41 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4c2ebbf4

app-shells/bash: Fixed parallel make issue

Package-Manager: Portage-3.0.11, Repoman-3.0.2
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 app-shells/bash/bash-5.1.ebuild                    |  1 +
 app-shells/bash/files/bash-5.1-parallel_make.patch | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/app-shells/bash/bash-5.1.ebuild b/app-shells/bash/bash-5.1.ebuild
index b99647b1aed..5d6585b3abe 100644
--- a/app-shells/bash/bash-5.1.ebuild
+++ b/app-shells/bash/bash-5.1.ebuild
@@ -103,6 +103,7 @@ src_prepare() {
 	touch -r . doc/* || die
 
 	eapply -p0 "${PATCHES[@]}"
+	eapply "${FILESDIR}/${PN}-5.1-parallel_make.patch"
 	eapply_user
 }
 

diff --git a/app-shells/bash/files/bash-5.1-parallel_make.patch b/app-shells/bash/files/bash-5.1-parallel_make.patch
new file mode 100644
index 00000000000..b341a8a06e2
--- /dev/null
+++ b/app-shells/bash/files/bash-5.1-parallel_make.patch
@@ -0,0 +1,15 @@
+bashline.c:65:10: fatal error: builtins/builtext.h: No such file or directory
+   65 | #include "builtins/builtext.h"  /* for read_builtin */
+      |          ^~~~~~~~~~~~~~~~~~~~~
+
+--- bash-5.1/Makefile.in
++++ bash-5.1/Makefile.in
+@@ -584,6 +584,8 @@
+ 	ls -l $(Program)
+ 	-$(SIZE) $(Program)
+ 
++$(CSOURCES): $(DEFDIR)/builtext.h
++
+ .build:	$(SOURCES) config.h Makefile version.h $(VERSPROG)
+ 	@echo
+ 	@echo "	  ***********************************************************"


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2019-08-15 10:50 Lars Wendler
  0 siblings, 0 replies; 18+ messages in thread
From: Lars Wendler @ 2019-08-15 10:50 UTC (permalink / raw
  To: gentoo-commits

commit:     62510d83798fcfa637ea4ca80fc9627005920e1f
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 15 10:50:00 2019 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Thu Aug 15 10:50:00 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=62510d83

app-shells/bash: Removed old.

Package-Manager: Portage-2.3.71, Repoman-2.3.17
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 app-shells/bash/bash-5.0_p3-r1.ebuild              | 267 ---------------------
 .../files/bash-5.0-optimize-connection-fork.patch  |  79 ------
 2 files changed, 346 deletions(-)

diff --git a/app-shells/bash/bash-5.0_p3-r1.ebuild b/app-shells/bash/bash-5.0_p3-r1.ebuild
deleted file mode 100644
index a13f1c8965c..00000000000
--- a/app-shells/bash/bash-5.0_p3-r1.ebuild
+++ /dev/null
@@ -1,267 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit flag-o-matic toolchain-funcs multilib prefix
-
-# Official patchlevel
-# See ftp://ftp.cwru.edu/pub/bash/bash-5.0-patches/
-PLEVEL=${PV##*_p}
-MY_PV=${PV/_p*}
-MY_PV=${MY_PV/_/-}
-MY_P=${PN}-${MY_PV}
-is_release() {
-	case ${PV} in
-	*_alpha*|*_beta*|*_rc*) return 1 ;;
-	*) return 0 ;;
-	esac
-}
-[[ ${PV} != *_p* ]] && PLEVEL=0
-patches() {
-	local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}}
-	[[ ${plevel} -eq 0 ]] && return 1
-	eval set -- {1..${plevel}}
-	set -- $(printf "${pn}${pv/\.}-%03d " "$@")
-	if [[ ${opt} == -s ]] ; then
-		echo "${@/#/${DISTDIR}/}"
-	else
-		local u
-		for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do
-			printf "${u}/${pn}-${pv}-patches/%s " "$@"
-		done
-	fi
-}
-
-# The version of readline this bash normally ships with.
-READLINE_VER="8.0"
-
-DESCRIPTION="The standard GNU Bourne again shell"
-HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html"
-if is_release ; then
-	SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
-else
-	SRC_URI="ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
-fi
-
-LICENSE="GPL-3"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline"
-
-DEPEND="
-	>=sys-libs/ncurses-5.2-r2:0=
-	readline? ( >=sys-libs/readline-${READLINE_VER}:0= )
-	nls? ( virtual/libintl )
-"
-RDEPEND="
-	${DEPEND}
-	!<sys-apps/portage-2.1.6.7_p1
-"
-# we only need yacc when the .y files get patched (bash42-005)
-#DEPEND+=" virtual/yacc"
-
-S="${WORKDIR}/${MY_P}"
-
-PATCHES=(
-	# Patches from Chet sent to bashbug ml
-	"${FILESDIR}"/${PN}-5.0-history-zero-length.patch
-	"${FILESDIR}"/${PN}-5.0-history-append.patch
-	"${FILESDIR}"/${PN}-5.0-optimize-connection-fork.patch
-	"${FILESDIR}"/${PN}-5.0-syslog-history-extern.patch
-	"${FILESDIR}"/${PN}-5.0-assignment-preceding-builtin.patch
-)
-
-pkg_setup() {
-	if is-flag -malign-double ; then #7332
-		eerror "Detected bad CFLAGS '-malign-double'.  Do not use this"
-		eerror "as it breaks LFS (struct stat64) on x86."
-		die "remove -malign-double from your CFLAGS mr ricer"
-	fi
-	if use bashlogger ; then
-		ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
-		ewarn "This will log ALL output you enter into the shell, you have been warned."
-	fi
-}
-
-src_unpack() {
-	unpack ${MY_P}.tar.gz
-}
-
-src_prepare() {
-	# Include official patches
-	[[ ${PLEVEL} -gt 0 ]] && eapply -p0 $(patches -s)
-
-	# Clean out local libs so we know we use system ones w/releases.
-	if is_release ; then
-		rm -rf lib/{readline,termcap}/*
-		touch lib/{readline,termcap}/Makefile.in # for config.status
-		sed -ri -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
-
-	# Avoid regenerating docs after patches #407985
-	sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
-	touch -r . doc/*
-
-	eapply -p0 "${PATCHES[@]}"
-	eapply_user
-}
-
-src_configure() {
-	local myconf=(
-		--disable-profiling
-		--docdir='$(datarootdir)'/doc/${PF}
-		--htmldir='$(docdir)/html'
-		--with-curses
-		$(use_enable mem-scramble)
-		$(use_enable net net-redirections)
-		$(use_enable readline)
-		$(use_enable readline bang-history)
-		$(use_enable readline history)
-		$(use_with afs)
-		$(use_with mem-scramble bash-malloc)
-	)
-
-	# For descriptions of these, see config-top.h
-	# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
-	append-cppflags \
-		-DDEFAULT_PATH_VALUE=\'\"${EPREFIX}/usr/local/sbin:${EPREFIX}/usr/local/bin:${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin\"\' \
-		-DSTANDARD_UTILS_PATH=\'\"${EPREFIX}/bin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/usr/sbin\"\' \
-		-DSYS_BASHRC=\'\"${EPREFIX}/etc/bash/bashrc\"\' \
-		-DSYS_BASH_LOGOUT=\'\"${EPREFIX}/etc/bash/bash_logout\"\' \
-		-DNON_INTERACTIVE_LOGIN_SHELLS \
-		-DSSH_SOURCE_BASHRC \
-		$(use bashlogger && echo -DSYSLOG_HISTORY)
-
-	# Don't even think about building this statically without
-	# reading Bug 7714 first.  If you still build it statically,
-	# don't come crying to us with bugs ;).
-	#use static && export LDFLAGS="${LDFLAGS} -static"
-	use nls || myconf+=( --disable-nls )
-
-	# Historically, we always used the builtin readline, but since
-	# our handling of SONAME upgrades has gotten much more stable
-	# in the PM (and the readline ebuild itself preserves the old
-	# libs during upgrades), linking against the system copy should
-	# be safe.
-	# Exact cached version here doesn't really matter as long as it
-	# is at least what's in the DEPEND up above.
-	export ac_cv_rl_version=${READLINE_VER%%_*}
-
-	# Force linking with system curses ... the bundled termcap lib
-	# sucks bad compared to ncurses.  For the most part, ncurses
-	# is here because readline needs it.  But bash itself calls
-	# ncurses in one or two small places :(.
-
-	if is_release ; then
-		# Use system readline only with released versions.
-		myconf+=( --with-installed-readline=. )
-	fi
-
-	if use plugins; then
-		append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
-	else
-		# Disable the plugins logic by hand since bash doesn't
-		# provide a way of doing it.
-		export ac_cv_func_dl{close,open,sym}=no \
-			ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
-		sed -i \
-			-e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
-			configure || die
-	fi
-	tc-export AR #444070
-	econf "${myconf[@]}"
-}
-
-src_compile() {
-	emake
-
-	if use plugins ; then
-		emake -C examples/loadables all others
-	fi
-}
-
-src_install() {
-	local d f
-
-	default
-
-	dodir /bin
-	mv "${ED%/}"/usr/bin/bash "${ED%/}"/bin/ || die
-	dosym bash /bin/rbash
-
-	insinto /etc/bash
-	doins "${FILESDIR}"/bash_logout
-	doins "$(prefixify_ro "${FILESDIR}"/bashrc)"
-	keepdir /etc/bash/bashrc.d
-	insinto /etc/skel
-	for f in bash{_logout,_profile,rc} ; do
-		newins "${FILESDIR}"/dot-${f} .${f}
-	done
-
-	local sed_args=(
-		-e "s:#${USERLAND}#@::"
-		-e '/#@/d'
-	)
-	if ! use readline ; then
-		sed_args+=( #432338
-			-e '/^shopt -s histappend/s:^:#:'
-			-e 's:use_color=true:use_color=false:'
-		)
-	fi
-	sed -i \
-		"${sed_args[@]}" \
-		"${ED%/}"/etc/skel/.bashrc \
-		"${ED%/}"/etc/bash/bashrc || die
-
-	if use plugins ; then
-		exeinto /usr/$(get_libdir)/bash
-		doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
-		insinto /usr/include/bash-plugins
-		doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
-	fi
-
-	if use examples ; then
-		for d in examples/{functions,misc,scripts,startup-files} ; do
-			exeinto /usr/share/doc/${PF}/${d}
-			insinto /usr/share/doc/${PF}/${d}
-			for f in ${d}/* ; do
-				if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
-					doexe ${f}
-				else
-					doins ${f}
-				fi
-			done
-		done
-	fi
-
-	doman doc/*.1
-	newdoc CWRU/changelog ChangeLog
-	dosym bash.info /usr/share/info/bashref.info
-}
-
-pkg_preinst() {
-	if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
-		mkdir -p "${EROOT}"/etc/bash
-		mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
-	fi
-
-	if [[ -L ${EROOT}/bin/sh ]] ; then
-		# rewrite the symlink to ensure that its mtime changes. having /bin/sh
-		# missing even temporarily causes a fatal error with paludis.
-		local target=$(readlink "${EROOT}"/bin/sh)
-		local tmp=$(emktemp "${EROOT}"/bin)
-		ln -sf "${target}" "${tmp}"
-		mv -f "${tmp}" "${EROOT}"/bin/sh
-	fi
-}
-
-pkg_postinst() {
-	# If /bin/sh does not exist, provide it
-	if [[ ! -e ${EROOT}/bin/sh ]] ; then
-		ln -sf bash "${EROOT}"/bin/sh
-	fi
-}

diff --git a/app-shells/bash/files/bash-5.0-optimize-connection-fork.patch b/app-shells/bash/files/bash-5.0-optimize-connection-fork.patch
deleted file mode 100644
index 3c6561bb126..00000000000
--- a/app-shells/bash/files/bash-5.0-optimize-connection-fork.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-*** ../bash-5.0-patched/command.h	2018-07-20 21:16:31.000000000 -0400
---- command.h	2019-02-20 11:09:36.000000000 -0500
-***************
-*** 187,190 ****
---- 188,192 ----
-  #define CMD_LASTPIPE	    0x2000
-  #define CMD_STDPATH	    0x4000	/* use standard path for command lookup */
-+ #define CMD_TRY_OPTIMIZING  0x8000	/* try to optimize this simple command */
-  
-  /* What a command looks like. */
-*** ../bash-5.0-patched/builtins/evalstring.c	2018-12-26 11:19:21.000000000 -0500
---- builtins/evalstring.c	2019-01-29 14:15:19.000000000 -0500
-***************
-*** 101,104 ****
---- 101,113 ----
-  }
-  
-+ int
-+ can_optimize_connection (command)
-+      COMMAND *command;
-+ {
-+   return (*bash_input.location.string == '\0' &&
-+ 	  (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') &&
-+ 	  command->value.Connection->second->type == cm_simple);
-+ }
-+ 
-  void
-  optimize_fork (command)
-***************
-*** 106,110 ****
-  {
-    if (command->type == cm_connection &&
-!       (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR) &&
-        should_suppress_fork (command->value.Connection->second))
-      {
---- 115,120 ----
-  {
-    if (command->type == cm_connection &&
-!       (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') &&
-!       (command->value.Connection->second->flags & CMD_TRY_OPTIMIZING) &&
-        should_suppress_fork (command->value.Connection->second))
-      {
-***************
-*** 413,418 ****
-  		  command->value.Simple->flags |= CMD_NO_FORK;
-  		}
-! 	      else if (command->type == cm_connection)
-! 		optimize_fork (command);
-  #endif /* ONESHOT */
-  
---- 423,438 ----
-  		  command->value.Simple->flags |= CMD_NO_FORK;
-  		}
-! 
-! 	      /* Can't optimize forks out here execept for simple commands.
-! 		 This knows that the parser sets up commands as left-side heavy
-! 		 (&& and || are left-associative) and after the single parse,
-! 		 if we are at the end of the command string, the last in a
-! 		 series of connection commands is
-! 		 command->value.Connection->second. */
-! 	      else if (command->type == cm_connection && can_optimize_connection (command))
-! 		{
-! 		  command->value.Connection->second->flags |= CMD_TRY_OPTIMIZING;
-! 		  command->value.Connection->second->value.Simple->flags |= CMD_TRY_OPTIMIZING;
-! 		}
-  #endif /* ONESHOT */
-  
-*** ../bash-5.0-patched/execute_cmd.c	2018-12-05 09:05:14.000000000 -0500
---- execute_cmd.c	2019-01-25 15:59:00.000000000 -0500
-***************
-*** 2768,2771 ****
---- 2768,2773 ----
-  	   (exec_result != EXECUTION_SUCCESS)))
-  	{
-+ 	  optimize_fork (command);
-+ 
-  	  second = command->value.Connection->second;
-  	  if (ignore_return && second)
-


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2019-04-21  9:16 Lars Wendler
  0 siblings, 0 replies; 18+ messages in thread
From: Lars Wendler @ 2019-04-21  9:16 UTC (permalink / raw
  To: gentoo-commits

commit:     31ea80d39218e125993ab64694fb0261871843ae
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 09:10:31 2019 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 09:16:26 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=31ea80d3

app-shells/bash: Removed old.

Package-Manager: Portage-2.3.64, Repoman-2.3.12
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 app-shells/bash/bash-5.0_p2-r2.ebuild              | 267 ---------------------
 app-shells/bash/bash-5.0_p3.ebuild                 | 266 --------------------
 .../bash/files/bash-5.0-globpat-backslashes.patch  | 206 ----------------
 3 files changed, 739 deletions(-)

diff --git a/app-shells/bash/bash-5.0_p2-r2.ebuild b/app-shells/bash/bash-5.0_p2-r2.ebuild
deleted file mode 100644
index 7383e634420..00000000000
--- a/app-shells/bash/bash-5.0_p2-r2.ebuild
+++ /dev/null
@@ -1,267 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit flag-o-matic toolchain-funcs multilib prefix
-
-# Official patchlevel
-# See ftp://ftp.cwru.edu/pub/bash/bash-5.0-patches/
-PLEVEL=${PV##*_p}
-MY_PV=${PV/_p*}
-MY_PV=${MY_PV/_/-}
-MY_P=${PN}-${MY_PV}
-is_release() {
-	case ${PV} in
-	*_alpha*|*_beta*|*_rc*) return 1 ;;
-	*) return 0 ;;
-	esac
-}
-[[ ${PV} != *_p* ]] && PLEVEL=0
-patches() {
-	local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}}
-	[[ ${plevel} -eq 0 ]] && return 1
-	eval set -- {1..${plevel}}
-	set -- $(printf "${pn}${pv/\.}-%03d " "$@")
-	if [[ ${opt} == -s ]] ; then
-		echo "${@/#/${DISTDIR}/}"
-	else
-		local u
-		for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do
-			printf "${u}/${pn}-${pv}-patches/%s " "$@"
-		done
-	fi
-}
-
-# The version of readline this bash normally ships with.
-READLINE_VER="8.0"
-
-DESCRIPTION="The standard GNU Bourne again shell"
-HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html"
-if is_release ; then
-	SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
-else
-	SRC_URI="ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
-fi
-
-LICENSE="GPL-3"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline"
-
-DEPEND="
-	>=sys-libs/ncurses-5.2-r2:0=
-	readline? ( >=sys-libs/readline-${READLINE_VER}:0= )
-	nls? ( virtual/libintl )
-"
-RDEPEND="
-	${DEPEND}
-	!<sys-apps/portage-2.1.6.7_p1
-"
-# we only need yacc when the .y files get patched (bash42-005)
-#DEPEND+=" virtual/yacc"
-
-S="${WORKDIR}/${MY_P}"
-
-PATCHES=(
-	# Patches from Chet sent to bashbug ml
-	"${FILESDIR}"/${PN}-5.0-history-zero-length.patch
-	"${FILESDIR}"/${PN}-5.0-history-append.patch
-	"${FILESDIR}"/${PN}-5.0-optimize-connection-fork.patch
-	"${FILESDIR}"/${PN}-5.0-syslog-history-extern.patch
-	"${FILESDIR}"/${PN}-5.0-globpat-backslashes.patch
-)
-
-pkg_setup() {
-	if is-flag -malign-double ; then #7332
-		eerror "Detected bad CFLAGS '-malign-double'.  Do not use this"
-		eerror "as it breaks LFS (struct stat64) on x86."
-		die "remove -malign-double from your CFLAGS mr ricer"
-	fi
-	if use bashlogger ; then
-		ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
-		ewarn "This will log ALL output you enter into the shell, you have been warned."
-	fi
-}
-
-src_unpack() {
-	unpack ${MY_P}.tar.gz
-}
-
-src_prepare() {
-	# Include official patches
-	[[ ${PLEVEL} -gt 0 ]] && eapply -p0 $(patches -s)
-
-	# Clean out local libs so we know we use system ones w/releases.
-	if is_release ; then
-		rm -rf lib/{readline,termcap}/*
-		touch lib/{readline,termcap}/Makefile.in # for config.status
-		sed -ri -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
-
-	# Avoid regenerating docs after patches #407985
-	sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
-	touch -r . doc/*
-
-	eapply -p0 "${PATCHES[@]}"
-	eapply_user
-}
-
-src_configure() {
-	local myconf=(
-		--disable-profiling
-		--docdir='$(datarootdir)'/doc/${PF}
-		--htmldir='$(docdir)/html'
-		--with-curses
-		$(use_enable mem-scramble)
-		$(use_enable net net-redirections)
-		$(use_enable readline)
-		$(use_enable readline bang-history)
-		$(use_enable readline history)
-		$(use_with afs)
-		$(use_with mem-scramble bash-malloc)
-	)
-
-	# For descriptions of these, see config-top.h
-	# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
-	append-cppflags \
-		-DDEFAULT_PATH_VALUE=\'\"${EPREFIX}/usr/local/sbin:${EPREFIX}/usr/local/bin:${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin\"\' \
-		-DSTANDARD_UTILS_PATH=\'\"${EPREFIX}/bin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/usr/sbin\"\' \
-		-DSYS_BASHRC=\'\"${EPREFIX}/etc/bash/bashrc\"\' \
-		-DSYS_BASH_LOGOUT=\'\"${EPREFIX}/etc/bash/bash_logout\"\' \
-		-DNON_INTERACTIVE_LOGIN_SHELLS \
-		-DSSH_SOURCE_BASHRC \
-		$(use bashlogger && echo -DSYSLOG_HISTORY)
-
-	# Don't even think about building this statically without
-	# reading Bug 7714 first.  If you still build it statically,
-	# don't come crying to us with bugs ;).
-	#use static && export LDFLAGS="${LDFLAGS} -static"
-	use nls || myconf+=( --disable-nls )
-
-	# Historically, we always used the builtin readline, but since
-	# our handling of SONAME upgrades has gotten much more stable
-	# in the PM (and the readline ebuild itself preserves the old
-	# libs during upgrades), linking against the system copy should
-	# be safe.
-	# Exact cached version here doesn't really matter as long as it
-	# is at least what's in the DEPEND up above.
-	export ac_cv_rl_version=${READLINE_VER%%_*}
-
-	# Force linking with system curses ... the bundled termcap lib
-	# sucks bad compared to ncurses.  For the most part, ncurses
-	# is here because readline needs it.  But bash itself calls
-	# ncurses in one or two small places :(.
-
-	if is_release ; then
-		# Use system readline only with released versions.
-		myconf+=( --with-installed-readline=. )
-	fi
-
-	if use plugins; then
-		append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
-	else
-		# Disable the plugins logic by hand since bash doesn't
-		# provide a way of doing it.
-		export ac_cv_func_dl{close,open,sym}=no \
-			ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
-		sed -i \
-			-e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
-			configure || die
-	fi
-	tc-export AR #444070
-	econf "${myconf[@]}"
-}
-
-src_compile() {
-	emake
-
-	if use plugins ; then
-		emake -C examples/loadables all others
-	fi
-}
-
-src_install() {
-	local d f
-
-	default
-
-	dodir /bin
-	mv "${ED%/}"/usr/bin/bash "${ED%/}"/bin/ || die
-	dosym bash /bin/rbash
-
-	insinto /etc/bash
-	doins "${FILESDIR}"/bash_logout
-	doins "$(prefixify_ro "${FILESDIR}"/bashrc)"
-	keepdir /etc/bash/bashrc.d
-	insinto /etc/skel
-	for f in bash{_logout,_profile,rc} ; do
-		newins "${FILESDIR}"/dot-${f} .${f}
-	done
-
-	local sed_args=(
-		-e "s:#${USERLAND}#@::"
-		-e '/#@/d'
-	)
-	if ! use readline ; then
-		sed_args+=( #432338
-			-e '/^shopt -s histappend/s:^:#:'
-			-e 's:use_color=true:use_color=false:'
-		)
-	fi
-	sed -i \
-		"${sed_args[@]}" \
-		"${ED%/}"/etc/skel/.bashrc \
-		"${ED%/}"/etc/bash/bashrc || die
-
-	if use plugins ; then
-		exeinto /usr/$(get_libdir)/bash
-		doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
-		insinto /usr/include/bash-plugins
-		doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
-	fi
-
-	if use examples ; then
-		for d in examples/{functions,misc,scripts,startup-files} ; do
-			exeinto /usr/share/doc/${PF}/${d}
-			insinto /usr/share/doc/${PF}/${d}
-			for f in ${d}/* ; do
-				if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
-					doexe ${f}
-				else
-					doins ${f}
-				fi
-			done
-		done
-	fi
-
-	doman doc/*.1
-	newdoc CWRU/changelog ChangeLog
-	dosym bash.info /usr/share/info/bashref.info
-}
-
-pkg_preinst() {
-	if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
-		mkdir -p "${EROOT}"/etc/bash
-		mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
-	fi
-
-	if [[ -L ${EROOT}/bin/sh ]] ; then
-		# rewrite the symlink to ensure that its mtime changes. having /bin/sh
-		# missing even temporarily causes a fatal error with paludis.
-		local target=$(readlink "${EROOT}"/bin/sh)
-		local tmp=$(emktemp "${EROOT}"/bin)
-		ln -sf "${target}" "${tmp}"
-		mv -f "${tmp}" "${EROOT}"/bin/sh
-	fi
-}
-
-pkg_postinst() {
-	# If /bin/sh does not exist, provide it
-	if [[ ! -e ${EROOT}/bin/sh ]] ; then
-		ln -sf bash "${EROOT}"/bin/sh
-	fi
-}

diff --git a/app-shells/bash/bash-5.0_p3.ebuild b/app-shells/bash/bash-5.0_p3.ebuild
deleted file mode 100644
index 0e14a04dc16..00000000000
--- a/app-shells/bash/bash-5.0_p3.ebuild
+++ /dev/null
@@ -1,266 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit flag-o-matic toolchain-funcs multilib prefix
-
-# Official patchlevel
-# See ftp://ftp.cwru.edu/pub/bash/bash-5.0-patches/
-PLEVEL=${PV##*_p}
-MY_PV=${PV/_p*}
-MY_PV=${MY_PV/_/-}
-MY_P=${PN}-${MY_PV}
-is_release() {
-	case ${PV} in
-	*_alpha*|*_beta*|*_rc*) return 1 ;;
-	*) return 0 ;;
-	esac
-}
-[[ ${PV} != *_p* ]] && PLEVEL=0
-patches() {
-	local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}}
-	[[ ${plevel} -eq 0 ]] && return 1
-	eval set -- {1..${plevel}}
-	set -- $(printf "${pn}${pv/\.}-%03d " "$@")
-	if [[ ${opt} == -s ]] ; then
-		echo "${@/#/${DISTDIR}/}"
-	else
-		local u
-		for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do
-			printf "${u}/${pn}-${pv}-patches/%s " "$@"
-		done
-	fi
-}
-
-# The version of readline this bash normally ships with.
-READLINE_VER="8.0"
-
-DESCRIPTION="The standard GNU Bourne again shell"
-HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html"
-if is_release ; then
-	SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
-else
-	SRC_URI="ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
-fi
-
-LICENSE="GPL-3"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline"
-
-DEPEND="
-	>=sys-libs/ncurses-5.2-r2:0=
-	readline? ( >=sys-libs/readline-${READLINE_VER}:0= )
-	nls? ( virtual/libintl )
-"
-RDEPEND="
-	${DEPEND}
-	!<sys-apps/portage-2.1.6.7_p1
-"
-# we only need yacc when the .y files get patched (bash42-005)
-#DEPEND+=" virtual/yacc"
-
-S="${WORKDIR}/${MY_P}"
-
-PATCHES=(
-	# Patches from Chet sent to bashbug ml
-	"${FILESDIR}"/${PN}-5.0-history-zero-length.patch
-	"${FILESDIR}"/${PN}-5.0-history-append.patch
-	"${FILESDIR}"/${PN}-5.0-optimize-connection-fork.patch
-	"${FILESDIR}"/${PN}-5.0-syslog-history-extern.patch
-)
-
-pkg_setup() {
-	if is-flag -malign-double ; then #7332
-		eerror "Detected bad CFLAGS '-malign-double'.  Do not use this"
-		eerror "as it breaks LFS (struct stat64) on x86."
-		die "remove -malign-double from your CFLAGS mr ricer"
-	fi
-	if use bashlogger ; then
-		ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
-		ewarn "This will log ALL output you enter into the shell, you have been warned."
-	fi
-}
-
-src_unpack() {
-	unpack ${MY_P}.tar.gz
-}
-
-src_prepare() {
-	# Include official patches
-	[[ ${PLEVEL} -gt 0 ]] && eapply -p0 $(patches -s)
-
-	# Clean out local libs so we know we use system ones w/releases.
-	if is_release ; then
-		rm -rf lib/{readline,termcap}/*
-		touch lib/{readline,termcap}/Makefile.in # for config.status
-		sed -ri -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
-
-	# Avoid regenerating docs after patches #407985
-	sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
-	touch -r . doc/*
-
-	eapply -p0 "${PATCHES[@]}"
-	eapply_user
-}
-
-src_configure() {
-	local myconf=(
-		--disable-profiling
-		--docdir='$(datarootdir)'/doc/${PF}
-		--htmldir='$(docdir)/html'
-		--with-curses
-		$(use_enable mem-scramble)
-		$(use_enable net net-redirections)
-		$(use_enable readline)
-		$(use_enable readline bang-history)
-		$(use_enable readline history)
-		$(use_with afs)
-		$(use_with mem-scramble bash-malloc)
-	)
-
-	# For descriptions of these, see config-top.h
-	# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
-	append-cppflags \
-		-DDEFAULT_PATH_VALUE=\'\"${EPREFIX}/usr/local/sbin:${EPREFIX}/usr/local/bin:${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin\"\' \
-		-DSTANDARD_UTILS_PATH=\'\"${EPREFIX}/bin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/usr/sbin\"\' \
-		-DSYS_BASHRC=\'\"${EPREFIX}/etc/bash/bashrc\"\' \
-		-DSYS_BASH_LOGOUT=\'\"${EPREFIX}/etc/bash/bash_logout\"\' \
-		-DNON_INTERACTIVE_LOGIN_SHELLS \
-		-DSSH_SOURCE_BASHRC \
-		$(use bashlogger && echo -DSYSLOG_HISTORY)
-
-	# Don't even think about building this statically without
-	# reading Bug 7714 first.  If you still build it statically,
-	# don't come crying to us with bugs ;).
-	#use static && export LDFLAGS="${LDFLAGS} -static"
-	use nls || myconf+=( --disable-nls )
-
-	# Historically, we always used the builtin readline, but since
-	# our handling of SONAME upgrades has gotten much more stable
-	# in the PM (and the readline ebuild itself preserves the old
-	# libs during upgrades), linking against the system copy should
-	# be safe.
-	# Exact cached version here doesn't really matter as long as it
-	# is at least what's in the DEPEND up above.
-	export ac_cv_rl_version=${READLINE_VER%%_*}
-
-	# Force linking with system curses ... the bundled termcap lib
-	# sucks bad compared to ncurses.  For the most part, ncurses
-	# is here because readline needs it.  But bash itself calls
-	# ncurses in one or two small places :(.
-
-	if is_release ; then
-		# Use system readline only with released versions.
-		myconf+=( --with-installed-readline=. )
-	fi
-
-	if use plugins; then
-		append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
-	else
-		# Disable the plugins logic by hand since bash doesn't
-		# provide a way of doing it.
-		export ac_cv_func_dl{close,open,sym}=no \
-			ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
-		sed -i \
-			-e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
-			configure || die
-	fi
-	tc-export AR #444070
-	econf "${myconf[@]}"
-}
-
-src_compile() {
-	emake
-
-	if use plugins ; then
-		emake -C examples/loadables all others
-	fi
-}
-
-src_install() {
-	local d f
-
-	default
-
-	dodir /bin
-	mv "${ED%/}"/usr/bin/bash "${ED%/}"/bin/ || die
-	dosym bash /bin/rbash
-
-	insinto /etc/bash
-	doins "${FILESDIR}"/bash_logout
-	doins "$(prefixify_ro "${FILESDIR}"/bashrc)"
-	keepdir /etc/bash/bashrc.d
-	insinto /etc/skel
-	for f in bash{_logout,_profile,rc} ; do
-		newins "${FILESDIR}"/dot-${f} .${f}
-	done
-
-	local sed_args=(
-		-e "s:#${USERLAND}#@::"
-		-e '/#@/d'
-	)
-	if ! use readline ; then
-		sed_args+=( #432338
-			-e '/^shopt -s histappend/s:^:#:'
-			-e 's:use_color=true:use_color=false:'
-		)
-	fi
-	sed -i \
-		"${sed_args[@]}" \
-		"${ED%/}"/etc/skel/.bashrc \
-		"${ED%/}"/etc/bash/bashrc || die
-
-	if use plugins ; then
-		exeinto /usr/$(get_libdir)/bash
-		doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
-		insinto /usr/include/bash-plugins
-		doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
-	fi
-
-	if use examples ; then
-		for d in examples/{functions,misc,scripts,startup-files} ; do
-			exeinto /usr/share/doc/${PF}/${d}
-			insinto /usr/share/doc/${PF}/${d}
-			for f in ${d}/* ; do
-				if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
-					doexe ${f}
-				else
-					doins ${f}
-				fi
-			done
-		done
-	fi
-
-	doman doc/*.1
-	newdoc CWRU/changelog ChangeLog
-	dosym bash.info /usr/share/info/bashref.info
-}
-
-pkg_preinst() {
-	if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
-		mkdir -p "${EROOT}"/etc/bash
-		mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
-	fi
-
-	if [[ -L ${EROOT}/bin/sh ]] ; then
-		# rewrite the symlink to ensure that its mtime changes. having /bin/sh
-		# missing even temporarily causes a fatal error with paludis.
-		local target=$(readlink "${EROOT}"/bin/sh)
-		local tmp=$(emktemp "${EROOT}"/bin)
-		ln -sf "${target}" "${tmp}"
-		mv -f "${tmp}" "${EROOT}"/bin/sh
-	fi
-}
-
-pkg_postinst() {
-	# If /bin/sh does not exist, provide it
-	if [[ ! -e ${EROOT}/bin/sh ]] ; then
-		ln -sf bash "${EROOT}"/bin/sh
-	fi
-}

diff --git a/app-shells/bash/files/bash-5.0-globpat-backslashes.patch b/app-shells/bash/files/bash-5.0-globpat-backslashes.patch
deleted file mode 100644
index 21acaf7e7ff..00000000000
--- a/app-shells/bash/files/bash-5.0-globpat-backslashes.patch
+++ /dev/null
@@ -1,206 +0,0 @@
-*** ../bash-5.0-patched/lib/glob/glob_loop.c	2019-01-16 16:13:21.000000000 -0500
---- lib/glob/glob_loop.c	2019-02-01 09:45:11.000000000 -0500
-***************
-*** 27,34 ****
-    register const GCHAR *p;
-    register GCHAR c;
-!   int bopen;
-  
-    p = pattern;
-!   bopen = 0;
-  
-    while ((c = *p++) != L('\0'))
---- 27,34 ----
-    register const GCHAR *p;
-    register GCHAR c;
-!   int bopen, bsquote;
-  
-    p = pattern;
-!   bopen = bsquote = 0;
-  
-    while ((c = *p++) != L('\0'))
-***************
-*** 56,66 ****
-        case L('\\'):
-  	/* Don't let the pattern end in a backslash (GMATCH returns no match
-! 	   if the pattern ends in a backslash anyway), but otherwise return 1,
-! 	   since the matching engine uses backslash as an escape character
-! 	   and it can be removed. */
-! 	return (*p != L('\0'));
-        }
-  
-!   return 0;
-  }
-  
---- 56,75 ----
-        case L('\\'):
-  	/* Don't let the pattern end in a backslash (GMATCH returns no match
-! 	   if the pattern ends in a backslash anyway), but otherwise note that 
-! 	   we have seen this, since the matching engine uses backslash as an
-! 	   escape character and it can be removed. We return 2 later if we
-! 	   have seen only backslash-escaped characters, so interested callers
-! 	   know they can shortcut and just dequote the pathname. */
-! 	if (*p != L('\0'))
-! 	  {
-! 	    p++;
-! 	    bsquote = 1;
-! 	    continue;
-! 	  }
-! 	else 	/* (*p == L('\0')) */
-! 	  return 0;
-        }
-  
-!   return bsquote ? 2 : 0;
-  }
-  
-*** ../bash-5.0-patched/lib/glob/glob.h	2013-10-28 14:46:12.000000000 -0400
---- lib/glob/glob.h	2019-03-07 11:06:47.000000000 -0500
-***************
-*** 31,34 ****
---- 31,35 ----
-  #define GX_ADDCURDIR	0x200	/* internal -- add passed directory name */
-  #define GX_GLOBSTAR	0x400	/* turn on special handling of ** */
-+ #define GX_RECURSE	0x800	/* internal -- glob_filename called recursively */
-  
-  extern int glob_pattern_p __P((const char *));
-*** ../bash-5.0-patched/lib/glob/glob.c	2018-09-20 10:53:23.000000000 -0400
---- lib/glob/glob.c	2019-03-07 14:23:43.000000000 -0500
-***************
-*** 1062,1066 ****
-    unsigned int directory_len;
-    int free_dirname;			/* flag */
-!   int dflags;
-  
-    result = (char **) malloc (sizeof (char *));
---- 1078,1082 ----
-    unsigned int directory_len;
-    int free_dirname;			/* flag */
-!   int dflags, hasglob;
-  
-    result = (char **) malloc (sizeof (char *));
-***************
-*** 1111,1117 ****
-      }
-  
-    /* If directory_name contains globbing characters, then we
-!      have to expand the previous levels.  Just recurse. */
-!   if (directory_len > 0 && glob_pattern_p (directory_name))
-      {
-        char **directories, *d, *p;
---- 1127,1136 ----
-      }
-  
-+   hasglob = 0;
-    /* If directory_name contains globbing characters, then we
-!      have to expand the previous levels.  Just recurse.
-!      If glob_pattern_p returns != [0,1] we have a pattern that has backslash
-!      quotes but no unquoted glob pattern characters. We dequote it below. */
-!   if (directory_len > 0 && (hasglob = glob_pattern_p (directory_name)) == 1)
-      {
-        char **directories, *d, *p;
-***************
-*** 1176,1180 ****
-  	d[directory_len - 1] = '\0';
-  
-!       directories = glob_filename (d, dflags);
-  
-        if (free_dirname)
---- 1195,1199 ----
-  	d[directory_len - 1] = '\0';
-  
-!       directories = glob_filename (d, dflags|GX_RECURSE);
-  
-        if (free_dirname)
-***************
-*** 1333,1336 ****
---- 1352,1369 ----
-  	  return (NULL);
-  	}
-+       /* If we have a directory name with quoted characters, and we are
-+ 	 being called recursively to glob the directory portion of a pathname,
-+ 	 we need to dequote the directory name before returning it so the
-+ 	 caller can read the directory */
-+       if (directory_len > 0 && hasglob == 2 && (flags & GX_RECURSE) != 0)
-+ 	{
-+ 	  dequote_pathname (directory_name);
-+ 	  directory_len = strlen (directory_name);
-+ 	}
-+ 
-+       /* We could check whether or not the dequoted directory_name is a
-+ 	 directory and return it here, returning the original directory_name
-+ 	 if not, but we don't do that yet. I'm not sure it matters. */
-+ 
-        /* Handle GX_MARKDIRS here. */
-        result[0] = (char *) malloc (directory_len + 1);
-*** ../bash-5.0-patched/pathexp.c	2018-04-29 17:44:48.000000000 -0400
---- pathexp.c	2019-01-31 20:19:41.000000000 -0500
-***************
-*** 66,74 ****
-    register int c;
-    char *send;
-!   int open;
-  
-    DECLARE_MBSTATE;
-  
-!   open = 0;
-    send = string + strlen (string);
-  
---- 66,74 ----
-    register int c;
-    char *send;
-!   int open, bsquote;
-  
-    DECLARE_MBSTATE;
-  
-!   open = bsquote = 0;
-    send = string + strlen (string);
-  
-***************
-*** 101,105 ****
-  	   globbing. */
-  	case '\\':
-! 	  return (*string != 0);
-  	 	  
-  	case CTLESC:
---- 101,112 ----
-  	   globbing. */
-  	case '\\':
-! 	  if (*string != '\0' && *string != '/')
-! 	    {
-! 	      bsquote = 1;
-! 	      string++;
-! 	      continue;
-! 	    }
-! 	  else if (*string == 0)
-! 	    return (0);
-  	 	  
-  	case CTLESC:
-***************
-*** 118,122 ****
-  #endif
-      }
-!   return (0);
-  }
-  
---- 125,130 ----
-  #endif
-      }
-! 
-!   return (bsquote ? 2 : 0);
-  }
-  
-*** ../bash-5.0-patched/bashline.c	2019-01-16 16:13:21.000000000 -0500
---- bashline.c	2019-02-22 09:29:08.000000000 -0500
-***************
-*** 3753,3757 ****
-  
-  	case '\\':
-! 	  if (*string == 0)
-  	    return (0);	 	  
-  	}
---- 3766,3770 ----
-  
-  	case '\\':
-! 	  if (*string++ == 0)
-  	    return (0);	 	  
-  	}


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2019-03-08 20:56 Lars Wendler
  0 siblings, 0 replies; 18+ messages in thread
From: Lars Wendler @ 2019-03-08 20:56 UTC (permalink / raw
  To: gentoo-commits

commit:     899e32aaae797bc4febb51b70bd2d370d6332585
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Fri Mar  8 20:55:42 2019 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Fri Mar  8 20:56:07 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=899e32aa

app-shells/bash: Bump to version 5.0_p2-r2. Removed old.

Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 ...bash-5.0_p2-r1.ebuild => bash-5.0_p2-r2.ebuild} |  2 +-
 .../bash/files/bash-5.0-globpat-backslashes.patch  | 38 ++++++++++++++++++++--
 2 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/app-shells/bash/bash-5.0_p2-r1.ebuild b/app-shells/bash/bash-5.0_p2-r2.ebuild
similarity index 100%
rename from app-shells/bash/bash-5.0_p2-r1.ebuild
rename to app-shells/bash/bash-5.0_p2-r2.ebuild
index 9410c85e0ce..7383e634420 100644
--- a/app-shells/bash/bash-5.0_p2-r1.ebuild
+++ b/app-shells/bash/bash-5.0_p2-r2.ebuild
@@ -68,8 +68,8 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-5.0-history-zero-length.patch
 	"${FILESDIR}"/${PN}-5.0-history-append.patch
 	"${FILESDIR}"/${PN}-5.0-optimize-connection-fork.patch
-	"${FILESDIR}"/${PN}-5.0-globpat-backslashes.patch
 	"${FILESDIR}"/${PN}-5.0-syslog-history-extern.patch
+	"${FILESDIR}"/${PN}-5.0-globpat-backslashes.patch
 )
 
 pkg_setup() {

diff --git a/app-shells/bash/files/bash-5.0-globpat-backslashes.patch b/app-shells/bash/files/bash-5.0-globpat-backslashes.patch
index b3f6d680ea4..21acaf7e7ff 100644
--- a/app-shells/bash/files/bash-5.0-globpat-backslashes.patch
+++ b/app-shells/bash/files/bash-5.0-globpat-backslashes.patch
@@ -53,8 +53,18 @@
 !   return bsquote ? 2 : 0;
   }
   
+*** ../bash-5.0-patched/lib/glob/glob.h	2013-10-28 14:46:12.000000000 -0400
+--- lib/glob/glob.h	2019-03-07 11:06:47.000000000 -0500
+***************
+*** 31,34 ****
+--- 31,35 ----
+  #define GX_ADDCURDIR	0x200	/* internal -- add passed directory name */
+  #define GX_GLOBSTAR	0x400	/* turn on special handling of ** */
++ #define GX_RECURSE	0x800	/* internal -- glob_filename called recursively */
+  
+  extern int glob_pattern_p __P((const char *));
 *** ../bash-5.0-patched/lib/glob/glob.c	2018-09-20 10:53:23.000000000 -0400
---- lib/glob/glob.c	2019-01-31 19:14:13.000000000 -0500
+--- lib/glob/glob.c	2019-03-07 14:23:43.000000000 -0500
 ***************
 *** 1062,1066 ****
     unsigned int directory_len;
@@ -89,15 +99,37 @@
       {
         char **directories, *d, *p;
 ***************
+*** 1176,1180 ****
+  	d[directory_len - 1] = '\0';
+  
+!       directories = glob_filename (d, dflags);
+  
+        if (free_dirname)
+--- 1195,1199 ----
+  	d[directory_len - 1] = '\0';
+  
+!       directories = glob_filename (d, dflags|GX_RECURSE);
+  
+        if (free_dirname)
+***************
 *** 1333,1336 ****
---- 1352,1360 ----
+--- 1352,1369 ----
   	  return (NULL);
   	}
-+       if (directory_len > 0 && hasglob == 2)		/* need to dequote */
++       /* If we have a directory name with quoted characters, and we are
++ 	 being called recursively to glob the directory portion of a pathname,
++ 	 we need to dequote the directory name before returning it so the
++ 	 caller can read the directory */
++       if (directory_len > 0 && hasglob == 2 && (flags & GX_RECURSE) != 0)
 + 	{
 + 	  dequote_pathname (directory_name);
 + 	  directory_len = strlen (directory_name);
 + 	}
++ 
++       /* We could check whether or not the dequoted directory_name is a
++ 	 directory and return it here, returning the original directory_name
++ 	 if not, but we don't do that yet. I'm not sure it matters. */
++ 
         /* Handle GX_MARKDIRS here. */
         result[0] = (char *) malloc (directory_len + 1);
 *** ../bash-5.0-patched/pathexp.c	2018-04-29 17:44:48.000000000 -0400


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2019-01-09 17:50 Lars Wendler
  0 siblings, 0 replies; 18+ messages in thread
From: Lars Wendler @ 2019-01-09 17:50 UTC (permalink / raw
  To: gentoo-commits

commit:     8dd00bb17128098d6ac2f4c43ccd797519340e9f
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  9 17:50:01 2019 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Wed Jan  9 17:50:24 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8dd00bb1

app-shells/bash: Fixed weird insert of backslashes

Package-Manager: Portage-2.3.54, Repoman-2.3.12
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 app-shells/bash/bash-5.0.ebuild                    |   2 +
 .../files/bash-5.0-glob-pattern-backslash.patch    | 133 +++++++++++++++++++++
 2 files changed, 135 insertions(+)

diff --git a/app-shells/bash/bash-5.0.ebuild b/app-shells/bash/bash-5.0.ebuild
index dcfccc608f9..9dd564847ad 100644
--- a/app-shells/bash/bash-5.0.ebuild
+++ b/app-shells/bash/bash-5.0.ebuild
@@ -97,6 +97,8 @@ src_prepare() {
 	sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
 	touch -r . doc/*
 
+	eapply -p0 "${FILESDIR}"/${P}-glob-pattern-backslash.patch
+
 	eapply_user
 }
 

diff --git a/app-shells/bash/files/bash-5.0-glob-pattern-backslash.patch b/app-shells/bash/files/bash-5.0-glob-pattern-backslash.patch
new file mode 100644
index 00000000000..40379b3d4cc
--- /dev/null
+++ b/app-shells/bash/files/bash-5.0-glob-pattern-backslash.patch
@@ -0,0 +1,133 @@
+*** ../bash-5.0/bashline.c	2018-11-27 13:20:16.000000000 -0500
+--- bashline.c	2019-01-09 09:44:26.000000000 -0500
+***************
+*** 232,235 ****
+--- 232,236 ----
+  static int bash_possible_command_completions __P((int, int));
+  
++ static int completion_glob_pattern __P((const char *));
+  static char *glob_complete_word __P((const char *, int));
+  static int bash_glob_completion_internal __P((int));
+***************
+*** 1742,1746 ****
+    /* This could be a globbing pattern, so try to expand it using pathname
+       expansion. */
+!   if (!matches && glob_pattern_p (text))
+      {
+        matches = rl_completion_matches (text, glob_complete_word);
+--- 1743,1747 ----
+    /* This could be a globbing pattern, so try to expand it using pathname
+       expansion. */
+!   if (!matches && completion_glob_pattern (text))
+      {
+        matches = rl_completion_matches (text, glob_complete_word);
+***************
+*** 1851,1855 ****
+  	}
+  
+!       globpat = glob_pattern_p (hint_text);
+  
+        /* If this is an absolute program name, do not check it against
+--- 1852,1856 ----
+  	}
+  
+!       globpat = completion_glob_pattern (hint_text);
+  
+        /* If this is an absolute program name, do not check it against
+***************
+*** 3714,3717 ****
+--- 3715,3773 ----
+  }
+  
++ static int
++ completion_glob_pattern (string)
++      const char *string;
++ {
++   register int c;
++   char *send;
++   int open;
++ 
++   DECLARE_MBSTATE;
++ 
++   open = 0;
++   send = string + strlen (string);
++ 
++   while (c = *string++)
++     {
++       switch (c)
++ 	{
++ 	case '?':
++ 	case '*':
++ 	  return (1);
++ 
++ 	case '[':
++ 	  open++;
++ 	  continue;
++ 
++ 	case ']':
++ 	  if (open)
++ 	    return (1);
++ 	  continue;
++ 
++ 	case '+':
++ 	case '@':
++ 	case '!':
++ 	  if (*string == '(')	/*)*/
++ 	    return (1);
++ 	  continue;
++ 
++ 	case '\\':
++ 	  if (*string == 0)
++ 	    return (0);	 	  
++ 	}
++ 
++       /* Advance one fewer byte than an entire multibyte character to
++ 	 account for the auto-increment in the loop above. */
++ #ifdef HANDLE_MULTIBYTE
++       string--;
++       ADVANCE_CHAR_P (string, send - string);
++       string++;
++ #else
++       ADVANCE_CHAR_P (string, send - string);
++ #endif
++     }
++   return (0);
++ }
++ 
+  static char *globtext;
+  static char *globorig;
+***************
+*** 3878,3882 ****
+      }      
+  
+!   if (t && glob_pattern_p (t) == 0)
+      rl_explicit_arg = 1;	/* XXX - force glob_complete_word to append `*' */
+    FREE (t);
+--- 3934,3938 ----
+      }      
+  
+!   if (t && completion_glob_pattern (t) == 0)
+      rl_explicit_arg = 1;	/* XXX - force glob_complete_word to append `*' */
+    FREE (t);
+*** ../bash-5.0/lib/glob/glob_loop.c	2018-12-31 13:35:15.000000000 -0500
+--- lib/glob/glob_loop.c	2019-01-09 09:44:36.000000000 -0500
+***************
+*** 55,59 ****
+  
+        case L('\\'):
+- #if 0
+  	/* Don't let the pattern end in a backslash (GMATCH returns no match
+  	   if the pattern ends in a backslash anyway), but otherwise return 1,
+--- 55,58 ----
+***************
+*** 61,69 ****
+  	   and it can be removed. */
+  	return (*p != L('\0'));
+- #else
+- 	/* The pattern may not end with a backslash. */
+- 	if (*p++ == L('\0'))
+- 	  return 0;
+- #endif
+        }
+  
+--- 60,63 ----


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2016-11-27  1:45 Mike Frysinger
  0 siblings, 0 replies; 18+ messages in thread
From: Mike Frysinger @ 2016-11-27  1:45 UTC (permalink / raw
  To: gentoo-commits

commit:     1bf1ceeb04a2f57e1e5e1636a8c288c4d0db6682
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 27 01:44:27 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Nov 27 01:44:27 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1bf1ceeb

app-shells/bash: upstream fix for crash on invalid popd #600174

 app-shells/bash/bash-4.4-r1.ebuild                 | 248 ---------------------
 .../{bash-4.4_p5.ebuild => bash-4.4_p5-r1.ebuild}  |   1 +
 .../bash/files/bash-4.4-popd-offset-overflow.patch |  30 +++
 3 files changed, 31 insertions(+), 248 deletions(-)

diff --git a/app-shells/bash/bash-4.4-r1.ebuild b/app-shells/bash/bash-4.4-r1.ebuild
deleted file mode 100644
index 37e7af7..00000000
--- a/app-shells/bash/bash-4.4-r1.ebuild
+++ /dev/null
@@ -1,248 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="5"
-
-inherit eutils flag-o-matic toolchain-funcs multilib prefix
-
-# Official patchlevel
-# See ftp://ftp.cwru.edu/pub/bash/bash-4.3-patches/
-PLEVEL=${PV##*_p}
-MY_PV=${PV/_p*}
-MY_PV=${MY_PV/_/-}
-MY_P=${PN}-${MY_PV}
-[[ ${PV} != *_p* ]] && PLEVEL=0
-patches() {
-	local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}}
-	[[ ${plevel} -eq 0 ]] && return 1
-	eval set -- {1..${plevel}}
-	set -- $(printf "${pn}${pv/\.}-%03d " "$@")
-	if [[ ${opt} == -s ]] ; then
-		echo "${@/#/${DISTDIR}/}"
-	else
-		local u
-		for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do
-			printf "${u}/${pn}-${pv}-patches/%s " "$@"
-		done
-	fi
-}
-
-# The version of readline this bash normally ships with.
-READLINE_VER="7.0"
-
-DESCRIPTION="The standard GNU Bourne again shell"
-HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html"
-case ${PV} in
-*_alpha*|*_beta*|*_rc*) SRC_URI+=" ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz" ;;
-*) SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)" ;;
-esac
-
-LICENSE="GPL-3"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
-IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline"
-
-DEPEND=">=sys-libs/ncurses-5.2-r2:0=
-	readline? ( >=sys-libs/readline-${READLINE_VER}:0= )
-	nls? ( virtual/libintl )"
-RDEPEND="${DEPEND}
-	!<sys-apps/portage-2.1.6.7_p1
-	!<sys-apps/paludis-0.26.0_alpha5"
-# we only need yacc when the .y files get patched (bash42-005)
-#DEPEND+=" virtual/yacc"
-
-S=${WORKDIR}/${MY_P}
-
-pkg_setup() {
-	if is-flag -malign-double ; then #7332
-		eerror "Detected bad CFLAGS '-malign-double'.  Do not use this"
-		eerror "as it breaks LFS (struct stat64) on x86."
-		die "remove -malign-double from your CFLAGS mr ricer"
-	fi
-	if use bashlogger ; then
-		ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
-		ewarn "This will log ALL output you enter into the shell, you have been warned."
-	fi
-}
-
-src_unpack() {
-	unpack ${MY_P}.tar.gz
-}
-
-src_prepare() {
-	# Include official patches
-	[[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
-
-	# Clean out local libs so we know we use system ones w/releases.
-	if [[ ${PV} != *_rc* ]] ; then
-		rm -rf lib/{readline,termcap}/*
-		touch lib/{readline,termcap}/Makefile.in # for config.status
-		sed -ri -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
-
-	# Avoid regenerating docs after patches #407985
-	sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
-	touch -r . doc/*
-
-	epatch_user
-}
-
-src_configure() {
-	local myconf=()
-
-	# For descriptions of these, see config-top.h
-	# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
-	append-cppflags \
-		-DDEFAULT_PATH_VALUE=\'\"${EPREFIX}/usr/local/sbin:${EPREFIX}/usr/local/bin:${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin\"\' \
-		-DSTANDARD_UTILS_PATH=\'\"${EPREFIX}/bin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/usr/sbin\"\' \
-		-DSYS_BASHRC=\'\"${EPREFIX}/etc/bash/bashrc\"\' \
-		-DSYS_BASH_LOGOUT=\'\"${EPREFIX}/etc/bash/bash_logout\"\' \
-		-DNON_INTERACTIVE_LOGIN_SHELLS \
-		-DSSH_SOURCE_BASHRC \
-		$(use bashlogger && echo -DSYSLOG_HISTORY)
-
-	# Don't even think about building this statically without
-	# reading Bug 7714 first.  If you still build it statically,
-	# don't come crying to us with bugs ;).
-	#use static && export LDFLAGS="${LDFLAGS} -static"
-	use nls || myconf+=( --disable-nls )
-
-	# Historically, we always used the builtin readline, but since
-	# our handling of SONAME upgrades has gotten much more stable
-	# in the PM (and the readline ebuild itself preserves the old
-	# libs during upgrades), linking against the system copy should
-	# be safe.
-	# Exact cached version here doesn't really matter as long as it
-	# is at least what's in the DEPEND up above.
-	export ac_cv_rl_version=${READLINE_VER%%_*}
-
-	# Force linking with system curses ... the bundled termcap lib
-	# sucks bad compared to ncurses.  For the most part, ncurses
-	# is here because readline needs it.  But bash itself calls
-	# ncurses in one or two small places :(.
-
-	if [[ ${PV} != *_rc* ]] ; then
-		# Use system readline only with released versions.
-		myconf+=( --with-installed-readline=. )
-	fi
-
-	if use plugins; then
-		append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
-	else
-		# Disable the plugins logic by hand since bash doesn't
-		# provide a way of doing it.
-		export ac_cv_func_dl{close,open,sym}=no \
-			ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
-		sed -i \
-			-e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
-			configure || die
-	fi
-	tc-export AR #444070
-	econf \
-		--docdir='$(datarootdir)'/doc/${PF} \
-		--htmldir='$(docdir)/html' \
-		--with-curses \
-		$(use_with afs) \
-		$(use_enable net net-redirections) \
-		--disable-profiling \
-		$(use_enable mem-scramble) \
-		$(use_with mem-scramble bash-malloc) \
-		$(use_enable readline) \
-		$(use_enable readline history) \
-		$(use_enable readline bang-history) \
-		"${myconf[@]}"
-}
-
-src_compile() {
-	emake
-
-	if use plugins ; then
-		emake -C examples/loadables all others
-	fi
-}
-
-src_install() {
-	local d f
-
-	default
-
-	dodir /bin
-	mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
-	dosym bash /bin/rbash
-
-	insinto /etc/bash
-	doins "${FILESDIR}"/bash_logout
-	doins "$(prefixify_ro "${FILESDIR}"/bashrc)"
-	keepdir /etc/bash/bashrc.d
-	insinto /etc/skel
-	for f in bash{_logout,_profile,rc} ; do
-		newins "${FILESDIR}"/dot-${f} .${f}
-	done
-
-	local sed_args=(
-		-e "s:#${USERLAND}#@::"
-		-e '/#@/d'
-	)
-	if ! use readline ; then
-		sed_args+=( #432338
-			-e '/^shopt -s histappend/s:^:#:'
-			-e 's:use_color=true:use_color=false:'
-		)
-	fi
-	sed -i \
-		"${sed_args[@]}" \
-		"${ED}"/etc/skel/.bashrc \
-		"${ED}"/etc/bash/bashrc || die
-
-	if use plugins ; then
-		exeinto /usr/$(get_libdir)/bash
-		doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
-		insinto /usr/include/bash-plugins
-		doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
-	fi
-
-	if use examples ; then
-		for d in examples/{functions,misc,scripts,startup-files} ; do
-			exeinto /usr/share/doc/${PF}/${d}
-			insinto /usr/share/doc/${PF}/${d}
-			for f in ${d}/* ; do
-				if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
-					doexe ${f}
-				else
-					doins ${f}
-				fi
-			done
-		done
-	fi
-
-	doman doc/*.1
-	newdoc CWRU/changelog ChangeLog
-	dosym bash.info /usr/share/info/bashref.info
-}
-
-pkg_preinst() {
-	if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
-		mkdir -p "${EROOT}"/etc/bash
-		mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
-	fi
-
-	if [[ -L ${EROOT}/bin/sh ]] ; then
-		# rewrite the symlink to ensure that its mtime changes. having /bin/sh
-		# missing even temporarily causes a fatal error with paludis.
-		local target=$(readlink "${EROOT}"/bin/sh)
-		local tmp=$(emktemp "${EROOT}"/bin)
-		ln -sf "${target}" "${tmp}"
-		mv -f "${tmp}" "${EROOT}"/bin/sh
-	fi
-}
-
-pkg_postinst() {
-	# If /bin/sh does not exist, provide it
-	if [[ ! -e ${EROOT}/bin/sh ]] ; then
-		ln -sf bash "${EROOT}"/bin/sh
-	fi
-}

diff --git a/app-shells/bash/bash-4.4_p5.ebuild b/app-shells/bash/bash-4.4_p5-r1.ebuild
similarity index 99%
rename from app-shells/bash/bash-4.4_p5.ebuild
rename to app-shells/bash/bash-4.4_p5-r1.ebuild
index 63ac792..d984d05 100644
--- a/app-shells/bash/bash-4.4_p5.ebuild
+++ b/app-shells/bash/bash-4.4_p5-r1.ebuild
@@ -72,6 +72,7 @@ src_unpack() {
 src_prepare() {
 	# Include official patches
 	[[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
+	epatch "${FILESDIR}"/${PN}-4.4-popd-offset-overflow.patch #600174
 
 	# Clean out local libs so we know we use system ones w/releases.
 	if [[ ${PV} != *_rc* ]] ; then

diff --git a/app-shells/bash/files/bash-4.4-popd-offset-overflow.patch b/app-shells/bash/files/bash-4.4-popd-offset-overflow.patch
new file mode 100644
index 00000000..c6ef19d
--- /dev/null
+++ b/app-shells/bash/files/bash-4.4-popd-offset-overflow.patch
@@ -0,0 +1,30 @@
+https://bugs.gentoo.org/600174
+https://lists.gnu.org/archive/html/bug-bash/2016-11/msg00099.html
+
+*** ../bash-4.4-patched/builtins/pushd.def	2016-01-25 13:31:49.000000000 -0500
+--- builtins/pushd.def	2016-10-28 10:46:49.000000000 -0400
+***************
+*** 366,370 ****
+      }
+  
+!   if (which > directory_list_offset || (directory_list_offset == 0 && which == 0))
+      {
+        pushd_error (directory_list_offset, which_word ? which_word : "");
+--- 366,370 ----
+      }
+  
+!   if (which > directory_list_offset || (which < -directory_list_offset) || (directory_list_offset == 0 && which == 0))
+      {
+        pushd_error (directory_list_offset, which_word ? which_word : "");
+***************
+*** 388,391 ****
+--- 388,396 ----
+  	 of the list into place. */
+        i = (direction == '+') ? directory_list_offset - which : which;
++       if (i < 0 || i > directory_list_offset)
++ 	{
++ 	  pushd_error (directory_list_offset, which_word ? which_word : "");
++ 	  return (EXECUTION_FAILURE);
++ 	}
+        free (pushd_directory_list[i]);
+        directory_list_offset--;


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2016-11-10  6:03 Mike Frysinger
  0 siblings, 0 replies; 18+ messages in thread
From: Mike Frysinger @ 2016-11-10  6:03 UTC (permalink / raw
  To: gentoo-commits

commit:     6a6d6915dfc68f4a67a7e8c03265d9e02ed39425
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 10 06:01:33 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Nov 10 06:01:33 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6a6d6915

app-shells/bash: drop unused memory patch #597006

The patch applies against the readline source which we delete in the
bash ebuild, so it doesn't do anything useful here.

 app-shells/bash/bash-4.4-r1.ebuild                 |  3 ---
 .../bash/files/bash-4.4-history-alloclist.patch    | 26 ----------------------
 2 files changed, 29 deletions(-)

diff --git a/app-shells/bash/bash-4.4-r1.ebuild b/app-shells/bash/bash-4.4-r1.ebuild
index caed46f..41a6506 100644
--- a/app-shells/bash/bash-4.4-r1.ebuild
+++ b/app-shells/bash/bash-4.4-r1.ebuild
@@ -74,9 +74,6 @@ src_prepare() {
 	# Include official patches
 	[[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
 
-	# bug 597006: large HISTFILESIZE value may result in upfront memory exhaustion
-	epatch "${FILESDIR}"/${PN}-4.4-history-alloclist.patch
-
 	# Clean out local libs so we know we use system ones w/releases.
 	if [[ ${PV} != *_rc* ]] ; then
 		rm -rf lib/{readline,termcap}/*

diff --git a/app-shells/bash/files/bash-4.4-history-alloclist.patch b/app-shells/bash/files/bash-4.4-history-alloclist.patch
deleted file mode 100644
index 8072bde..00000000
--- a/app-shells/bash/files/bash-4.4-history-alloclist.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-*** ../bash-4.4/lib/readline/history.c	2015-12-28 13:50:31.000000000 -0500
---- lib/readline/history.c	2016-09-30 14:28:40.000000000 -0400
-***************
-*** 58,61 ****
---- 58,63 ----
-  #define DEFAULT_HISTORY_INITIAL_SIZE	502
-  
-+ #define MAX_HISTORY_INITIAL_SIZE	8192
-+ 
-  /* The number of slots to increase the_history by. */
-  #define DEFAULT_HISTORY_GROW_SIZE 50
-***************
-*** 308,312 ****
-  	{
-  	  if (history_stifled && history_max_entries > 0)
-! 	    history_size = history_max_entries + 2;
-  	  else
-  	    history_size = DEFAULT_HISTORY_INITIAL_SIZE;
---- 310,316 ----
-  	{
-  	  if (history_stifled && history_max_entries > 0)
-! 	    history_size = (history_max_entries > MAX_HISTORY_INITIAL_SIZE)
-! 				? MAX_HISTORY_INITIAL_SIZE
-! 				: history_max_entries + 2;
-  	  else
-  	    history_size = DEFAULT_HISTORY_INITIAL_SIZE;


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2016-09-20 14:59 Lars Wendler
  0 siblings, 0 replies; 18+ messages in thread
From: Lars Wendler @ 2016-09-20 14:59 UTC (permalink / raw
  To: gentoo-commits

commit:     7722e02ff41d7e30b1e2226d0cabd4458cd6567c
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 20 14:59:44 2016 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Tue Sep 20 14:59:44 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7722e02f

app-shells/bash: Revbump to fix CVE-2016-0634 (bug #594496).

Package-Manager: portage-2.3.1
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 app-shells/bash/bash-4.3_p46-r1.ebuild             | 254 +++++++++++++++++++++
 .../bash/files/bash-4.3-prompt-string-comsub.patch | 118 ++++++++++
 2 files changed, 372 insertions(+)

diff --git a/app-shells/bash/bash-4.3_p46-r1.ebuild b/app-shells/bash/bash-4.3_p46-r1.ebuild
new file mode 100644
index 00000000..85d4eda
--- /dev/null
+++ b/app-shells/bash/bash-4.3_p46-r1.ebuild
@@ -0,0 +1,254 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils flag-o-matic toolchain-funcs multilib
+
+# Official patchlevel
+# See ftp://ftp.cwru.edu/pub/bash/bash-4.3-patches/
+PLEVEL=${PV##*_p}
+MY_PV=${PV/_p*}
+MY_PV=${MY_PV/_/-}
+MY_P=${PN}-${MY_PV}
+[[ ${PV} != *_p* ]] && PLEVEL=0
+patches() {
+	local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}}
+	[[ ${plevel} -eq 0 ]] && return 1
+	eval set -- {1..${plevel}}
+	set -- $(printf "${pn}${pv/\.}-%03d " "$@")
+	if [[ ${opt} == -s ]] ; then
+		echo "${@/#/${DISTDIR}/}"
+	else
+		local u
+		for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do
+			printf "${u}/${pn}-${pv}-patches/%s " "$@"
+		done
+	fi
+}
+
+# The version of readline this bash normally ships with.
+READLINE_VER="6.3"
+
+DESCRIPTION="The standard GNU Bourne again shell"
+HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html"
+SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
+[[ ${PV} == *_rc* ]] && SRC_URI+=" ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline vanilla"
+
+DEPEND=">=sys-libs/ncurses-5.2-r2:0=
+	readline? ( >=sys-libs/readline-${READLINE_VER}:0= )
+	nls? ( virtual/libintl )"
+RDEPEND="${DEPEND}
+	!<sys-apps/portage-2.1.6.7_p1
+	!<sys-apps/paludis-0.26.0_alpha5"
+# we only need yacc when the .y files get patched (bash42-005)
+DEPEND+=" virtual/yacc"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-4.3-mapfile-improper-array-name-validation.patch
+	"${FILESDIR}"/${PN}-4.3-arrayfunc.patch
+	"${FILESDIR}"/${PN}-4.3-protos.patch
+	# CVE-2016-0634 / bug #594496
+	"${FILESDIR}"/${PN}-4.3-prompt-string-comsub.patch
+)
+
+S=${WORKDIR}/${MY_P}
+
+pkg_setup() {
+	if is-flag -malign-double ; then #7332
+		eerror "Detected bad CFLAGS '-malign-double'.  Do not use this"
+		eerror "as it breaks LFS (struct stat64) on x86."
+		die "remove -malign-double from your CFLAGS mr ricer"
+	fi
+	if use bashlogger ; then
+		ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
+		ewarn "This will log ALL output you enter into the shell, you have been warned."
+	fi
+}
+
+src_unpack() {
+	unpack ${MY_P}.tar.gz
+}
+
+src_prepare() {
+	# Include official patches
+	[[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
+
+	# Clean out local libs so we know we use system ones w/releases.
+	if [[ ${PV} != *_rc* ]] ; then
+		rm -rf lib/{readline,termcap}/*
+		touch lib/{readline,termcap}/Makefile.in # for config.status
+		sed -ri -e 's:\$[(](RL|HIST)_LIBSRC[)]/[[:alpha:]]*.h::g' Makefile.in || die
+	fi
+
+	# Avoid regenerating docs after patches #407985
+	sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
+	touch -r . doc/*
+
+	epatch "${PATCHES[@]}"
+
+	epatch_user
+}
+
+src_configure() {
+	local myconf=()
+
+	# For descriptions of these, see config-top.h
+	# bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
+	append-cppflags \
+		-DDEFAULT_PATH_VALUE=\'\"${EPREFIX}/usr/local/sbin:${EPREFIX}/usr/local/bin:${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin\"\' \
+		-DSTANDARD_UTILS_PATH=\'\"${EPREFIX}/bin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/usr/sbin\"\' \
+		-DSYS_BASHRC=\'\"${EPREFIX}/etc/bash/bashrc\"\' \
+		-DSYS_BASH_LOGOUT=\'\"${EPREFIX}/etc/bash/bash_logout\"\' \
+		-DNON_INTERACTIVE_LOGIN_SHELLS \
+		-DSSH_SOURCE_BASHRC \
+		-DUSE_MKTEMP -DUSE_MKSTEMP \
+		$(use bashlogger && echo -DSYSLOG_HISTORY)
+
+	# Don't even think about building this statically without
+	# reading Bug 7714 first.  If you still build it statically,
+	# don't come crying to us with bugs ;).
+	#use static && export LDFLAGS="${LDFLAGS} -static"
+	use nls || myconf+=( --disable-nls )
+
+	# Historically, we always used the builtin readline, but since
+	# our handling of SONAME upgrades has gotten much more stable
+	# in the PM (and the readline ebuild itself preserves the old
+	# libs during upgrades), linking against the system copy should
+	# be safe.
+	# Exact cached version here doesn't really matter as long as it
+	# is at least what's in the DEPEND up above.
+	export ac_cv_rl_version=${READLINE_VER}
+
+	# Force linking with system curses ... the bundled termcap lib
+	# sucks bad compared to ncurses.  For the most part, ncurses
+	# is here because readline needs it.  But bash itself calls
+	# ncurses in one or two small places :(.
+
+	if [[ ${PV} != *_rc* ]] ; then
+		# Use system readline only with released versions.
+		myconf+=( --with-installed-readline=. )
+	fi
+
+	if use plugins; then
+		append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
+	else
+		# Disable the plugins logic by hand since bash doesn't
+		# provide a way of doing it.
+		export ac_cv_func_dl{close,open,sym}=no \
+			ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
+		sed -i \
+			-e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
+			configure || die
+	fi
+	tc-export AR #444070
+	econf \
+		--docdir='$(datarootdir)'/doc/${PF} \
+		--htmldir='$(docdir)/html' \
+		--with-curses \
+		$(use_with afs) \
+		$(use_enable net net-redirections) \
+		--disable-profiling \
+		$(use_enable mem-scramble) \
+		$(use_with mem-scramble bash-malloc) \
+		$(use_enable readline) \
+		$(use_enable readline history) \
+		$(use_enable readline bang-history) \
+		"${myconf[@]}"
+}
+
+src_compile() {
+	emake
+
+	if use plugins ; then
+		emake -C examples/loadables all others
+	fi
+}
+
+src_install() {
+	local d f
+
+	default
+
+	dodir /bin
+	mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
+	dosym bash /bin/rbash
+
+	insinto /etc/bash
+	doins "${FILESDIR}"/bash_logout
+	doins "${FILESDIR}"/bashrc
+	keepdir /etc/bash/bashrc.d
+	insinto /etc/skel
+	for f in bash{_logout,_profile,rc} ; do
+		newins "${FILESDIR}"/dot-${f} .${f}
+	done
+
+	local sed_args=(
+		-e "s:#${USERLAND}#@::"
+		-e '/#@/d'
+	)
+	if ! use readline ; then
+		sed_args+=( #432338
+			-e '/^shopt -s histappend/s:^:#:'
+			-e 's:use_color=true:use_color=false:'
+		)
+	fi
+	sed -i \
+		"${sed_args[@]}" \
+		"${ED}"/etc/skel/.bashrc \
+		"${ED}"/etc/bash/bashrc || die
+
+	if use plugins ; then
+		exeinto /usr/$(get_libdir)/bash
+		doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
+		insinto /usr/include/bash-plugins
+		doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
+	fi
+
+	if use examples ; then
+		for d in examples/{functions,misc,scripts,startup-files} ; do
+			exeinto /usr/share/doc/${PF}/${d}
+			insinto /usr/share/doc/${PF}/${d}
+			for f in ${d}/* ; do
+				if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
+					doexe ${f}
+				else
+					doins ${f}
+				fi
+			done
+		done
+	fi
+
+	doman doc/*.1
+	newdoc CWRU/changelog ChangeLog
+	dosym bash.info /usr/share/info/bashref.info
+}
+
+pkg_preinst() {
+	if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
+		mkdir -p "${EROOT}"/etc/bash
+		mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
+	fi
+
+	if [[ -L ${EROOT}/bin/sh ]] ; then
+		# rewrite the symlink to ensure that its mtime changes. having /bin/sh
+		# missing even temporarily causes a fatal error with paludis.
+		local target=$(readlink "${EROOT}"/bin/sh)
+		local tmp=$(emktemp "${EROOT}"/bin)
+		ln -sf "${target}" "${tmp}"
+		mv -f "${tmp}" "${EROOT}"/bin/sh
+	fi
+}
+
+pkg_postinst() {
+	# If /bin/sh does not exist, provide it
+	if [[ ! -e ${EROOT}/bin/sh ]] ; then
+		ln -sf bash "${EROOT}"/bin/sh
+	fi
+}

diff --git a/app-shells/bash/files/bash-4.3-prompt-string-comsub.patch b/app-shells/bash/files/bash-4.3-prompt-string-comsub.patch
new file mode 100644
index 00000000..175bc53
--- /dev/null
+++ b/app-shells/bash/files/bash-4.3-prompt-string-comsub.patch
@@ -0,0 +1,118 @@
+http://seclists.org/oss-sec/2016/q3/538
+https://bugs.gentoo.org/594496
+
+*** ../bash-4.3-patched/parse.y	2015-08-13 15:11:54.000000000 -0400
+--- parse.y	2016-03-07 15:44:14.000000000 -0500
+***************
+*** 5259,5263 ****
+    int result_size, result_index;
+    int c, n, i;
+!   char *temp, octal_string[4];
+    struct tm *tm;  
+    time_t the_time;
+--- 5259,5263 ----
+    int result_size, result_index;
+    int c, n, i;
+!   char *temp, *t_host, octal_string[4];
+    struct tm *tm;  
+    time_t the_time;
+***************
+*** 5407,5411 ****
+  	    case 's':
+  	      temp = base_pathname (shell_name);
+! 	      temp = savestring (temp);
+  	      goto add_string;
+  
+--- 5407,5415 ----
+  	    case 's':
+  	      temp = base_pathname (shell_name);
+! 	      /* Try to quote anything the user can set in the file system */
+! 	      if (promptvars || posixly_correct)
+! 		temp = sh_backslash_quote_for_double_quotes (temp);
+! 	      else
+! 		temp = savestring (temp);
+  	      goto add_string;
+  
+***************
+*** 5497,5503 ****
+  	    case 'h':
+  	    case 'H':
+! 	      temp = savestring (current_host_name);
+! 	      if (c == 'h' && (t = (char *)strchr (temp, '.')))
+  		*t = '\0';
+  	      goto add_string;
+  
+--- 5501,5515 ----
+  	    case 'h':
+  	    case 'H':
+! 	      t_host = savestring (current_host_name);
+! 	      if (c == 'h' && (t = (char *)strchr (t_host, '.')))
+  		*t = '\0';
++ 	      if (promptvars || posixly_correct)
++ 		/* Make sure that expand_prompt_string is called with a
++ 		   second argument of Q_DOUBLE_QUOTES if we use this
++ 		   function here. */
++ 		temp = sh_backslash_quote_for_double_quotes (t_host);
++ 	      else
++ 		temp = savestring (t_host);
++ 	      free (t_host);
+  	      goto add_string;
+  
+*** ../bash-4.3-patched/y.tab.c	2015-08-13 15:11:54.000000000 -0400
+--- y.tab.c	2016-03-07 15:44:14.000000000 -0500
+***************
+*** 7571,7575 ****
+    int result_size, result_index;
+    int c, n, i;
+!   char *temp, octal_string[4];
+    struct tm *tm;  
+    time_t the_time;
+--- 7571,7575 ----
+    int result_size, result_index;
+    int c, n, i;
+!   char *temp, *t_host, octal_string[4];
+    struct tm *tm;  
+    time_t the_time;
+***************
+*** 7719,7723 ****
+  	    case 's':
+  	      temp = base_pathname (shell_name);
+! 	      temp = savestring (temp);
+  	      goto add_string;
+  
+--- 7719,7727 ----
+  	    case 's':
+  	      temp = base_pathname (shell_name);
+! 	      /* Try to quote anything the user can set in the file system */
+! 	      if (promptvars || posixly_correct)
+! 		temp = sh_backslash_quote_for_double_quotes (temp);
+! 	      else
+! 		temp = savestring (temp);
+  	      goto add_string;
+  
+***************
+*** 7809,7815 ****
+  	    case 'h':
+  	    case 'H':
+! 	      temp = savestring (current_host_name);
+! 	      if (c == 'h' && (t = (char *)strchr (temp, '.')))
+  		*t = '\0';
+  	      goto add_string;
+  
+--- 7813,7827 ----
+  	    case 'h':
+  	    case 'H':
+! 	      t_host = savestring (current_host_name);
+! 	      if (c == 'h' && (t = (char *)strchr (t_host, '.')))
+  		*t = '\0';
++ 	      if (promptvars || posixly_correct)
++ 		/* Make sure that expand_prompt_string is called with a
++ 		   second argument of Q_DOUBLE_QUOTES if we use this
++ 		   function here. */
++ 		temp = sh_backslash_quote_for_double_quotes (t_host);
++ 	      else
++ 		temp = savestring (t_host);
++ 	      free (t_host);
+  	      goto add_string;
+  
+


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2016-01-26  7:23 Mike Frysinger
  0 siblings, 0 replies; 18+ messages in thread
From: Mike Frysinger @ 2016-01-26  7:23 UTC (permalink / raw
  To: gentoo-commits

commit:     e3bf9d25cca2464b602a4aaafad784bbefbf322c
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 25 00:59:49 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Jan 26 07:12:10 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e3bf9d25

app-shells/bash: merge bashrc-r# files back to bashrc

This makes the history easier to track.

 app-shells/bash/bash-4.3_p39_pre0.ebuild |   2 +-
 app-shells/bash/bash-4.3_p42-r1.ebuild   |   2 +-
 app-shells/bash/bash-4.4_beta.ebuild     |   2 +-
 app-shells/bash/files/bashrc-r1          |  92 --------------------------
 app-shells/bash/files/bashrc-r2          | 108 -------------------------------
 5 files changed, 3 insertions(+), 203 deletions(-)

diff --git a/app-shells/bash/bash-4.3_p39_pre0.ebuild b/app-shells/bash/bash-4.3_p39_pre0.ebuild
index 2c852ee..4bc8ea9 100644
--- a/app-shells/bash/bash-4.3_p39_pre0.ebuild
+++ b/app-shells/bash/bash-4.3_p39_pre0.ebuild
@@ -118,7 +118,7 @@ src_install() {
 
 	insinto /etc/bash
 	doins "${FILESDIR}"/bash_logout
-	newins "${FILESDIR}"/bashrc-r2 bashrc
+	doins "${FILESDIR}"/bashrc
 	keepdir /etc/bash/bashrc.d
 	insinto /etc/skel
 	for f in bash{_logout,_profile,rc} ; do

diff --git a/app-shells/bash/bash-4.3_p42-r1.ebuild b/app-shells/bash/bash-4.3_p42-r1.ebuild
index 2ffc014..8e9fbc2 100644
--- a/app-shells/bash/bash-4.3_p42-r1.ebuild
+++ b/app-shells/bash/bash-4.3_p42-r1.ebuild
@@ -176,7 +176,7 @@ src_install() {
 
 	insinto /etc/bash
 	doins "${FILESDIR}"/bash_logout
-	newins "${FILESDIR}"/bashrc-r2 bashrc
+	doins "${FILESDIR}"/bashrc
 	keepdir /etc/bash/bashrc.d
 	insinto /etc/skel
 	for f in bash{_logout,_profile,rc} ; do

diff --git a/app-shells/bash/bash-4.4_beta.ebuild b/app-shells/bash/bash-4.4_beta.ebuild
index fb37c20..4028694 100644
--- a/app-shells/bash/bash-4.4_beta.ebuild
+++ b/app-shells/bash/bash-4.4_beta.ebuild
@@ -173,7 +173,7 @@ src_install() {
 
 	insinto /etc/bash
 	doins "${FILESDIR}"/bash_logout
-	newins "${FILESDIR}"/bashrc-r2 bashrc
+	doins "${FILESDIR}"/bashrc
 	keepdir /etc/bash/bashrc.d
 	insinto /etc/skel
 	for f in bash{_logout,_profile,rc} ; do

diff --git a/app-shells/bash/files/bashrc-r1 b/app-shells/bash/files/bashrc-r1
deleted file mode 100644
index 3000709..0000000
--- a/app-shells/bash/files/bashrc-r1
+++ /dev/null
@@ -1,92 +0,0 @@
-# /etc/bash/bashrc
-#
-# This file is sourced by all *interactive* bash shells on startup,
-# including some apparently interactive shells such as scp and rcp
-# that can't tolerate any output.  So make sure this doesn't display
-# anything or bad things will happen !
-
-
-# Test for an interactive shell.  There is no need to set anything
-# past this point for scp and rcp, and it's important to refrain from
-# outputting anything in those cases.
-if [[ $- != *i* ]] ; then
-	# Shell is non-interactive.  Be done now!
-	return
-fi
-
-# Bash won't get SIGWINCH if another process is in the foreground.
-# Enable checkwinsize so that bash will check the terminal size when
-# it regains control.  #65623
-# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
-shopt -s checkwinsize
-
-# Enable history appending instead of overwriting.  #139609
-shopt -s histappend
-
-# Change the window title of X terminals 
-case ${TERM} in
-	xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*)
-		PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
-		;;
-	screen*)
-		PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\033\\"'
-		;;
-esac
-
-use_color=false
-#BSD#@# BSD doesn't typically come with dircolors so we need
-#BSD#@# to hardcode some terminals in here.
-#BSD#@case ${TERM} in
-#BSD#@	xterm*|rxvt*|Eterm|aterm|kterm|gnome*|screen|cons25) use_color=true;;
-#BSD#@esac
-
-# Set colorful PS1 only on colorful terminals.
-# dircolors --print-database uses its own built-in database
-# instead of using /etc/DIR_COLORS.  Try to use the external file
-# first to take advantage of user additions.  Use internal bash
-# globbing instead of external grep binary.
-safe_term=${TERM//[^[:alnum:]]/?}   # sanitize TERM
-match_lhs=""
-[[ -f ~/.dir_colors   ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
-[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
-[[ -z ${match_lhs}    ]] \
-	&& type -P dircolors >/dev/null \
-	&& match_lhs=$(dircolors --print-database)
-[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
-
-if ${use_color} ; then
-	# Enable colors for ls, etc.  Prefer ~/.dir_colors #64489
-	if type -P dircolors >/dev/null ; then
-		if [[ -f ~/.dir_colors ]] ; then
-			eval $(dircolors -b ~/.dir_colors)
-		elif [[ -f /etc/DIR_COLORS ]] ; then
-			eval $(dircolors -b /etc/DIR_COLORS)
-		fi
-	fi
-
-	if [[ ${EUID} == 0 ]] ; then
-		PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
-	else
-		PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
-	fi
-
-	#BSD#@export CLICOLOR=1
-	#GNU#@alias ls='ls --color=auto'
-	alias grep='grep --colour=auto'
-	alias egrep='egrep --colour=auto'
-	alias fgrep='fgrep --colour=auto'
-else
-	if [[ ${EUID} == 0 ]] ; then
-		# show root@ when we don't have colors
-		PS1='\u@\h \W \$ '
-	else
-		PS1='\u@\h \w \$ '
-	fi
-fi
-
-for sh in /etc/bash/bashrc.d/* ; do
-	[[ -r ${sh} ]] && source "${sh}"
-done
-
-# Try to keep environment pollution down, EPA loves us.
-unset use_color safe_term match_lhs sh

diff --git a/app-shells/bash/files/bashrc-r2 b/app-shells/bash/files/bashrc-r2
deleted file mode 100644
index c9bd88e..0000000
--- a/app-shells/bash/files/bashrc-r2
+++ /dev/null
@@ -1,108 +0,0 @@
-# /etc/bash/bashrc
-#
-# This file is sourced by all *interactive* bash shells on startup,
-# including some apparently interactive shells such as scp and rcp
-# that can't tolerate any output.  So make sure this doesn't display
-# anything or bad things will happen !
-
-
-# Test for an interactive shell.  There is no need to set anything
-# past this point for scp and rcp, and it's important to refrain from
-# outputting anything in those cases.
-if [[ $- != *i* ]] ; then
-	# Shell is non-interactive.  Be done now!
-	return
-fi
-
-# Bash won't get SIGWINCH if another process is in the foreground.
-# Enable checkwinsize so that bash will check the terminal size when
-# it regains control.  #65623
-# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
-shopt -s checkwinsize
-
-# Disable completion when the input buffer is empty.  i.e. Hitting tab
-# and waiting a long time for bash to expand all of $PATH.
-shopt -s no_empty_cmd_completion
-
-# Enable history appending instead of overwriting when exiting.  #139609
-shopt -s histappend
-
-# Save each command to the history file as it's executed.  #517342
-# This does mean sessions get interleaved when reading later on, but this
-# way the history is always up to date.  History is not synced across live
-# sessions though; that is what `history -n` does.
-# Disabled by default due to concerns related to system recovery when $HOME
-# is under duress, or lives somewhere flaky (like NFS).  Constantly syncing
-# the history will halt the shell prompt until it's finished.
-#PROMPT_COMMAND='history -a'
-
-# Change the window title of X terminals 
-case ${TERM} in
-	xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*)
-		PS1='\[\033]0;\u@\h:\w\007\]'
-		;;
-	screen*)
-		PS1='\[\033k\u@\h:\w\033\\\]'
-		;;
-	*)
-		unset PS1
-		;;
-esac
-
-use_color=false
-#BSD#@# BSD doesn't typically come with dircolors so we need
-#BSD#@# to hardcode some terminals in here.
-#BSD#@case ${TERM} in
-#BSD#@	xterm*|rxvt*|Eterm|aterm|kterm|gnome*|screen|cons25) use_color=true;;
-#BSD#@esac
-
-# Set colorful PS1 only on colorful terminals.
-# dircolors --print-database uses its own built-in database
-# instead of using /etc/DIR_COLORS.  Try to use the external file
-# first to take advantage of user additions.  Use internal bash
-# globbing instead of external grep binary.
-safe_term=${TERM//[^[:alnum:]]/?}   # sanitize TERM
-match_lhs=""
-[[ -f ~/.dir_colors   ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
-[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
-[[ -z ${match_lhs}    ]] \
-	&& type -P dircolors >/dev/null \
-	&& match_lhs=$(dircolors --print-database)
-[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
-
-if ${use_color} ; then
-	# Enable colors for ls, etc.  Prefer ~/.dir_colors #64489
-	if type -P dircolors >/dev/null ; then
-		if [[ -f ~/.dir_colors ]] ; then
-			eval $(dircolors -b ~/.dir_colors)
-		elif [[ -f /etc/DIR_COLORS ]] ; then
-			eval $(dircolors -b /etc/DIR_COLORS)
-		fi
-	fi
-
-	if [[ ${EUID} == 0 ]] ; then
-		PS1+='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
-	else
-		PS1+='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
-	fi
-
-	#BSD#@export CLICOLOR=1
-	#GNU#@alias ls='ls --color=auto'
-	alias grep='grep --colour=auto'
-	alias egrep='egrep --colour=auto'
-	alias fgrep='fgrep --colour=auto'
-else
-	if [[ ${EUID} == 0 ]] ; then
-		# show root@ when we don't have colors
-		PS1+='\u@\h \W \$ '
-	else
-		PS1+='\u@\h \w \$ '
-	fi
-fi
-
-for sh in /etc/bash/bashrc.d/* ; do
-	[[ -r ${sh} ]] && source "${sh}"
-done
-
-# Try to keep environment pollution down, EPA loves us.
-unset use_color safe_term match_lhs sh


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
@ 2015-10-20 20:35 Mike Frysinger
  0 siblings, 0 replies; 18+ messages in thread
From: Mike Frysinger @ 2015-10-20 20:35 UTC (permalink / raw
  To: gentoo-commits

commit:     d3b9fc42cadf308da7fab21c338cca55aa778ae7
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 20 20:34:01 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Oct 20 20:34:46 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d3b9fc42

app-shells/bash: backport /dev/fd fix to older versions #431850

 app-shells/bash/bash-2.05b_p13.ebuild              |  1 +
 app-shells/bash/bash-3.0_p22.ebuild                |  1 +
 app-shells/bash/bash-3.1_p23.ebuild                |  1 +
 app-shells/bash/bash-3.2_p57.ebuild                |  1 +
 app-shells/bash/bash-4.0_p44.ebuild                |  1 +
 app-shells/bash/bash-4.1_p17.ebuild                |  1 +
 .../files/bash-3.1-dev-fd-buffer-overflow.patch    | 16 ++++++++
 .../files/bash-4.2-dev-fd-buffer-overflow.patch    | 46 ++++++++++++++++++++++
 8 files changed, 68 insertions(+)

diff --git a/app-shells/bash/bash-2.05b_p13.ebuild b/app-shells/bash/bash-2.05b_p13.ebuild
index 7e69f0f..56d5bcd 100644
--- a/app-shells/bash/bash-2.05b_p13.ebuild
+++ b/app-shells/bash/bash-2.05b_p13.ebuild
@@ -73,6 +73,7 @@ src_prepare() {
 	epatch "${FILESDIR}"/${PN}-2.05b-parallel-build.patch #41002
 	epatch "${FILESDIR}"/${PN}-2.05b-jobs.patch
 	epatch "${FILESDIR}"/${PN}-2.05b-fix-job-warning.patch
+	epatch "${FILESDIR}"/${PN}-3.1-dev-fd-buffer-overflow.patch #431850
 
 	epatch_user
 }

diff --git a/app-shells/bash/bash-3.0_p22.ebuild b/app-shells/bash/bash-3.0_p22.ebuild
index b8d8fe7..33a50c8 100644
--- a/app-shells/bash/bash-3.0_p22.ebuild
+++ b/app-shells/bash/bash-3.0_p22.ebuild
@@ -81,6 +81,7 @@ src_prepare() {
 	epatch "${FILESDIR}"/${PN}-3.0-trap-fg-signals.patch
 	epatch "${FILESDIR}"/${PN}-3.0-pgrp-pipe-fix.patch #92349
 	epatch "${FILESDIR}"/${PN}-3.0-strnlen.patch
+	epatch "${FILESDIR}"/${PN}-3.1-dev-fd-buffer-overflow.patch #431850
 
 	epatch_user
 }

diff --git a/app-shells/bash/bash-3.1_p23.ebuild b/app-shells/bash/bash-3.1_p23.ebuild
index 95ef23b..d984d0d 100644
--- a/app-shells/bash/bash-3.1_p23.ebuild
+++ b/app-shells/bash/bash-3.1_p23.ebuild
@@ -73,6 +73,7 @@ src_prepare() {
 	epatch "${FILESDIR}"/${PN}-3.0-trap-fg-signals.patch
 	epatch "${FILESDIR}"/${PN}-3.1-fix-dash-login-shell.patch #118257
 	epatch "${FILESDIR}"/${PN}-3.1-dev-fd-test-as-user.patch #131875
+	epatch "${FILESDIR}"/${PN}-3.1-dev-fd-buffer-overflow.patch #431850
 
 	epatch_user
 }

diff --git a/app-shells/bash/bash-3.2_p57.ebuild b/app-shells/bash/bash-3.2_p57.ebuild
index 1d373c7..511e7b2 100644
--- a/app-shells/bash/bash-3.2_p57.ebuild
+++ b/app-shells/bash/bash-3.2_p57.ebuild
@@ -75,6 +75,7 @@ src_prepare() {
 	epatch "${FILESDIR}"/${PN}-3.2-ulimit.patch
 	epatch "${FILESDIR}"/${PN}-3.0-trap-fg-signals.patch
 	epatch "${FILESDIR}"/${PN}-3.2-dev-fd-test-as-user.patch #131875
+	epatch "${FILESDIR}"/${PN}-4.2-dev-fd-buffer-overflow.patch #431850
 
 	epatch_user
 }

diff --git a/app-shells/bash/bash-4.0_p44.ebuild b/app-shells/bash/bash-4.0_p44.ebuild
index 543ea45..2d8a80e 100644
--- a/app-shells/bash/bash-4.0_p44.ebuild
+++ b/app-shells/bash/bash-4.0_p44.ebuild
@@ -72,6 +72,7 @@ src_prepare() {
 	epatch "${FILESDIR}"/${PN}-4.0-ldflags-for-build.patch #211947
 	epatch "${FILESDIR}"/${PN}-4.0-negative-return.patch
 	epatch "${FILESDIR}"/${PN}-4.0-parallel-build.patch #267613
+	epatch "${FILESDIR}"/${PN}-4.2-dev-fd-buffer-overflow.patch #431850
 	sed -i '/\.o: .*shell\.h/s:$: pathnames.h:' Makefile.in #267613
 
 	epatch_user

diff --git a/app-shells/bash/bash-4.1_p17.ebuild b/app-shells/bash/bash-4.1_p17.ebuild
index 3bc12cb..ad19cf3 100644
--- a/app-shells/bash/bash-4.1_p17.ebuild
+++ b/app-shells/bash/bash-4.1_p17.ebuild
@@ -68,6 +68,7 @@ src_prepare() {
 	epatch "${FILESDIR}"/${PN}-4.1-fbsd-eaccess.patch #303411
 	sed -i '1i#define NEED_FPURGE_DECL' execute_cmd.c # needs fpurge() decl
 	epatch "${FILESDIR}"/${PN}-4.1-parallel-build.patch
+	epatch "${FILESDIR}"/${PN}-4.2-dev-fd-buffer-overflow.patch #431850
 
 	epatch_user
 }

diff --git a/app-shells/bash/files/bash-3.1-dev-fd-buffer-overflow.patch b/app-shells/bash/files/bash-3.1-dev-fd-buffer-overflow.patch
new file mode 100644
index 0000000..9d08856
--- /dev/null
+++ b/app-shells/bash/files/bash-3.1-dev-fd-buffer-overflow.patch
@@ -0,0 +1,16 @@
+https://bugs.gentoo.org/431850
+
+this is a backport of the upstream bash42-033 patch for bash 3.1/3.0/2.05
+
+--- a/test.c
++++ b/test.c
+@@ -194,7 +194,8 @@
+      trailing slash.  Make sure /dev/fd/xx really uses DEV_FD_PREFIX/xx.
+      On most systems, with the notable exception of linux, this is
+      effectively a no-op. */
+-      char pbuf[32];
++      static char *pbuf = 0;
++      pbuf = xrealloc (pbuf, sizeof (DEV_FD_PREFIX) + strlen (path + 8));
+       strcpy (pbuf, DEV_FD_PREFIX);
+       strcat (pbuf, path + 8);
+       return (stat (pbuf, finfo));

diff --git a/app-shells/bash/files/bash-4.2-dev-fd-buffer-overflow.patch b/app-shells/bash/files/bash-4.2-dev-fd-buffer-overflow.patch
new file mode 100644
index 0000000..bef960a
--- /dev/null
+++ b/app-shells/bash/files/bash-4.2-dev-fd-buffer-overflow.patch
@@ -0,0 +1,46 @@
+https://bugs.gentoo.org/431850
+
+this is a minor tweak to the upstream patch to also apply to bash 4.1/4.0/3.2
+
+			     BASH PATCH REPORT
+			     =================
+
+Bash-Release:	4.2
+Patch-ID:	bash42-033
+
+Bug-Reported-by:	David Leverton <levertond@googlemail.com>
+Bug-Reference-ID:	<4FCCE737.1060603@googlemail.com>
+Bug-Reference-URL:
+
+Bug-Description:
+
+Bash uses a static buffer when expanding the /dev/fd prefix for the test
+and conditional commands, among other uses, when it should use a dynamic
+buffer to avoid buffer overflow.
+
+Patch (apply with `patch -p0'):
+
+*** ../bash-4.2-patched/lib/sh/eaccess.c	2011-01-08 20:50:10.000000000 -0500
+--- lib/sh/eaccess.c	2012-06-04 21:06:43.000000000 -0400
+***************
+*** 83,86 ****
+--- 83,88 ----
+       struct stat *finfo;
+  {
++   static char *pbuf = 0;
++ 
+    if (*path == '\0')
+      {
+***************
+*** 107,111 ****
+       On most systems, with the notable exception of linux, this is
+       effectively a no-op. */
+!       char pbuf[32];
+        strcpy (pbuf, DEV_FD_PREFIX);
+        strcat (pbuf, path + 8);
+--- 109,113 ----
+       On most systems, with the notable exception of linux, this is
+       effectively a no-op. */
+!       pbuf = xrealloc (pbuf, sizeof (DEV_FD_PREFIX) + strlen (path + 8));
+        strcpy (pbuf, DEV_FD_PREFIX);
+        strcat (pbuf, path + 8);


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2023-12-02  4:26 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-15  1:05 [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/ Thomas Deutschmann
  -- strict thread matches above, loose matches on Subject: below --
2023-12-02  4:26 Sam James
2023-11-11  0:21 Sam James
2023-06-23  2:32 Sam James
2023-02-09  4:08 Sam James
2022-10-08 13:25 Sam James
2022-06-13 19:38 Sam James
2021-01-07  0:48 Lars Wendler
2020-12-07 13:18 Lars Wendler
2019-08-15 10:50 Lars Wendler
2019-04-21  9:16 Lars Wendler
2019-03-08 20:56 Lars Wendler
2019-01-09 17:50 Lars Wendler
2016-11-27  1:45 Mike Frysinger
2016-11-10  6:03 Mike Frysinger
2016-09-20 14:59 Lars Wendler
2016-01-26  7:23 Mike Frysinger
2015-10-20 20:35 Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox