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