aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Shelton <stuart@shelton.me>2016-12-06 20:51:32 +0000
committerStuart Shelton <stuart@shelton.me>2016-12-06 20:51:32 +0000
commit4fbad73b5f47419007e47f01d1fac0696947f3d1 (patch)
treeb5639d541c7d637d03c7f1b20d7796c734f772e2
parentAdd media-sound/teamspeak-server-bin-3.0.13.6 (diff)
downloadsrcshelton-4fbad73b5f47419007e47f01d1fac0696947f3d1.tar.gz
srcshelton-4fbad73b5f47419007e47f01d1fac0696947f3d1.tar.bz2
srcshelton-4fbad73b5f47419007e47f01d1fac0696947f3d1.zip
Add app-shells/bash-4.3_p48-r1
-rw-r--r--app-shells/bash/Manifest2
-rw-r--r--app-shells/bash/bash-4.3_p48-r1.ebuild319
-rw-r--r--app-shells/bash/files/bash-4.4-popd-offset-overflow.patch30
3 files changed, 351 insertions, 0 deletions
diff --git a/app-shells/bash/Manifest b/app-shells/bash/Manifest
index 8072d007..93ac5787 100644
--- a/app-shells/bash/Manifest
+++ b/app-shells/bash/Manifest
@@ -18,6 +18,7 @@ AUX bash-4.3-mapfile-improper-array-name-validation.patch 407 SHA256 0302e96630a
AUX bash-4.3-prompt-string-comsub.patch 3395 SHA256 33eeb827efffcac9362359b49c6552aeba56b53760c332ab038cd6c1fdd678d5 SHA512 1da0ca9fa9c9c9331c848342194f2c0b0ad590daa162d78d994f6ab79991c926c832ee71fad9550acf7099067b6b40e60169227ebca56cf450b95627b842929b WHIRLPOOL 3681415ea4c57b8a13fe25ce637b61a14ccaf2c1a8d5081b47baa29d2ae0f36a2d1b9dc58ff7ec5ba5b7c59dac38bace989e76f8dfa2d35d209df7e8916002ac
AUX bash-4.3-protos.patch 174 SHA256 729aded4f907f4bad466785eed850b2b25a145e9ed75f0fc690190d5fccd387a SHA512 4af0540467bbcf7cf041de6fe6ed080b149a2ff309e5dbe5e7b76bb30459aaeead813be678384feb01a7b64d3a649372f8a8aaf686f69ac7958baa87b25340b0 WHIRLPOOL b1a5def9952b1f8ec4b9c3ff9df09672b2ad55a67a99890bc0796c87e23c1ec86c0eed50125d790120b6eea595f5aeabf981383323aac43b2f790587ec70685a
AUX bash-4.3-signal.h.patch 210 SHA256 3301f5849483135d93ec5e5f9e8256e094cf17762c5dab91167f253b1a23871e SHA512 9f8756740c35434c8150f97d91ef65109def9c80bc3f0c251f7561af49a504b240395ae8a8517ffcabce599c3203b5e23effbc6bd008cd1d9f80a4cdaf638284 WHIRLPOOL 329c3fc0fbf535bb7cdfe3ac60a418734c9aa03b8ce89fb065fbdd24c6a1aae33a4156e870fbe1272df9581a166c219d93c10c74db2c319985bc8e78b89778ec
+AUX bash-4.4-popd-offset-overflow.patch 1069 SHA256 7531362393ebf012e5e153ba7fcf631d93574d7e80d21596607a5f5d3845c00a SHA512 535f61b2e0c6423031520700be423750e9177ec96055be781aee5dbdd01c720c1dbc30fffa73b88464527981193c1c6a74ec4139753ef4f40a5bb0f55c4de61c WHIRLPOOL 3fd7d95b7a806d5f8f82ab683c0bcf13bb0fc8bf5b5fe374689abbaae3c325994b4709c601d1ac6cdb1a2e5d6a049c98ab46688e5ecb2a18c98ac182fa6c91f7
AUX bash_logout 205 SHA256 15aaded954389c05d7de5d36c4887db61975ad52c87ad78baf1062ec8997289d SHA512 7234250c03fc920996a381f9daef9e2d8ab1e1a29acdebed6669d8e0fe1c872a7fa343adf7d9ddc81225b0cd9eb223ba7ad1ff42448aff057fc6d6baa8f04a7d WHIRLPOOL 16242c8796af44f550f2935b37c770c022754c63db75b57fbe49d1a313b8651235619ead571cd70ae37f890c694d1c6b2e4871ec51345743eff8649782d0523b
AUX bashrc 3637 SHA256 cd1e64f5b48348e1960fe68fd7dc3716cd12a9ae3a9dd24cb75ccb17cd8300c4 SHA512 bac4c6ba06441e50f1303bbb9549aded2af72731fc0d1f935ec716104e0442e36f9afe28fe29c86f159d0cdfe9f1ba7dc2f42cee4265a1869e879853f531ea06 WHIRLPOOL 970741fa3438bc75d0fca1d9449b3afc51e087420de745b64073d6f1844dc73d6c0c2ad6b2575000fd3d0a7f5d6f9b9e834287ec8c4de79ebdea5b644ba82c0f
AUX bashrc-prefix.patch 1313 SHA256 f21fd0476c51848c724a43e98c998b1d0f8b459426ebb157525211a284f4b516 SHA512 151aacbe2e3c6bbf42b6a219938829cd5fd635584dddcf7d712dc50fd93bad46344333aa9b21f22ec1b0d1143e42e66cf6b87d823523a4bc29f36d7402d2c1e8 WHIRLPOOL 2faf4824f46ca588ebacb6f1c7eff5ab3621a0c391abeacc35183ba842d9dbc6f0a1b6e19ea2f473152784bd13a83a024a756d8c1d683ff9e3b33158ce77675b
@@ -134,4 +135,5 @@ EBUILD bash-4.3_p39.ebuild 10390 SHA256 825d7af0b121083e66007446d310643e74cc1baa
EBUILD bash-4.3_p42-r1.ebuild 10068 SHA256 627fd5ae117fbc9e0a9ec69be92834b09b5c1e1f1ea1fa605902941ce1b81f0b SHA512 ae3e1779ef94f1eade86977f432b049bcca4e69509757dbaba727e0b3a3bc93104108aee0ed0348b53d7b746fbde1e411c6f8a7860a5f80584d6c9901d654ae0 WHIRLPOOL 17569fd57432956464e07eda2bfc6093bff52461e251822774cae8df010325b4451a6b5fdb56f2819fea90b63fe1bc8ecfc666c3e8feba0ea6d1c8aa4b6c4738
EBUILD bash-4.3_p42.ebuild 10070 SHA256 4e142cac5475f25af5439c441ed172036eb5a0d607b89147b6dce823e72256ee SHA512 97aadcb7934fc1cfab18a6b3d849db411ec96b17cdc363f2525a4cb049dd3beaa326c441cdaebd72b90baf6b76d5d9ab4dc6a948916a4adf7fa4ccd5330126b4 WHIRLPOOL 53a92baa0a16f4705c43945133af72bbe576dd7c8204e0c3fedca0e60333b8a48d53c4efd23f02a5360801c347c112d3fd35a9586d3d266f97e4526aa5e2d9dc
EBUILD bash-4.3_p46-r1.ebuild 10088 SHA256 77216bab3206d7a596b7e986e6d3023d9e5e12e06da230f3ebc7a5b9482a42f0 SHA512 f22a2987fcf73470e5525587702cecfa0453fee053a78f766f0a180a2430379ada90a63e24faf4466d19881fbed0c1c5151f8b50288308cf6b83b22d602c0d76 WHIRLPOOL 39ea01edc32023171c9c2254e747c055a675011c2b847655a422ca2332bb5cf85fc5e572d6c80592bd565fc8b4a2fc4a469adebe1d5cb72936174ca5386d6389
+EBUILD bash-4.3_p48-r1.ebuild 10064 SHA256 77ebd12928243d5c070262f0165cc87c13f0c55f2f4255c84a837b3f53c8bdb9 SHA512 3bc59edddf4f93766b43840cacde5c29f25a101109864397f3dbb8d520c80ae1fb58a689b53078fff9e73711dfda71db85740059c74110488f727c4a67cef9eb WHIRLPOOL 0428f0a7626f34da4d0df707f67aaa605d43a1c89d8e7f67a9cc5090e3d8be2e52403484bd6fb334f978253b5575c2e39127c969a71a04a898bb134d0ed04a6a
EBUILD bash-4.3_p48.ebuild 10001 SHA256 b648c49c3c2622a2f866c5eaacdbda9f55324d4069c5109513063c4a78d7077a SHA512 b370654316b8e0c3bbf55458f68ec7df8af3459b203beaba33b6c113aaa8b3b6d47d22b5623d3953f22b0367aeee43ef85549f4fb9a4ea7570e2cfcf54655ba0 WHIRLPOOL 7de88bdde5f6202dfd57614af2190b9f12d2eb8b30837826f5e9c23cd9f93490b839742ea6c4b04df98f63bd5c2c9a6d52f913e7a1221806d3755f3b7465dcbb
diff --git a/app-shells/bash/bash-4.3_p48-r1.ebuild b/app-shells/bash/bash-4.3_p48-r1.ebuild
new file mode 100644
index 00000000..d8d29fce
--- /dev/null
+++ b/app-shells/bash/bash-4.3_p48-r1.ebuild
@@ -0,0 +1,319 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: ce0925abd09fdf4e6e99bcb7d21b1bb885fdcf17 $
+
+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="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"
+
+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
+ "${FILESDIR}"/${PN}-4.4-popd-offset-overflow.patch #600174
+
+ # Prefix patches:
+ # Use prefix root
+ "${FILESDIR}"/${PN}-4.0-configs-prefix.patch
+ # Include appropriate headers, to satisfy clang and avoid -Wimplicit-function-declaration
+ "${FILESDIR}"/${PN}-4.0-bashintl-in-siglist.patch
+ "${FILESDIR}"/${PN}-4.2-signal.h.patch
+ "${FILESDIR}"/${PN}-4.3-signal.h.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[@]}"
+
+ eprefixify pathnames.h.in
+
+ # Nasty trick to set bashbug's shebang to bash instead of sh. We don't have
+ # sh while bootstrapping for the first time, This works around bug 309825
+ sed -i -e '1s:sh:bash:' support/bashbug.sh || die
+
+ # modify the bashrc file for prefix
+ pushd "${T}" > /dev/null || die
+ cp "${FILESDIR}"/bashrc .
+ epatch "${FILESDIR}"/bashrc-prefix.patch
+ eprefixify bashrc
+ popd > /dev/null
+
+ epatch_user
+}
+
+src_configure() {
+ local myconf=()
+
+ # For descriptions of these, see config-top.h
+ # bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
+ if use prefix ; then
+ append-cppflags \
+ -DDEFAULT_PATH_VALUE=\'\"${EPREFIX}/usr/local/sbin:${EPREFIX}/usr/local/bin:${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"\' \
+ -DSTANDARD_UTILS_PATH=\'\"${EPREFIX}/bin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/usr/sbin:/bin:/usr/bin:/sbin:/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)
+ else
+ 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)
+ fi
+
+ # IRIX's MIPSpro produces garbage with >= -O2, bug #209137
+ [[ ${CHOST} == mips-sgi-irix* ]] && replace-flags -O? -O1
+
+ if [[ ${CHOST} == *-aix* ]] || [[ ${CHOST} == *-hpux* ]] ; then
+ # Avoid finding tgetent() in anything else but ncurses library,
+ # as <termcap.h> is provided by ncurses, even during bootstrap
+ # on AIX and HP-UX, and we would get undefined symbols like
+ # BC, PC, UP if linking against something else.
+ # The bash-bug is that it doesn't check for <termcap.h> provider,
+ # and unfortunately {,n}curses is checked last.
+ # Even if ncurses provides libcurses.so->libncurses.so symlink,
+ # it feels more clean to link against libncurses.so directly.
+ # (all configure-variables for tgetent() are shown here)
+ export ac_cv_func_tgetent=no
+ export ac_cv_lib_termcap_tgetent=no # found on HP-UX
+ export ac_cv_lib_tinfo_tgetent=no
+ export ac_cv_lib_curses_tgetent=no # found on AIX
+ #export ac_cv_lib_ncurses_tgetent=no
+ fi
+
+ # 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
+ case "${CHOST}" in
+ # Darwin doesn't need an rpath here (in fact doesn't grok the argument)
+ *-linux-gnu* | *-solaris* | *-freebsd* )
+ append-ldflags -Wl,-rpath,"${EPREFIX}"/usr/$(get_libdir)/bash
+ ;;
+ esac
+ 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
+ if [[ -s "${T}"/bashrc ]]; then
+ newins "${T}"/bashrc bashrc
+ else
+ eerror "Prefixified bashrc at '${T}/bashrc' cannot be read"
+ ewarn "Installing default bashrc"
+ newins "${FILESDIR}"/bashrc bashrc
+ fi
+ 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
+}
+
+# vi: set diffopt=iwhite,filler:
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..c6ef19d0
--- /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--;