Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/
Date: Sun, 27 Nov 2016 01:45:15
Message-Id: 1480211067.1bf1ceeb04a2f57e1e5e1636a8c288c4d0db6682.vapier@gentoo
1 commit: 1bf1ceeb04a2f57e1e5e1636a8c288c4d0db6682
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Sun Nov 27 01:44:27 2016 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 27 01:44:27 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1bf1ceeb
7
8 app-shells/bash: upstream fix for crash on invalid popd #600174
9
10 app-shells/bash/bash-4.4-r1.ebuild | 248 ---------------------
11 .../{bash-4.4_p5.ebuild => bash-4.4_p5-r1.ebuild} | 1 +
12 .../bash/files/bash-4.4-popd-offset-overflow.patch | 30 +++
13 3 files changed, 31 insertions(+), 248 deletions(-)
14
15 diff --git a/app-shells/bash/bash-4.4-r1.ebuild b/app-shells/bash/bash-4.4-r1.ebuild
16 deleted file mode 100644
17 index 37e7af7..00000000
18 --- a/app-shells/bash/bash-4.4-r1.ebuild
19 +++ /dev/null
20 @@ -1,248 +0,0 @@
21 -# Copyright 1999-2016 Gentoo Foundation
22 -# Distributed under the terms of the GNU General Public License v2
23 -# $Id$
24 -
25 -EAPI="5"
26 -
27 -inherit eutils flag-o-matic toolchain-funcs multilib prefix
28 -
29 -# Official patchlevel
30 -# See ftp://ftp.cwru.edu/pub/bash/bash-4.3-patches/
31 -PLEVEL=${PV##*_p}
32 -MY_PV=${PV/_p*}
33 -MY_PV=${MY_PV/_/-}
34 -MY_P=${PN}-${MY_PV}
35 -[[ ${PV} != *_p* ]] && PLEVEL=0
36 -patches() {
37 - local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}}
38 - [[ ${plevel} -eq 0 ]] && return 1
39 - eval set -- {1..${plevel}}
40 - set -- $(printf "${pn}${pv/\.}-%03d " "$@")
41 - if [[ ${opt} == -s ]] ; then
42 - echo "${@/#/${DISTDIR}/}"
43 - else
44 - local u
45 - for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do
46 - printf "${u}/${pn}-${pv}-patches/%s " "$@"
47 - done
48 - fi
49 -}
50 -
51 -# The version of readline this bash normally ships with.
52 -READLINE_VER="7.0"
53 -
54 -DESCRIPTION="The standard GNU Bourne again shell"
55 -HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html"
56 -case ${PV} in
57 -*_alpha*|*_beta*|*_rc*) SRC_URI+=" ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz" ;;
58 -*) SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)" ;;
59 -esac
60 -
61 -LICENSE="GPL-3"
62 -SLOT="0"
63 -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
64 -IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline"
65 -
66 -DEPEND=">=sys-libs/ncurses-5.2-r2:0=
67 - readline? ( >=sys-libs/readline-${READLINE_VER}:0= )
68 - nls? ( virtual/libintl )"
69 -RDEPEND="${DEPEND}
70 - !<sys-apps/portage-2.1.6.7_p1
71 - !<sys-apps/paludis-0.26.0_alpha5"
72 -# we only need yacc when the .y files get patched (bash42-005)
73 -#DEPEND+=" virtual/yacc"
74 -
75 -S=${WORKDIR}/${MY_P}
76 -
77 -pkg_setup() {
78 - if is-flag -malign-double ; then #7332
79 - eerror "Detected bad CFLAGS '-malign-double'. Do not use this"
80 - eerror "as it breaks LFS (struct stat64) on x86."
81 - die "remove -malign-double from your CFLAGS mr ricer"
82 - fi
83 - if use bashlogger ; then
84 - ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
85 - ewarn "This will log ALL output you enter into the shell, you have been warned."
86 - fi
87 -}
88 -
89 -src_unpack() {
90 - unpack ${MY_P}.tar.gz
91 -}
92 -
93 -src_prepare() {
94 - # Include official patches
95 - [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
96 -
97 - # Clean out local libs so we know we use system ones w/releases.
98 - if [[ ${PV} != *_rc* ]] ; then
99 - rm -rf lib/{readline,termcap}/*
100 - touch lib/{readline,termcap}/Makefile.in # for config.status
101 - sed -ri -e 's:\$[(](RL|HIST)_LIBSRC[)]/[[:alpha:]]*.h::g' Makefile.in || die
102 - fi
103 -
104 - # Prefixify hardcoded path names. No-op for non-prefix.
105 - hprefixify pathnames.h.in
106 -
107 - # Avoid regenerating docs after patches #407985
108 - sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
109 - touch -r . doc/*
110 -
111 - epatch_user
112 -}
113 -
114 -src_configure() {
115 - local myconf=()
116 -
117 - # For descriptions of these, see config-top.h
118 - # bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426
119 - append-cppflags \
120 - -DDEFAULT_PATH_VALUE=\'\"${EPREFIX}/usr/local/sbin:${EPREFIX}/usr/local/bin:${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin\"\' \
121 - -DSTANDARD_UTILS_PATH=\'\"${EPREFIX}/bin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/usr/sbin\"\' \
122 - -DSYS_BASHRC=\'\"${EPREFIX}/etc/bash/bashrc\"\' \
123 - -DSYS_BASH_LOGOUT=\'\"${EPREFIX}/etc/bash/bash_logout\"\' \
124 - -DNON_INTERACTIVE_LOGIN_SHELLS \
125 - -DSSH_SOURCE_BASHRC \
126 - $(use bashlogger && echo -DSYSLOG_HISTORY)
127 -
128 - # Don't even think about building this statically without
129 - # reading Bug 7714 first. If you still build it statically,
130 - # don't come crying to us with bugs ;).
131 - #use static && export LDFLAGS="${LDFLAGS} -static"
132 - use nls || myconf+=( --disable-nls )
133 -
134 - # Historically, we always used the builtin readline, but since
135 - # our handling of SONAME upgrades has gotten much more stable
136 - # in the PM (and the readline ebuild itself preserves the old
137 - # libs during upgrades), linking against the system copy should
138 - # be safe.
139 - # Exact cached version here doesn't really matter as long as it
140 - # is at least what's in the DEPEND up above.
141 - export ac_cv_rl_version=${READLINE_VER%%_*}
142 -
143 - # Force linking with system curses ... the bundled termcap lib
144 - # sucks bad compared to ncurses. For the most part, ncurses
145 - # is here because readline needs it. But bash itself calls
146 - # ncurses in one or two small places :(.
147 -
148 - if [[ ${PV} != *_rc* ]] ; then
149 - # Use system readline only with released versions.
150 - myconf+=( --with-installed-readline=. )
151 - fi
152 -
153 - if use plugins; then
154 - append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
155 - else
156 - # Disable the plugins logic by hand since bash doesn't
157 - # provide a way of doing it.
158 - export ac_cv_func_dl{close,open,sym}=no \
159 - ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
160 - sed -i \
161 - -e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
162 - configure || die
163 - fi
164 - tc-export AR #444070
165 - econf \
166 - --docdir='$(datarootdir)'/doc/${PF} \
167 - --htmldir='$(docdir)/html' \
168 - --with-curses \
169 - $(use_with afs) \
170 - $(use_enable net net-redirections) \
171 - --disable-profiling \
172 - $(use_enable mem-scramble) \
173 - $(use_with mem-scramble bash-malloc) \
174 - $(use_enable readline) \
175 - $(use_enable readline history) \
176 - $(use_enable readline bang-history) \
177 - "${myconf[@]}"
178 -}
179 -
180 -src_compile() {
181 - emake
182 -
183 - if use plugins ; then
184 - emake -C examples/loadables all others
185 - fi
186 -}
187 -
188 -src_install() {
189 - local d f
190 -
191 - default
192 -
193 - dodir /bin
194 - mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
195 - dosym bash /bin/rbash
196 -
197 - insinto /etc/bash
198 - doins "${FILESDIR}"/bash_logout
199 - doins "$(prefixify_ro "${FILESDIR}"/bashrc)"
200 - keepdir /etc/bash/bashrc.d
201 - insinto /etc/skel
202 - for f in bash{_logout,_profile,rc} ; do
203 - newins "${FILESDIR}"/dot-${f} .${f}
204 - done
205 -
206 - local sed_args=(
207 - -e "s:#${USERLAND}#@::"
208 - -e '/#@/d'
209 - )
210 - if ! use readline ; then
211 - sed_args+=( #432338
212 - -e '/^shopt -s histappend/s:^:#:'
213 - -e 's:use_color=true:use_color=false:'
214 - )
215 - fi
216 - sed -i \
217 - "${sed_args[@]}" \
218 - "${ED}"/etc/skel/.bashrc \
219 - "${ED}"/etc/bash/bashrc || die
220 -
221 - if use plugins ; then
222 - exeinto /usr/$(get_libdir)/bash
223 - doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
224 - insinto /usr/include/bash-plugins
225 - doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
226 - fi
227 -
228 - if use examples ; then
229 - for d in examples/{functions,misc,scripts,startup-files} ; do
230 - exeinto /usr/share/doc/${PF}/${d}
231 - insinto /usr/share/doc/${PF}/${d}
232 - for f in ${d}/* ; do
233 - if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
234 - doexe ${f}
235 - else
236 - doins ${f}
237 - fi
238 - done
239 - done
240 - fi
241 -
242 - doman doc/*.1
243 - newdoc CWRU/changelog ChangeLog
244 - dosym bash.info /usr/share/info/bashref.info
245 -}
246 -
247 -pkg_preinst() {
248 - if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
249 - mkdir -p "${EROOT}"/etc/bash
250 - mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
251 - fi
252 -
253 - if [[ -L ${EROOT}/bin/sh ]] ; then
254 - # rewrite the symlink to ensure that its mtime changes. having /bin/sh
255 - # missing even temporarily causes a fatal error with paludis.
256 - local target=$(readlink "${EROOT}"/bin/sh)
257 - local tmp=$(emktemp "${EROOT}"/bin)
258 - ln -sf "${target}" "${tmp}"
259 - mv -f "${tmp}" "${EROOT}"/bin/sh
260 - fi
261 -}
262 -
263 -pkg_postinst() {
264 - # If /bin/sh does not exist, provide it
265 - if [[ ! -e ${EROOT}/bin/sh ]] ; then
266 - ln -sf bash "${EROOT}"/bin/sh
267 - fi
268 -}
269
270 diff --git a/app-shells/bash/bash-4.4_p5.ebuild b/app-shells/bash/bash-4.4_p5-r1.ebuild
271 similarity index 99%
272 rename from app-shells/bash/bash-4.4_p5.ebuild
273 rename to app-shells/bash/bash-4.4_p5-r1.ebuild
274 index 63ac792..d984d05 100644
275 --- a/app-shells/bash/bash-4.4_p5.ebuild
276 +++ b/app-shells/bash/bash-4.4_p5-r1.ebuild
277 @@ -72,6 +72,7 @@ src_unpack() {
278 src_prepare() {
279 # Include official patches
280 [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
281 + epatch "${FILESDIR}"/${PN}-4.4-popd-offset-overflow.patch #600174
282
283 # Clean out local libs so we know we use system ones w/releases.
284 if [[ ${PV} != *_rc* ]] ; then
285
286 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
287 new file mode 100644
288 index 00000000..c6ef19d
289 --- /dev/null
290 +++ b/app-shells/bash/files/bash-4.4-popd-offset-overflow.patch
291 @@ -0,0 +1,30 @@
292 +https://bugs.gentoo.org/600174
293 +https://lists.gnu.org/archive/html/bug-bash/2016-11/msg00099.html
294 +
295 +*** ../bash-4.4-patched/builtins/pushd.def 2016-01-25 13:31:49.000000000 -0500
296 +--- builtins/pushd.def 2016-10-28 10:46:49.000000000 -0400
297 +***************
298 +*** 366,370 ****
299 + }
300 +
301 +! if (which > directory_list_offset || (directory_list_offset == 0 && which == 0))
302 + {
303 + pushd_error (directory_list_offset, which_word ? which_word : "");
304 +--- 366,370 ----
305 + }
306 +
307 +! if (which > directory_list_offset || (which < -directory_list_offset) || (directory_list_offset == 0 && which == 0))
308 + {
309 + pushd_error (directory_list_offset, which_word ? which_word : "");
310 +***************
311 +*** 388,391 ****
312 +--- 388,396 ----
313 + of the list into place. */
314 + i = (direction == '+') ? directory_list_offset - which : which;
315 ++ if (i < 0 || i > directory_list_offset)
316 ++ {
317 ++ pushd_error (directory_list_offset, which_word ? which_word : "");
318 ++ return (EXECUTION_FAILURE);
319 ++ }
320 + free (pushd_directory_list[i]);
321 + directory_list_offset--;