Gentoo Archives: gentoo-commits

From: "Lars Wendler (polynomial-c)" <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in app-shells/bash: ChangeLog bash-4.1_p14-r1.ebuild bash-4.3_p27-r1.ebuild bash-4.2_p50-r1.ebuild bash-4.3_p27.ebuild
Date: Tue, 30 Sep 2014 20:34:33
Message-Id: 20140930203429.B922769C6@oystercatcher.gentoo.org
1 polynomial-c 14/09/30 20:34:29
2
3 Modified: ChangeLog
4 Added: bash-4.1_p14-r1.ebuild bash-4.3_p27-r1.ebuild
5 bash-4.2_p50-r1.ebuild
6 Removed: bash-4.3_p27.ebuild
7 Log:
8 Added an inofficial patch to finally fix CVE-2014-7186 and CVE-2014-7187 (bug #523742)
9
10 (Portage version: 2.2.14_rc1/cvs/Linux x86_64, signed Manifest commit with key 0x981CA6FC)
11
12 Revision Changes Path
13 1.399 app-shells/bash/ChangeLog
14
15 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-shells/bash/ChangeLog?rev=1.399&view=markup
16 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-shells/bash/ChangeLog?rev=1.399&content-type=text/plain
17 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-shells/bash/ChangeLog?r1=1.398&r2=1.399
18
19 Index: ChangeLog
20 ===================================================================
21 RCS file: /var/cvsroot/gentoo-x86/app-shells/bash/ChangeLog,v
22 retrieving revision 1.398
23 retrieving revision 1.399
24 diff -u -r1.398 -r1.399
25 --- ChangeLog 29 Sep 2014 09:27:19 -0000 1.398
26 +++ ChangeLog 30 Sep 2014 20:34:29 -0000 1.399
27 @@ -1,6 +1,16 @@
28 # ChangeLog for app-shells/bash
29 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
30 -# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/ChangeLog,v 1.398 2014/09/29 09:27:19 jer Exp $
31 +# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/ChangeLog,v 1.399 2014/09/30 20:34:29 polynomial-c Exp $
32 +
33 +*bash-4.3_p27-r1 (30 Sep 2014)
34 +*bash-4.2_p50-r1 (30 Sep 2014)
35 +*bash-4.1_p14-r1 (30 Sep 2014)
36 +
37 + 30 Sep 2014; Lars Wendler <polynomial-c@g.o> +bash-4.1_p14-r1.ebuild,
38 + +bash-4.2_p50-r1.ebuild, -bash-4.3_p27.ebuild, +bash-4.3_p27-r1.ebuild,
39 + +files/bash-redir-stack-overflow.patch:
40 + Added an inofficial patch to finally fix CVE-2014-7186 and CVE-2014-7187 (bug
41 + #523742).
42
43 29 Sep 2014; Jeroen Roovers <jer@g.o> bash-3.1_p20.ebuild,
44 bash-3.2_p54.ebuild, bash-4.0_p41.ebuild, bash-4.1_p14.ebuild,
45
46
47
48 1.1 app-shells/bash/bash-4.1_p14-r1.ebuild
49
50 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-shells/bash/bash-4.1_p14-r1.ebuild?rev=1.1&view=markup
51 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-shells/bash/bash-4.1_p14-r1.ebuild?rev=1.1&content-type=text/plain
52
53 Index: bash-4.1_p14-r1.ebuild
54 ===================================================================
55 # Copyright 1999-2014 Gentoo Foundation
56 # Distributed under the terms of the GNU General Public License v2
57 # $Header: /var/cvsroot/gentoo-x86/app-shells/bash/bash-4.1_p14-r1.ebuild,v 1.1 2014/09/30 20:34:29 polynomial-c Exp $
58
59 EAPI="4"
60
61 inherit eutils flag-o-matic toolchain-funcs
62
63 # Official patchlevel
64 # See ftp://ftp.cwru.edu/pub/bash/bash-4.1-patches/
65 PLEVEL=${PV##*_p}
66 MY_PV=${PV/_p*}
67 MY_PV=${MY_PV/_/-}
68 MY_P=${PN}-${MY_PV}
69 [[ ${PV} != *_p* ]] && PLEVEL=0
70 patches() {
71 local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}}
72 [[ ${plevel} -eq 0 ]] && return 1
73 eval set -- {1..${plevel}}
74 set -- $(printf "${pn}${pv/\.}-%03d " "$@")
75 if [[ ${opt} == -s ]] ; then
76 echo "${@/#/${DISTDIR}/}"
77 else
78 local u
79 for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do
80 printf "${u}/${pn}-${pv}-patches/%s " "$@"
81 done
82 fi
83 }
84
85 DESCRIPTION="The standard GNU Bourne again shell"
86 HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html"
87 SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
88
89 LICENSE="GPL-3"
90 SLOT="${MY_PV}"
91 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
92 IUSE="afs mem-scramble +net nls +readline"
93
94 DEPEND=">=sys-libs/ncurses-5.2-r2
95 readline? ( >=sys-libs/readline-6.2 )
96 nls? ( virtual/libintl )"
97 RDEPEND="${DEPEND}"
98
99 S=${WORKDIR}/${MY_P}
100
101 pkg_setup() {
102 if is-flag -malign-double ; then #7332
103 eerror "Detected bad CFLAGS '-malign-double'. Do not use this"
104 eerror "as it breaks LFS (struct stat64) on x86."
105 die "remove -malign-double from your CFLAGS mr ricer"
106 fi
107 }
108
109 src_unpack() {
110 unpack ${MY_P}.tar.gz
111 }
112
113 src_prepare() {
114 # Include official patches
115 [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
116
117 # Clean out local libs so we know we use system ones
118 rm -rf lib/{readline,termcap}/*
119 touch lib/{readline,termcap}/Makefile.in # for config.status
120 sed -ri -e 's:\$[(](RL|HIST)_LIBSRC[)]/[[:alpha:]]*.h::g' Makefile.in || die
121
122 epatch "${FILESDIR}"/${PN}-4.1-fbsd-eaccess.patch #303411
123 sed -i '1i#define NEED_FPURGE_DECL' execute_cmd.c # needs fpurge() decl
124 epatch "${FILESDIR}"/${PN}-4.1-parallel-build.patch
125 epatch "${FILESDIR}"/${PN}-redir-stack-overflow.patch #523742
126
127 epatch_user
128 }
129
130 src_configure() {
131 local myconf=()
132
133 myconf+=( --without-lispdir ) #335896
134
135 # For descriptions of these, see config-top.h
136 # bashrc/#26952 bash_logout/#90488 ssh/#24762
137 append-cppflags \
138 -DDEFAULT_PATH_VALUE=\'\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"\' \
139 -DSTANDARD_UTILS_PATH=\'\"/bin:/usr/bin:/sbin:/usr/sbin\"\' \
140 -DSYS_BASHRC=\'\"/etc/bash/bashrc\"\' \
141 -DSYS_BASH_LOGOUT=\'\"/etc/bash/bash_logout\"\' \
142 -DNON_INTERACTIVE_LOGIN_SHELLS \
143 -DSSH_SOURCE_BASHRC
144
145 # Don't even think about building this statically without
146 # reading Bug 7714 first. If you still build it statically,
147 # don't come crying to us with bugs ;).
148 #use static && export LDFLAGS="${LDFLAGS} -static"
149 use nls || myconf+=( --disable-nls )
150
151 # Historically, we always used the builtin readline, but since
152 # our handling of SONAME upgrades has gotten much more stable
153 # in the PM (and the readline ebuild itself preserves the old
154 # libs during upgrades), linking against the system copy should
155 # be safe.
156 # Exact cached version here doesn't really matter as long as it
157 # is at least what's in the DEPEND up above.
158 export ac_cv_rl_version=6.2
159
160 # Force linking with system curses ... the bundled termcap lib
161 # sucks bad compared to ncurses. For the most part, ncurses
162 # is here because readline needs it. But bash itself calls
163 # ncurses in one or two small places :(.
164
165 tc-export AR #444070
166 econf \
167 --with-installed-readline=. \
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_install() {
181 into /
182 newbin bash bash-${SLOT}
183
184 newman doc/bash.1 bash-${SLOT}.1
185 newman doc/builtins.1 builtins-${SLOT}.1
186
187 insinto /usr/share/info
188 newins doc/bashref.info bash-${SLOT}.info
189 dosym bash-${SLOT}.info /usr/share/info/bashref-${SLOT}.info
190
191 dodoc README NEWS AUTHORS CHANGES COMPAT Y2K doc/FAQ doc/INTRO
192 }
193
194
195
196 1.1 app-shells/bash/bash-4.3_p27-r1.ebuild
197
198 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-shells/bash/bash-4.3_p27-r1.ebuild?rev=1.1&view=markup
199 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-shells/bash/bash-4.3_p27-r1.ebuild?rev=1.1&content-type=text/plain
200
201 Index: bash-4.3_p27-r1.ebuild
202 ===================================================================
203 # Copyright 1999-2014 Gentoo Foundation
204 # Distributed under the terms of the GNU General Public License v2
205 # $Header: /var/cvsroot/gentoo-x86/app-shells/bash/bash-4.3_p27-r1.ebuild,v 1.1 2014/09/30 20:34:29 polynomial-c Exp $
206
207 EAPI="4"
208
209 inherit eutils flag-o-matic toolchain-funcs multilib
210
211 # Official patchlevel
212 # See ftp://ftp.cwru.edu/pub/bash/bash-4.3-patches/
213 PLEVEL=${PV##*_p}
214 MY_PV=${PV/_p*}
215 MY_PV=${MY_PV/_/-}
216 MY_P=${PN}-${MY_PV}
217 [[ ${PV} != *_p* ]] && PLEVEL=0
218 patches() {
219 local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}}
220 [[ ${plevel} -eq 0 ]] && return 1
221 eval set -- {1..${plevel}}
222 set -- $(printf "${pn}${pv/\.}-%03d " "$@")
223 if [[ ${opt} == -s ]] ; then
224 echo "${@/#/${DISTDIR}/}"
225 else
226 local u
227 for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do
228 printf "${u}/${pn}-${pv}-patches/%s " "$@"
229 done
230 fi
231 }
232
233 # The version of readline this bash normally ships with.
234 READLINE_VER="6.3"
235
236 DESCRIPTION="The standard GNU Bourne again shell"
237 HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html"
238 SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
239 [[ ${PV} == *_rc* ]] && SRC_URI+=" ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
240
241 LICENSE="GPL-3"
242 SLOT="0"
243 #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
244 IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline vanilla"
245
246 DEPEND=">=sys-libs/ncurses-5.2-r2
247 readline? ( >=sys-libs/readline-${READLINE_VER} )
248 nls? ( virtual/libintl )"
249 RDEPEND="${DEPEND}
250 !<sys-apps/portage-2.1.6.7_p1
251 !<sys-apps/paludis-0.26.0_alpha5"
252 # we only need yacc when the .y files get patched (bash42-005)
253 DEPEND+=" virtual/yacc"
254
255 S=${WORKDIR}/${MY_P}
256
257 pkg_setup() {
258 if is-flag -malign-double ; then #7332
259 eerror "Detected bad CFLAGS '-malign-double'. Do not use this"
260 eerror "as it breaks LFS (struct stat64) on x86."
261 die "remove -malign-double from your CFLAGS mr ricer"
262 fi
263 if use bashlogger ; then
264 ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
265 ewarn "This will log ALL output you enter into the shell, you have been warned."
266 fi
267 }
268
269 src_unpack() {
270 unpack ${MY_P}.tar.gz
271 }
272
273 src_prepare() {
274 # Include official patches
275 [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
276
277 # Clean out local libs so we know we use system ones w/releases.
278 if [[ ${PV} != *_rc* ]] ; then
279 rm -rf lib/{readline,termcap}/*
280 touch lib/{readline,termcap}/Makefile.in # for config.status
281 sed -ri -e 's:\$[(](RL|HIST)_LIBSRC[)]/[[:alpha:]]*.h::g' Makefile.in || die
282 fi
283
284 # Avoid regenerating docs after patches #407985
285 sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
286 touch -r . doc/*
287
288 epatch "${FILESDIR}"/${PN}-4.3-compat-lvl.patch
289 epatch "${FILESDIR}"/${PN}-4.3-parse-time-keyword.patch
290 epatch "${FILESDIR}"/${PN}-4.3-append-process-segfault.patch
291 epatch "${FILESDIR}"/${PN}-4.3-term-cleanup.patch
292 epatch "${FILESDIR}"/${PN}-redir-stack-overflow.patch #523742
293
294 epatch_user
295 }
296
297 src_configure() {
298 local myconf=()
299
300 # For descriptions of these, see config-top.h
301 # bashrc/#26952 bash_logout/#90488 ssh/#24762
302 append-cppflags \
303 -DDEFAULT_PATH_VALUE=\'\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"\' \
304 -DSTANDARD_UTILS_PATH=\'\"/bin:/usr/bin:/sbin:/usr/sbin\"\' \
305 -DSYS_BASHRC=\'\"/etc/bash/bashrc\"\' \
306 -DSYS_BASH_LOGOUT=\'\"/etc/bash/bash_logout\"\' \
307 -DNON_INTERACTIVE_LOGIN_SHELLS \
308 -DSSH_SOURCE_BASHRC \
309 $(use bashlogger && echo -DSYSLOG_HISTORY)
310
311 # Don't even think about building this statically without
312 # reading Bug 7714 first. If you still build it statically,
313 # don't come crying to us with bugs ;).
314 #use static && export LDFLAGS="${LDFLAGS} -static"
315 use nls || myconf+=( --disable-nls )
316
317 # Historically, we always used the builtin readline, but since
318 # our handling of SONAME upgrades has gotten much more stable
319 # in the PM (and the readline ebuild itself preserves the old
320 # libs during upgrades), linking against the system copy should
321 # be safe.
322 # Exact cached version here doesn't really matter as long as it
323 # is at least what's in the DEPEND up above.
324 export ac_cv_rl_version=${READLINE_VER}
325
326 # Force linking with system curses ... the bundled termcap lib
327 # sucks bad compared to ncurses. For the most part, ncurses
328 # is here because readline needs it. But bash itself calls
329 # ncurses in one or two small places :(.
330
331 if [[ ${PV} != *_rc* ]] ; then
332 # Use system readline only with released versions.
333 myconf+=( --with-installed-readline=. )
334 fi
335
336 if use plugins; then
337 append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
338 else
339 # Disable the plugins logic by hand since bash doesn't
340 # provide a way of doing it.
341 export ac_cv_func_dl{close,open,sym}=no \
342 ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no
343 sed -i \
344 -e '/LOCAL_LDFLAGS=/s:-rdynamic::' \
345 configure || die
346 fi
347 tc-export AR #444070
348 econf \
349 --docdir='$(datarootdir)'/doc/${PF} \
350 --htmldir='$(docdir)/html' \
351 --with-curses \
352 $(use_with afs) \
353 $(use_enable net net-redirections) \
354 --disable-profiling \
355 $(use_enable mem-scramble) \
356 $(use_with mem-scramble bash-malloc) \
357 $(use_enable readline) \
358 $(use_enable readline history) \
359 $(use_enable readline bang-history) \
360 "${myconf[@]}"
361 }
362
363 src_compile() {
364 emake
365
366 if use plugins ; then
367 emake -C examples/loadables all others
368 fi
369 }
370
371 src_install() {
372 local d f
373
374 default
375
376 dodir /bin
377 mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
378 dosym bash /bin/rbash
379
380 insinto /etc/bash
381 doins "${FILESDIR}"/{bashrc,bash_logout}
382 insinto /etc/skel
383 for f in bash{_logout,_profile,rc} ; do
384 newins "${FILESDIR}"/dot-${f} .${f}
385 done
386
387 local sed_args=(
388 -e "s:#${USERLAND}#@::"
389 -e '/#@/d'
390 )
391 if ! use readline ; then
392 sed_args+=( #432338
393 -e '/^shopt -s histappend/s:^:#:'
394 -e 's:use_color=true:use_color=false:'
395 )
396 fi
397 sed -i \
398 "${sed_args[@]}" \
399 "${ED}"/etc/skel/.bashrc \
400 "${ED}"/etc/bash/bashrc || die
401
402 if use plugins ; then
403 exeinto /usr/$(get_libdir)/bash
404 doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
405 insinto /usr/include/bash-plugins
406 doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h}
407 fi
408
409 if use examples ; then
410 for d in examples/{functions,misc,scripts,scripts.noah,scripts.v2} ; do
411 exeinto /usr/share/doc/${PF}/${d}
412 insinto /usr/share/doc/${PF}/${d}
413 for f in ${d}/* ; do
414 if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
415 doexe ${f}
416 else
417 doins ${f}
418 fi
419 done
420 done
421 fi
422
423 doman doc/*.1
424 newdoc CWRU/changelog ChangeLog
425 dosym bash.info /usr/share/info/bashref.info
426 }
427
428 pkg_preinst() {
429 if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
430 mkdir -p "${EROOT}"/etc/bash
431 mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
432 fi
433
434 if [[ -L ${EROOT}/bin/sh ]] ; then
435 # rewrite the symlink to ensure that its mtime changes. having /bin/sh
436 # missing even temporarily causes a fatal error with paludis.
437 local target=$(readlink "${EROOT}"/bin/sh)
438 local tmp=$(emktemp "${EROOT}"/bin)
439 ln -sf "${target}" "${tmp}"
440 mv -f "${tmp}" "${EROOT}"/bin/sh
441 fi
442 }
443
444 pkg_postinst() {
445 # If /bin/sh does not exist, provide it
446 if [[ ! -e ${EROOT}/bin/sh ]] ; then
447 ln -sf bash "${EROOT}"/bin/sh
448 fi
449 }
450
451
452
453 1.1 app-shells/bash/bash-4.2_p50-r1.ebuild
454
455 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-shells/bash/bash-4.2_p50-r1.ebuild?rev=1.1&view=markup
456 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-shells/bash/bash-4.2_p50-r1.ebuild?rev=1.1&content-type=text/plain
457
458 Index: bash-4.2_p50-r1.ebuild
459 ===================================================================
460 # Copyright 1999-2014 Gentoo Foundation
461 # Distributed under the terms of the GNU General Public License v2
462 # $Header: /var/cvsroot/gentoo-x86/app-shells/bash/bash-4.2_p50-r1.ebuild,v 1.1 2014/09/30 20:34:29 polynomial-c Exp $
463
464 EAPI="4"
465
466 inherit eutils flag-o-matic toolchain-funcs multilib
467
468 # Official patchlevel
469 # See ftp://ftp.cwru.edu/pub/bash/bash-4.2-patches/
470 PLEVEL=${PV##*_p}
471 MY_PV=${PV/_p*}
472 MY_PV=${MY_PV/_/-}
473 MY_P=${PN}-${MY_PV}
474 [[ ${PV} != *_p* ]] && PLEVEL=0
475 patches() {
476 local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}}
477 [[ ${plevel} -eq 0 ]] && return 1
478 eval set -- {1..${plevel}}
479 set -- $(printf "${pn}${pv/\.}-%03d " "$@")
480 if [[ ${opt} == -s ]] ; then
481 echo "${@/#/${DISTDIR}/}"
482 else
483 local u
484 for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do
485 printf "${u}/${pn}-${pv}-patches/%s " "$@"
486 done
487 fi
488 }
489
490 DESCRIPTION="The standard GNU Bourne again shell"
491 HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html"
492 SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)"
493
494 LICENSE="GPL-3"
495 SLOT="0"
496 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
497 IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline vanilla"
498
499 DEPEND=">=sys-libs/ncurses-5.2-r2
500 readline? ( >=sys-libs/readline-6.2 )
501 nls? ( virtual/libintl )"
502 RDEPEND="${DEPEND}
503 !!<sys-apps/portage-2.1.6.7_p1
504 !!<sys-apps/paludis-0.26.0_alpha5"
505 # we only need yacc when the .y files get patched (bash42-005)
506 DEPEND+=" virtual/yacc"
507
508 S=${WORKDIR}/${MY_P}
509
510 pkg_setup() {
511 if is-flag -malign-double ; then #7332
512 eerror "Detected bad CFLAGS '-malign-double'. Do not use this"
513 eerror "as it breaks LFS (struct stat64) on x86."
514 die "remove -malign-double from your CFLAGS mr ricer"
515 fi
516 if use bashlogger ; then
517 ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs."
518 ewarn "This will log ALL output you enter into the shell, you have been warned."
519 fi
520 }
521
522 src_unpack() {
523 unpack ${MY_P}.tar.gz
524 }
525
526 src_prepare() {
527 # Include official patches
528 [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
529
530 # Clean out local libs so we know we use system ones
531 rm -rf lib/{readline,termcap}/*
532 touch lib/{readline,termcap}/Makefile.in # for config.status
533 sed -ri -e 's:\$[(](RL|HIST)_LIBSRC[)]/[[:alpha:]]*.h::g' Makefile.in || die
534
535 # Avoid regenerating docs after patches #407985
536 sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die
537 touch -r . doc/*
538
539 epatch "${FILESDIR}"/${PN}-4.2-execute-job-control.patch #383237
540 epatch "${FILESDIR}"/${PN}-4.2-parallel-build.patch
541 epatch "${FILESDIR}"/${PN}-4.2-no-readline.patch
542 epatch "${FILESDIR}"/${PN}-4.2-read-retry.patch #447810
543 if ! use vanilla ; then
544 epatch "${FILESDIR}"/${PN}-4.2-speed-up-read-N.patch
545 fi
546 epatch "${FILESDIR}"/${PN}-redir-stack-overflow.patch #523742
547
548 epatch_user
549 }
550
551 src_configure() {
552 local myconf=()
553
554 # For descriptions of these, see config-top.h
555 # bashrc/#26952 bash_logout/#90488 ssh/#24762
556 append-cppflags \
557 -DDEFAULT_PATH_VALUE=\'\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"\' \
558 -DSTANDARD_UTILS_PATH=\'\"/bin:/usr/bin:/sbin:/usr/sbin\"\' \
559 -DSYS_BASHRC=\'\"/etc/bash/bashrc\"\' \
560 -DSYS_BASH_LOGOUT=\'\"/etc/bash/bash_logout\"\' \
561 -DNON_INTERACTIVE_LOGIN_SHELLS \
562 -DSSH_SOURCE_BASHRC \
563 $(use bashlogger && echo -DSYSLOG_HISTORY)
564
565 # Don't even think about building this statically without
566 # reading Bug 7714 first. If you still build it statically,
567 # don't come crying to us with bugs ;).
568 #use static && export LDFLAGS="${LDFLAGS} -static"
569 use nls || myconf+=( --disable-nls )
570
571 # Historically, we always used the builtin readline, but since
572 # our handling of SONAME upgrades has gotten much more stable
573 # in the PM (and the readline ebuild itself preserves the old
574 # libs during upgrades), linking against the system copy should
575 # be safe.
576 # Exact cached version here doesn't really matter as long as it
577 # is at least what's in the DEPEND up above.
578 export ac_cv_rl_version=6.2
579
580 # Force linking with system curses ... the bundled termcap lib
581 # sucks bad compared to ncurses. For the most part, ncurses
582 # is here because readline needs it. But bash itself calls
583 # ncurses in one or two small places :(.
584
585 use plugins && append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
586 tc-export AR #444070
587 econf \
588 --with-installed-readline=. \
589 --with-curses \
590 $(use_with afs) \
591 $(use_enable net net-redirections) \
592 --disable-profiling \
593 $(use_enable mem-scramble) \
594 $(use_with mem-scramble bash-malloc) \
595 $(use_enable readline) \
596 $(use_enable readline history) \
597 $(use_enable readline bang-history) \
598 "${myconf[@]}"
599 }
600
601 src_compile() {
602 emake
603
604 if use plugins ; then
605 emake -C examples/loadables all others
606 fi
607 }
608
609 src_install() {
610 emake install DESTDIR="${D}"
611
612 dodir /bin
613 mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die
614 dosym bash /bin/rbash
615
616 insinto /etc/bash
617 doins "${FILESDIR}"/{bashrc,bash_logout}
618 insinto /etc/skel
619 for f in bash{_logout,_profile,rc} ; do
620 newins "${FILESDIR}"/dot-${f} .${f}
621 done
622
623 local sed_args=(
624 -e "s:#${USERLAND}#@::"
625 -e '/#@/d'
626 )
627 if ! use readline ; then
628 sed_args+=( #432338
629 -e '/^shopt -s histappend/s:^:#:'
630 -e 's:use_color=true:use_color=false:'
631 )
632 fi
633 sed -i \
634 "${sed_args[@]}" \
635 "${ED}"/etc/skel/.bashrc \
636 "${ED}"/etc/bash/bashrc || die
637
638 if use plugins ; then
639 exeinto /usr/$(get_libdir)/bash
640 doexe $(echo examples/loadables/*.o | sed 's:\.o::g')
641 insinto /usr/include/bash-plugins
642 doins *.h builtins/*.h examples/loadables/*.h include/*.h \
643 lib/{glob/glob.h,tilde/tilde.h}
644 fi
645
646 if use examples ; then
647 for d in examples/{functions,misc,scripts,scripts.noah,scripts.v2} ; do
648 exeinto /usr/share/doc/${PF}/${d}
649 insinto /usr/share/doc/${PF}/${d}
650 for f in ${d}/* ; do
651 if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then
652 doexe ${f}
653 else
654 doins ${f}
655 fi
656 done
657 done
658 fi
659
660 doman doc/*.1
661 dodoc README NEWS AUTHORS CHANGES COMPAT Y2K doc/FAQ doc/INTRO
662 dosym bash.info /usr/share/info/bashref.info
663 }
664
665 pkg_preinst() {
666 if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then
667 mkdir -p "${EROOT}"/etc/bash
668 mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/
669 fi
670
671 if [[ -L ${EROOT}/bin/sh ]]; then
672 # rewrite the symlink to ensure that its mtime changes. having /bin/sh
673 # missing even temporarily causes a fatal error with paludis.
674 local target=$(readlink "${EROOT}"/bin/sh)
675 local tmp=$(emktemp "${EROOT}"/bin)
676 ln -sf "${target}" "${tmp}"
677 mv -f "${tmp}" "${EROOT}"/bin/sh
678 fi
679 }
680
681 pkg_postinst() {
682 # If /bin/sh does not exist, provide it
683 if [[ ! -e ${EROOT}/bin/sh ]]; then
684 ln -sf bash "${EROOT}"/bin/sh
685 fi
686 }