Gentoo Archives: gentoo-commits

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