summaryrefslogtreecommitdiff
path: root/app-shells/bash
diff options
context:
space:
mode:
Diffstat (limited to 'app-shells/bash')
-rw-r--r--app-shells/bash/Manifest11
-rw-r--r--app-shells/bash/bash-4.4_p12.ebuild253
-rw-r--r--app-shells/bash/bash-5.0_p2-r2.ebuild (renamed from app-shells/bash/bash-5.0.ebuild)14
-rw-r--r--app-shells/bash/bash-5.0_p2.ebuild2
-rw-r--r--app-shells/bash/files/bash-5.0-glob-pattern-backslash.patch133
-rw-r--r--app-shells/bash/files/bash-5.0-globpat-backslashes.patch206
-rw-r--r--app-shells/bash/files/bash-5.0-history-append.patch34
-rw-r--r--app-shells/bash/files/bash-5.0-history-zero-length.patch34
-rw-r--r--app-shells/bash/files/bash-5.0-optimize-connection-fork.patch79
-rw-r--r--app-shells/bash/files/bash-5.0-syslog-history-extern.patch15
10 files changed, 387 insertions, 394 deletions
diff --git a/app-shells/bash/Manifest b/app-shells/bash/Manifest
index 1fd0a995826c..2573c7d0e587 100644
--- a/app-shells/bash/Manifest
+++ b/app-shells/bash/Manifest
@@ -46,7 +46,11 @@ AUX bash-4.4-jobs_overflow.patch 331 BLAKE2B 6897770ef49b5f3def669abaec3d18fd8c7
AUX bash-4.4-popd-offset-overflow.patch 1069 BLAKE2B b23ce9f427cdf252aebdf7330828074230f9b22b5bb59b712d1b148ecbf73aea78ce4e29d353198235b25fa19c4046405c8ae6eeb7fd1cf299d05b732f7cc37b SHA512 535f61b2e0c6423031520700be423750e9177ec96055be781aee5dbdd01c720c1dbc30fffa73b88464527981193c1c6a74ec4139753ef4f40a5bb0f55c4de61c
AUX bash-4.4-set-SHOBJ_STATUS.patch 410 BLAKE2B beddcd4ea00cf6814615896e9842a607280d56086165c38338bfdc8e92922f92219f30419f47dd1bd65939f2a3e48fced612db1332a9ee357465816b4939c678 SHA512 9a723b712279e640396bdaa18f4b5ec48fcbbf253573b0aa1e2e6e2cd9200d8d8a082fb3816154aaff0dd81de2e7a66babbdd682e50e4fc2e93dfaa1af17f04d
AUX bash-4.x-deferred-heredocs.patch 1255 BLAKE2B 944c8d5feaba6a6818fe7e20300fdd44d1e162511c1aaf272bdb4d4c382e100908c16a17e4bef622134116e153f96f61fae4d7985e58cb881012058250a2e7f5 SHA512 9016203189d0b601f0441daec19f902de7387b599a2196c475d76c596dcf9a9c22765a58e7fc5a3117522ec2722475bd166bea271ff3048f31674e8bed2901a0
-AUX bash-5.0-glob-pattern-backslash.patch 3206 BLAKE2B 899d59582a9e93ab71eff1c56121da5d76702cb295785949708a8f786821851c60191d4f1014b967725af427a6d718172ecd380cba4c3936a2ca2a1b79fdcdeb SHA512 e94d573264edcea06e8798796d1259f94ae6017499638b8d4bc83dcaf27b1489d62be9d99065398d514d24c18c14caf8bcb0ec1eb26db6a07df9fe17a667ee60
+AUX bash-5.0-globpat-backslashes.patch 5503 BLAKE2B 1072064fa970b5b212ff2fe7fb6dc90aa49833367176bd7305ca3aa657aca39156437fdc5892deec6a19c880e3abc683475c7a99a8c96ac95fe698a67a9aabb9 SHA512 9263ed70bf93881f925b64cad80c946e0598ad8fe28ac83fb2b6bce83259f9104d04d698bdf7f0adc72abbb8d0760691f7dea63143f768f3501eb927f6a050ae
+AUX bash-5.0-history-append.patch 1150 BLAKE2B cc3d4c2303b37b14da2cbb3130db0c2fa65cdc7f7f8d0a4413042a898c4c48afbedcca03c9dbfc525ab191ddc2b4258fb976a28830e03490011f89a1361974b4 SHA512 9c2fb93c67a5da1e97b293db4b26469fd6813e2cfc8ffd776042529878b96312644d8dc247887d6171c89c0853d552e9f7d5d2c0b2f3d05c25c15e17e6706999
+AUX bash-5.0-history-zero-length.patch 1704 BLAKE2B e94683d245b233b95db8e67a2e536081816ce7d095080b17ee3a9ecef1d3a9094e09e8929eeed5aeff89cd268b49a9ca0cf5cba8aab0695914e88be1b724056c SHA512 2f21c7938c585d0126456b1d878e60d7ddef6a6188f49325cf1f15ab2f7f490ce8458504da8a08cf4b00c84a48f9f43079ff6ee334120d29c1529219d9e9074d
+AUX bash-5.0-optimize-connection-fork.patch 2853 BLAKE2B 88d7d1a73d891b5ba2792c631a654fa8f67e4af11f2899bbebeca835f2a78f27f5ae1b5ce0a53825703b17b1d2e3e38297d97622fab5b0789653d07b0ec686fc SHA512 9192bf50d201d325561552cc6725c2c5e8984bee9fd762089ebe45bfd013fe7a560769b1282189bc97500ea5e49de313d59ddefad544affce61f78a2d605a997
+AUX bash-5.0-syslog-history-extern.patch 376 BLAKE2B d883d3c3adbf8f4d19ecc3c2790754a7f6972682d1679b07d5bc599bdbfc019ba8ad4d1271ec550b59447db0a02f1219c9e6057a0b1c1c6c52f7750a746a07bf SHA512 c8dd17bdd8ccbd73061a7cbcb7351195e703a2c5fc6faf288ec3721fc6e526d88dd4b2201f87078a92ca134b98214ccfa935f82f585322f72e9a41fd51842b6a
AUX bash_logout 205 BLAKE2B b8c0266c3d1e31a714304a2b3b33389f042ae5bd497379f9b15ce31d47d1e3da73ba6536023953b00efe27b687e2ff45d94e3f01a13acc824dc12e31552c5b94 SHA512 7234250c03fc920996a381f9daef9e2d8ab1e1a29acdebed6669d8e0fe1c872a7fa343adf7d9ddc81225b0cd9eb223ba7ad1ff42448aff057fc6d6baa8f04a7d
AUX bashrc 3555 BLAKE2B 31b62f62632feb74cfadb5b831dd862eace55a603c24c07b50826070f599b0571962b315f7f45edb1a0dba91d7a36fa2b852215e9071012b02d0869cb6e5ab6a SHA512 4c2fded17c5346222939fac5b0a13913bdc062b93a4963ad33fe41cf00a04860b5006ec4c762acb6ce7e36e83f368d5c3427b8bc359ba6cba73d6114f219604e
AUX dot-bash_logout 127 BLAKE2B 8290778aea3426f4c56e5a9e7328faa76f99001fc7ce3eeb3ec26624edcd918d7e946da9a63ffcd0cf0f739b528ccb9e764d448276fe4344b69ef2036fdd9921 SHA512 e0248b5087656a4dd3a4790ed8e6101866b922ccab36b510b3bf408dc0c583e70f323fbad0392e4ea6ca5dcbe73568733e0c0aa9c8ce6b00ff5f72bf3e9fd8fd
@@ -372,8 +376,7 @@ EBUILD bash-4.0_p44.ebuild 4408 BLAKE2B 13955f4505ba051f1880ce023f2f12e953143347
EBUILD bash-4.1_p17.ebuild 4142 BLAKE2B 5d8f2b031eb26211ff1f778629cfb8d9255b357e3217346511b3b70e6fc55b6e697c4991e3f505420eb295da5d973b4faceb7edbfca03b91c278bf01b7464602 SHA512 e5f5e135c543aa5dfac81936b1b25e9894aa62918c01214f48abc6a4d1d1251fda8be3566164d324b8644822745f634dd7e4265805d276be822fc190fe2e8146
EBUILD bash-4.2_p53.ebuild 4344 BLAKE2B 5565a97a0aa9465fd8eef2de0b78434c04096d84c988cdbb663af4b529e1207cc68d0030fa4d88e4028fa7bef08847df170a274ccba316213cceb7401163ed00 SHA512 d3cae3853f6c3b735dd9083b9f7d16bd96aac1ba29ba49e8d5e62140ebdb97f4c9d36e3bc36fcd96f32685236fe6bb80d53015b9dbb20a829968aa535a949a3f
EBUILD bash-4.3_p48-r2.ebuild 5642 BLAKE2B f5d114b98272cf7e6a900707e0abc4798cc1b85bf509f3260487959dad69a35a0badae19e1522e4746bb74c06f00a767a50c6a3199339c42036f3d92924722af SHA512 e83786756c9e65c08e78137396b393e04a7950d9393c6206491d7d7b13eb46fb4504fe34335706aa0835b6abc651e9578bf6157d6248de8e7fc2dc1a90cba927
-EBUILD bash-4.4_p12.ebuild 7127 BLAKE2B a5909b73ff2daa32a6e3af1f25f15b3bf1d9cb0dc1a176a8826f2d47d370367ec91731b062f1916f664edca442cdc91971fee227ff51f0a80d53d1ad146011de SHA512 92233876cf54b44c82ee67e4b56089a83b589a5c2570f3a1d53b1b647e29ba498c5a7128bf7b1b6efc9384c8ebb0afe7843373a57a016066260de546d8d90eba
EBUILD bash-4.4_p23-r1.ebuild 7382 BLAKE2B 1199ddb85f5ae9b85244e7e7be775b831a7ceacd839891b767c5e4b4d66af09d9a80d60440de6850d6d9354713eb214a14678e30e2e4a4b4f85cda3b5a2ec4f3 SHA512 49acd473c8280ea9830bf42ee80b4df859a2996f46cafb4fe7d8eb1c3e01f49b3aee75b76dc3b70b91deb3b3541be10f2a0972355397db4eecc1a2f43b6d51de
-EBUILD bash-5.0.ebuild 7332 BLAKE2B 267bed85678ff687485811fd399403d4224874b41873c27ac1af9ec84b79c7f74e7cea281dd9e90f1ec5537b77c59849a909991f17897cff30b7558886949eea SHA512 d48a77249bf2173242dc81fa37ee933b34a574c129dfa0a3fdda9c5fd405004c8b29b731f331fbb8c456b012c4e9fa4fe4658ad8323665ffc1bedb77c5f2d369
-EBUILD bash-5.0_p2.ebuild 7271 BLAKE2B fed8e1be9d9378cb797a311c022315456c24b3435ae538f30713446a150c9f1577c59eaad3418b10fd5f5f89d7f220b8e13710d265c9dab97edca5e67391c5ee SHA512 864d8599f8dab8aa5cb315c6478458825466b347b5339b7029e9678e8ab0f3e7ac266a6a3be24c80182539902f1ce25b7edabe61ad4849dc5ffac1b49777a253
+EBUILD bash-5.0_p2-r2.ebuild 7609 BLAKE2B 1860df6991961e81665888a45b7d588d9b50af0322f32c15df3ce8b1ddbc0a1a85dc989f1cf7d542062b828a02b4eefa261467729dfb43b16aa48a581783f967 SHA512 cba96f1480e35e9cb769f325102fd5c14ddf4f17d0213c9b2ab7a0b61d01289a3afd556aa0aa49935d0242e355100a91f3a1833dee2106f4b5e4569f7b1449ad
+EBUILD bash-5.0_p2.ebuild 7271 BLAKE2B f92a52f76241ab4f8828bdefd3e22ca082a7b9349deb885f9cb95eab5b460f5951490214498bdb29988fa8f8d559a366b5b3c6a231981b8b169daefa39250624 SHA512 3707f5d36ea640ce250f265ee0b232c049325cf1e8736aa709761610be776283c57f82f8dadf54ab44282594e17fae606c78541f8861f615f2802f44718f078a
MISC metadata.xml 734 BLAKE2B 242fda202379209b74e12c1726c4f4aa487eb09423d2249d13cae38cb9b077a285beff221a824647c826c39f7400178cd04d6082915ad9c23287ea70da9ef961 SHA512 a9301e8d2347e0cf90a97325d9a705076150c00609d28338e5d7d72c135468e4f0531b2a4077b69679ae6ccf89eee691e0e5f0748caab60689f5f017afb544f1
diff --git a/app-shells/bash/bash-4.4_p12.ebuild b/app-shells/bash/bash-4.4_p12.ebuild
deleted file mode 100644
index 2ebe6c54d4b3..000000000000
--- a/app-shells/bash/bash-4.4_p12.ebuild
+++ /dev/null
@@ -1,253 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit eutils 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 ~amd64-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"
-# 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 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/*
-
- 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 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 \
- --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-5.0.ebuild b/app-shells/bash/bash-5.0_p2-r2.ebuild
index cace89b9690c..7383e6344204 100644
--- a/app-shells/bash/bash-5.0.ebuild
+++ b/app-shells/bash/bash-5.0_p2-r2.ebuild
@@ -6,7 +6,7 @@ EAPI=6
inherit flag-o-matic toolchain-funcs multilib prefix
# Official patchlevel
-# See ftp://ftp.cwru.edu/pub/bash/bash-4.4-patches/
+# See ftp://ftp.cwru.edu/pub/bash/bash-5.0-patches/
PLEVEL=${PV##*_p}
MY_PV=${PV/_p*}
MY_PV=${MY_PV/_/-}
@@ -63,6 +63,15 @@ RDEPEND="
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"
@@ -97,8 +106,7 @@ 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 -p0 "${PATCHES[@]}"
eapply_user
}
diff --git a/app-shells/bash/bash-5.0_p2.ebuild b/app-shells/bash/bash-5.0_p2.ebuild
index 9b2b1d119e74..7572f931eab2 100644
--- a/app-shells/bash/bash-5.0_p2.ebuild
+++ b/app-shells/bash/bash-5.0_p2.ebuild
@@ -6,7 +6,7 @@ EAPI=6
inherit flag-o-matic toolchain-funcs multilib prefix
# Official patchlevel
-# See ftp://ftp.cwru.edu/pub/bash/bash-4.4-patches/
+# See ftp://ftp.cwru.edu/pub/bash/bash-5.0-patches/
PLEVEL=${PV##*_p}
MY_PV=${PV/_p*}
MY_PV=${MY_PV/_/-}
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
deleted file mode 100644
index 40379b3d4ccd..000000000000
--- a/app-shells/bash/files/bash-5.0-glob-pattern-backslash.patch
+++ /dev/null
@@ -1,133 +0,0 @@
-*** ../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 ----
diff --git a/app-shells/bash/files/bash-5.0-globpat-backslashes.patch b/app-shells/bash/files/bash-5.0-globpat-backslashes.patch
new file mode 100644
index 000000000000..21acaf7e7ff7
--- /dev/null
+++ b/app-shells/bash/files/bash-5.0-globpat-backslashes.patch
@@ -0,0 +1,206 @@
+*** ../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);
+ }
diff --git a/app-shells/bash/files/bash-5.0-history-append.patch b/app-shells/bash/files/bash-5.0-history-append.patch
new file mode 100644
index 000000000000..20f78bfe9f03
--- /dev/null
+++ b/app-shells/bash/files/bash-5.0-history-append.patch
@@ -0,0 +1,34 @@
+*** ../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
diff --git a/app-shells/bash/files/bash-5.0-history-zero-length.patch b/app-shells/bash/files/bash-5.0-history-zero-length.patch
new file mode 100644
index 000000000000..981bbfb06259
--- /dev/null
+++ b/app-shells/bash/files/bash-5.0-history-zero-length.patch
@@ -0,0 +1,34 @@
+*** ../bash-5.0-patched/bashhist.c 2018-07-05 22:41:14.000000000 -0400
+--- bashhist.c 2019-02-20 16:20:04.000000000 -0500
+***************
+*** 561,573 ****
+ if (!history_expansion_inhibited && history_expansion && history_expansion_p (line))
+ {
+ /* If we are expanding the second or later line of a multi-line
+ command, decrease history_length so references to history expansions
+ in these lines refer to the previous history entry and not the
+ current command. */
+ if (history_length > 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1)
+ history_length--;
+ expanded = history_expand (line, &history_value);
+ if (history_length >= 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1)
+! history_length++;
+
+ if (expanded)
+--- 561,576 ----
+ if (!history_expansion_inhibited && history_expansion && history_expansion_p (line))
+ {
++ int old_len;
++
+ /* If we are expanding the second or later line of a multi-line
+ command, decrease history_length so references to history expansions
+ in these lines refer to the previous history entry and not the
+ current command. */
++ old_len = history_length;
+ if (history_length > 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1)
+ history_length--;
+ expanded = history_expand (line, &history_value);
+ if (history_length >= 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1)
+! history_length = old_len;
+
+ if (expanded)
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
new file mode 100644
index 000000000000..3c6561bb1268
--- /dev/null
+++ b/app-shells/bash/files/bash-5.0-optimize-connection-fork.patch
@@ -0,0 +1,79 @@
+*** ../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)
+
diff --git a/app-shells/bash/files/bash-5.0-syslog-history-extern.patch b/app-shells/bash/files/bash-5.0-syslog-history-extern.patch
new file mode 100644
index 000000000000..79909a3d0c38
--- /dev/null
+++ b/app-shells/bash/files/bash-5.0-syslog-history-extern.patch
@@ -0,0 +1,15 @@
+*** ../bash-5.0-patched/builtins/shopt.def 2018-10-05 14:49:02.000000000 -0400
+--- builtins/shopt.def 2019-01-23 09:55:22.000000000 -0500
+***************
+*** 123,127 ****
+ #endif
+
+! #if defined (SYSLOG_HISTORY) && defined (SYSLOG_SHOPT)
+ extern int syslog_history;
+ #endif
+--- 123,127 ----
+ #endif
+
+! #if defined (SYSLOG_HISTORY)
+ extern int syslog_history;
+ #endif