Gentoo Archives: gentoo-commits

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