Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: sys-apps/busybox/files/, sys-apps/busybox/
Date: Sat, 05 Dec 2015 15:14:28
Message-Id: 1449328678.e1eddb2f7a28b1ee7d11399b7616cb033226b7c8.blueness@gentoo
1 commit: e1eddb2f7a28b1ee7d11399b7616cb033226b7c8
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Sat Dec 5 15:17:58 2015 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Sat Dec 5 15:17:58 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=e1eddb2f
7
8 sys-apps/busybox: bump to 1.24.1, bug #567506.
9
10 Package-Manager: portage-2.2.20.1
11 RepoMan-Options: --force
12
13 sys-apps/busybox/Manifest | 3 +
14 sys-apps/busybox/busybox-1.24.1-r99.ebuild | 310 ++++++++++++++++++++++
15 sys-apps/busybox/files/busybox-1.24.1-unzip.patch | 112 ++++++++
16 3 files changed, 425 insertions(+)
17
18 diff --git a/sys-apps/busybox/Manifest b/sys-apps/busybox/Manifest
19 index 43bbecd..4e7d4d8 100644
20 --- a/sys-apps/busybox/Manifest
21 +++ b/sys-apps/busybox/Manifest
22 @@ -1,5 +1,6 @@
23 AUX busybox-1.19.0-bb.patch 908 SHA256 98f92c2edbcf61d1bacef783ea8b08cce07051b0a4489ed3f4579296846f89f1 SHA512 d4024e531ce7113cf554646608b1ef356e51691e3e21d165621b3690c82b56a319867b90d9daba548b635d9dbd41be5efea63181b7123d4505e529d863a8214c WHIRLPOOL b0d6d9b08ad0930e5243c7addc8a6db61505e95ed8e72c64fbfd734cb6ff9e303b3eb8ea6ec4790b2be567783664230cf278eb3e673fa0844c3881cf993f7cb8
24 AUX busybox-1.23.1-trylink-flags.patch 1334 SHA256 9791303d0ec22b8c97223758987c0c4fa562ace05a56be4c17837c9f1e1ce490 SHA512 5ca429047719943cde0493790c9212f1386ac1ebeb65a15b0497ac49821cac36c60f78aa9f35551af28ab21465ef4118782260636968393f19ecd27c44a6a046 WHIRLPOOL 0fb2d02660c100ab1defc03da3292a9ec055697553aeb62094f1ae933edd99fe105ba2687910197dd253b7b970673973003707479f7a4865168d39f679b12f61
25 +AUX busybox-1.24.1-unzip.patch 3903 SHA256 423e7b2c9dc5614de8038e3938de6f6831e79bbd1889a9a80bef1780a2635ce8 SHA512 c6b33f1b3e8c995a8b47f6c66f068db4068a53293a6d321adb184ce2ffebff4a94c64814d80bfdf5ce103176ed6c892d4d9641f72831833672d87cefed97c472 WHIRLPOOL 8b356fb1a38697da657c0f2e47b726bc738a13d104c4169f8195646a7890f42d47fd0f217ad9943e4432b27d1fc6adad334f9ac4780f3a5ba48b6da977503c0c
26 AUX ginit.c 3097 SHA256 fd6a4715d3dd10f6db479020433da3997d397658301335c847fb779129238b8c SHA512 8bf70f13db0fbeecedf9a9f862c5391c0d8b7aa3ddd2ec85cda9b360c3117a01e32b01017b8c30197f587e521ba360ff70d1caf8d0f69d5c3a27f37ecc252e7c WHIRLPOOL a1ec3ccc296033d88a9504b693c7d249d0bd11b1d75e3f59a62137c5e4b4c914fe2b8971c86dbca2cc8ccc0d86f3f8c2c45bb44cec85a3628c44f091476baa92
27 AUX klogd.confd 218 SHA256 737b78745964e110da2fd3357c6d5fb80ccacf979039b8d40c03cf1cb969e5f3 SHA512 3348d5376b368b28d1431692a93868cd4550be12ad729340c5f78da35a5bd295e7613d70ce8ccde5029ad6d87a41c2f24155180f3570de8a9174dd63dece143f WHIRLPOOL ea28c1d926e36fba0ab69de8ddfd2503889b7cfa3a4ada347a9d22d9894fe30be068c0ed55f899b952e62b8de3cb69e1a4209f7864787988ded28ede10c7445a
28 AUX klogd.initd 359 SHA256 ef607b72d270797e4be1fba425c23ba26078633c47c698063bd4b17e7b4ff8c3 SHA512 e9d6215e4b0dcc4fbb507ce2bb84c818ad18951282c47c98b0c98b3fa58e6b28218f608689a7786cb0447673ae1f5c3ba5767f9b29cffd73325d93bf2a928ac9 WHIRLPOOL d7e82a0d2a6a60b2444a3b212022250297ca163001045bf508442972fc6330c4eea55cb965920778e090c92a69441e864e6721f02ecc6d10279b6196b14f7e71
29 @@ -18,5 +19,7 @@ AUX syslogd.initd 383 SHA256 b66e709317513b79139d5441c712839e271ff5177a3d743b86e
30 AUX watchdog.confd 232 SHA256 786d9497ad55c29d6fff231709e71ecad94f2ee1de3b45b461deb29c3eba1c63 SHA512 8fd7121075535195f3e5d43ec773713c883fb7865cd5e5927b3b20c2605c50acb81d50461bd1a246c1282006ce74b11932ac1cec67ddc2be15da2f9aa8674232 WHIRLPOOL 8ea0f6b759198c978f10bf0b2b00cc73343e72401a05edf257b9c5e1032e8a619328aaa02936b5b5a717a021baa84b5653b8c9826e14e5c07c7b7af98f878767
31 AUX watchdog.initd 334 SHA256 ae335a9540d282277d0a127673efff279177a1bb643e98afd772eef9423fe79f SHA512 e915a2b5567b1cfe5423b00ca984c37dea4afd72bc3b7a550858f7140dc18283831bb9cfeeb564ced2669706cf747f3934fd339f9e93d456b229b03781ac9303 WHIRLPOOL c57eaf47d0501394f2f08a6b6f09529f91fd34f3d5027f6e159573ea8c5321a88c2cb01511971d15f8b25c9a44693c88e340ee35949c4cdab49d7fbbbe064c22
32 DIST busybox-1.23.2.tar.bz2 2252786 SHA256 05a6f9e21aad8c098e388ae77de7b2361941afa7157ef74216703395b14e319a SHA512 209c8ef26e40ccb81510f6b663202b080f9bbecac7faf386bbabf7e36a43d63b15dd6ce9f7a84c1ccc5345c524999812251da1e113ef9faadc6af1fedd24c7c9 WHIRLPOOL a0396f7f49ae702f1617e72d5d4646aceec4eba67219c7125bd8d0926d1acb1ef41ea15a7406c3cf5e5e0d8925cc75910ed5128e5fbdd257b80e2cb4f7a048a2
33 +DIST busybox-1.24.1.tar.bz2 2068803 SHA256 37d03132cc078937360b392170b7a1d0e5b322eee9f57c0b82292a8b1f0afe3d SHA512 3afc757ebaae61ae13c2c69097ee734717434f9e658eb77093a8b7b49af3326cbca2d723483ff84a1da99544b822fd2b47d9a97c68f09962e11754e5daf124ca WHIRLPOOL 5e827d08d737caac832e7e5923da624094ff27ee2edbb46dadc339e95edba65378a8fa3db412682724476a2092eee41a804f8f36c2eec0b9f883f5ba855f3ad0
34 EBUILD busybox-1.23.2-r99.ebuild 8889 SHA256 395dec4ab6daeca4206d4b3ee45a901fbeee32a5c8faa516bb2abf98dc0b3e7d SHA512 3853b2c04731a67a55275217b9eee79effde01352c4e261721dca8b7e31b5c594ad275524464291b5bdcbd306dc17c8f7167411beb310815da03c7cfdebb3fe0 WHIRLPOOL 26e7e3b94139010f74d95e68b1329c75c6716429ec6b5dc72e2c9ad82c8ab052d74b3db25e651e37138021c3fada808a5820f7a1a9ec6e3761c74fa26a056a02
35 +EBUILD busybox-1.24.1-r99.ebuild 8806 SHA256 78cb413fffb1bf9b9da50ed3373672b07fea7ac40ced778e52710f0a1f365834 SHA512 6d8b480c5dcc9c45cb0d3572799962eba8d024e94dbf97d593ff7e8cd17fa878fb729ed243bcd4382e75e80c911991f116c0ba987e1700651bfe4a09e1cc2434 WHIRLPOOL 6840d74b1150bb75209144e9062d52be49c9b46d8f5f45e69ce8996d3f2e867ae1eda9f4c470d7641bf4066c883b7589ae0414843aebd1ceca900fa2286e364c
36 MISC metadata.xml 708 SHA256 e17f2240f57d74f8847e7bbf4e3cf44fdcd3ab3f610e0a66eb186d2a598178be SHA512 0d26c0593b156cc5764ad03c64e9b2a724b3877e348787d57818aec6b32f995951a9c0976a92d6ba824a2a5983d0c88116b9d335e51ba0e3c7b8f89e579482ba WHIRLPOOL 2ab4758748cf6d83d1a3a1d2f5f9472825a01affe5c7fdf8cd78fb9c75a1abaf18d8895fce12c7c502453caf68dd40799f47cce502804c9ec60705af2bb4f388
37
38 diff --git a/sys-apps/busybox/busybox-1.24.1-r99.ebuild b/sys-apps/busybox/busybox-1.24.1-r99.ebuild
39 new file mode 100644
40 index 0000000..7cde8fa
41 --- /dev/null
42 +++ b/sys-apps/busybox/busybox-1.24.1-r99.ebuild
43 @@ -0,0 +1,310 @@
44 +# Copyright 1999-2015 Gentoo Foundation
45 +# Distributed under the terms of the GNU General Public License v2
46 +# $Id$
47 +
48 +# See `man savedconfig.eclass` for info on how to use USE=savedconfig.
49 +
50 +EAPI="4"
51 +inherit eutils flag-o-matic savedconfig toolchain-funcs multilib
52 +
53 +DESCRIPTION="Utilities for rescue and embedded systems"
54 +HOMEPAGE="http://www.busybox.net/"
55 +if [[ ${PV} == "9999" ]] ; then
56 + MY_P=${PN}
57 + EGIT_REPO_URI="git://busybox.net/busybox.git"
58 + inherit git-2
59 +else
60 + MY_P=${PN}-${PV/_/-}
61 + SRC_URI="http://www.busybox.net/downloads/${MY_P}.tar.bz2"
62 + KEYWORDS="amd64 arm ~mips ppc x86"
63 +fi
64 +
65 +LICENSE="GPL-2" # GPL-2 only
66 +SLOT="0"
67 +IUSE="debug ipv6 livecd make-symlinks math mdev pam selinux sep-usr static syslog systemd"
68 +RESTRICT="test"
69 +
70 +COMMON_DEPEND="!static? ( selinux? ( sys-libs/libselinux ) )
71 + pam? ( sys-libs/pam )"
72 +DEPEND="${COMMON_DEPEND}
73 + static? ( selinux? ( sys-libs/libselinux[static-libs(+)] ) )
74 + >=sys-kernel/linux-headers-2.6.39"
75 +RDEPEND="${COMMON_DEPEND}
76 + mdev? ( !<sys-apps/openrc-0.13 )"
77 +
78 +S=${WORKDIR}/${MY_P}
79 +
80 +busybox_config_option() {
81 + local flag=$1 ; shift
82 + if [[ ${flag} != [yn] ]] ; then
83 + busybox_config_option $(usex ${flag} y n) "$@"
84 + return
85 + fi
86 + while [[ $# -gt 0 ]] ; do
87 + if [[ ${flag} == "y" ]] ; then
88 + sed -i -e "s:.*\<CONFIG_$1\>.*set:CONFIG_$1=y:g" .config
89 + else
90 + sed -i -e "s:CONFIG_$1=y:# CONFIG_$1 is not set:g" .config
91 + fi
92 + einfo $(grep "CONFIG_$1[= ]" .config || echo Could not find CONFIG_$1 ...)
93 + shift
94 + done
95 +}
96 +
97 +busybox_config_enabled() {
98 + local val=$(sed -n "/^CONFIG_$1=/s:^[^=]*=::p" .config)
99 + case ${val} in
100 + "") return 1 ;;
101 + y) return 0 ;;
102 + *) echo "${val}" | sed -r 's:^"(.*)"$:\1:' ;;
103 + esac
104 +}
105 +
106 +src_prepare() {
107 + unset KBUILD_OUTPUT #88088
108 + append-flags -fno-strict-aliasing #310413
109 + use ppc64 && append-flags -mminimal-toc #130943
110 +
111 + # patches go here!
112 + epatch "${FILESDIR}"/${PN}-1.19.0-bb.patch
113 + epatch "${FILESDIR}"/${P}-*.patch
114 + cp "${FILESDIR}"/ginit.c init/ || die
115 +
116 + # flag cleanup
117 + sed -i -r \
118 + -e 's:[[:space:]]?-(Werror|Os|falign-(functions|jumps|loops|labels)=1|fomit-frame-pointer)\>::g' \
119 + Makefile.flags || die
120 + #sed -i '/bbsh/s:^//::' include/applets.h
121 + sed -i '/^#error Aborting compilation./d' applets/applets.c || die
122 + use elibc_glibc && sed -i 's:-Wl,--gc-sections::' Makefile
123 + sed -i \
124 + -e "/^CROSS_COMPILE/s:=.*:= ${CHOST}-:" \
125 + -e "/^AR\>/s:=.*:= $(tc-getAR):" \
126 + -e "/^CC\>/s:=.*:= $(tc-getCC):" \
127 + -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
128 + -e "/^PKG_CONFIG\>/s:=.*:= $(tc-getPKG_CONFIG):" \
129 + Makefile || die
130 + sed -i \
131 + -e 's:-static-libgcc::' \
132 + Makefile.flags || die
133 +}
134 +
135 +src_configure() {
136 + # check for a busybox config before making one of our own.
137 + # if one exist lets return and use it.
138 +
139 + restore_config .config
140 + if [ -f .config ]; then
141 + yes "" | emake -j1 -s oldconfig >/dev/null
142 + return 0
143 + else
144 + ewarn "Could not locate user configfile, so we will save a default one"
145 + fi
146 +
147 + # setup the config file
148 + emake -j1 -s allyesconfig >/dev/null
149 + # nommu forces a bunch of things off which we want on #387555
150 + busybox_config_option n NOMMU
151 + sed -i '/^#/d' .config
152 + yes "" | emake -j1 -s oldconfig >/dev/null
153 +
154 + # now turn off stuff we really don't want
155 + busybox_config_option n DMALLOC
156 + busybox_config_option n FEATURE_SUID_CONFIG
157 + busybox_config_option n BUILD_AT_ONCE
158 + busybox_config_option n BUILD_LIBBUSYBOX
159 + busybox_config_option n FEATURE_CLEAN_UP
160 + busybox_config_option n MONOTONIC_SYSCALL
161 + busybox_config_option n START_STOP_DAEMON
162 + busybox_config_option n USE_PORTABLE_CODE
163 + busybox_config_option n WERROR
164 +
165 + # These causes trouble with musl. Since we don't really
166 + # depend on busybox for most of the musl work, we'll lazily
167 + # just turn them off.
168 + busybox_config_option n FEATURE_UTMP
169 + busybox_config_option n EXTRA_COMPAT
170 + busybox_config_option n FEATURE_VI_REGEX_SEARCH
171 +
172 + # If these are not set and we are using a uclibc/busybox setup
173 + # all calls to system() will fail.
174 + busybox_config_option y ASH
175 + busybox_config_option n HUSH
176 +
177 + # disable ipv6 applets
178 + if ! use ipv6; then
179 + busybox_config_option n FEATURE_IPV6
180 + busybox_config_option n TRACEROUTE6
181 + busybox_config_option n PING6
182 + busybox_config_option n UDHCPC6
183 + fi
184 +
185 + if use static && use pam ; then
186 + ewarn "You cannot have USE='static pam'. Assuming static is more important."
187 + fi
188 + busybox_config_option $(usex static n pam) PAM
189 + busybox_config_option static STATIC
190 + busybox_config_option syslog {K,SYS}LOGD LOGGER
191 + busybox_config_option systemd FEATURE_SYSTEMD
192 + busybox_config_option math FEATURE_AWK_LIBM
193 +
194 + # all the debug options are compiler related, so punt them
195 + busybox_config_option n DEBUG
196 + busybox_config_option y NO_DEBUG_LIB
197 + busybox_config_option n DMALLOC
198 + busybox_config_option n EFENCE
199 + busybox_config_option $(usex debug y n) TFTP_DEBUG
200 +
201 + busybox_config_option selinux SELINUX
202 +
203 + # this opt only controls mounting with <linux-2.6.23
204 + busybox_config_option n FEATURE_MOUNT_NFS
205 +
206 + # default a bunch of uncommon options to off
207 + local opt
208 + for opt in \
209 + ADD_SHELL \
210 + BEEP BOOTCHARTD \
211 + CRONTAB \
212 + DC DEVFSD DNSD DPKG{,_DEB} \
213 + FAKEIDENTD FBSPLASH FOLD FSCK_MINIX FTP{GET,PUT} \
214 + FEATURE_DEVFS \
215 + HOSTID HUSH \
216 + INETD INOTIFYD IPCALC \
217 + LOCALE_SUPPORT LOGNAME LPD \
218 + MAKEMIME MKFS_MINIX MSH \
219 + OD \
220 + RDEV READPROFILE REFORMIME REMOVE_SHELL RFKILL RUN_PARTS RUNSV{,DIR} \
221 + SLATTACH SMEMCAP SULOGIN SV{,LOGD} \
222 + TASKSET TCPSVD \
223 + RPM RPM2CPIO \
224 + UDPSVD UUDECODE UUENCODE
225 + do
226 + busybox_config_option n ${opt}
227 + done
228 +
229 + emake -j1 oldconfig > /dev/null
230 +}
231 +
232 +src_compile() {
233 + unset KBUILD_OUTPUT #88088
234 + export SKIP_STRIP=y
235 +
236 + emake V=1 busybox
237 +}
238 +
239 +src_install() {
240 + unset KBUILD_OUTPUT #88088
241 + save_config .config
242 +
243 + into /
244 + dodir /bin
245 + if use sep-usr ; then
246 + # install /ginit to take care of mounting stuff
247 + exeinto /
248 + newexe busybox_unstripped ginit
249 + dosym /ginit /bin/bb
250 + dosym bb /bin/busybox
251 + else
252 + newbin busybox_unstripped busybox
253 + dosym busybox /bin/bb
254 + fi
255 + if use mdev ; then
256 + dodir /$(get_libdir)/mdev/
257 + use make-symlinks || dosym /bin/bb /sbin/mdev
258 + cp "${S}"/examples/mdev_fat.conf "${ED}"/etc/mdev.conf
259 +
260 + exeinto /$(get_libdir)/mdev/
261 + doexe "${FILESDIR}"/mdev/*
262 +
263 + newinitd "${FILESDIR}"/mdev.initd mdev
264 + fi
265 + if use livecd ; then
266 + dosym busybox /bin/vi
267 + fi
268 +
269 + # add busybox daemon's, bug #444718
270 + if busybox_config_enabled FEATURE_NTPD_SERVER; then
271 + newconfd "${FILESDIR}/ntpd.confd" "busybox-ntpd"
272 + newinitd "${FILESDIR}/ntpd.initd" "busybox-ntpd"
273 + fi
274 + if busybox_config_enabled SYSLOGD; then
275 + newconfd "${FILESDIR}/syslogd.confd" "busybox-syslogd"
276 + newinitd "${FILESDIR}/syslogd.initd" "busybox-syslogd"
277 + fi
278 + if busybox_config_enabled KLOGD; then
279 + newconfd "${FILESDIR}/klogd.confd" "busybox-klogd"
280 + newinitd "${FILESDIR}/klogd.initd" "busybox-klogd"
281 + fi
282 + if busybox_config_enabled WATCHDOG; then
283 + newconfd "${FILESDIR}/watchdog.confd" "busybox-watchdog"
284 + newinitd "${FILESDIR}/watchdog.initd" "busybox-watchdog"
285 + fi
286 + if busybox_config_enabled UDHCPC; then
287 + local path=$(busybox_config_enabled UDHCPC_DEFAULT_SCRIPT)
288 + exeinto "${path%/*}"
289 + newexe examples/udhcp/simple.script "${path##*/}"
290 + fi
291 + if busybox_config_enabled UDHCPD; then
292 + insinto /etc
293 + doins examples/udhcp/udhcpd.conf
294 + fi
295 +
296 + # bundle up the symlink files for use later
297 + emake DESTDIR="${ED}" install
298 + rm _install/bin/busybox
299 + # for compatibility, provide /usr/bin/env
300 + mkdir -p _install/usr/bin
301 + ln -s /bin/env _install/usr/bin/env
302 + tar cf busybox-links.tar -C _install . || : #;die
303 + insinto /usr/share/${PN}
304 + use make-symlinks && doins busybox-links.tar
305 +
306 + dodoc AUTHORS README TODO
307 +
308 + cd docs
309 + docinto txt
310 + dodoc *.txt
311 + docinto pod
312 + dodoc *.pod
313 + dohtml *.html
314 +
315 + cd ../examples
316 + docinto examples
317 + dodoc inittab depmod.pl *.conf *.script undeb unrpm
318 +}
319 +
320 +pkg_preinst() {
321 + if use make-symlinks && [[ ! ${VERY_BRAVE_OR_VERY_DUMB} == "yes" ]] && [[ ${ROOT} == "/" ]] ; then
322 + ewarn "setting USE=make-symlinks and emerging to / is very dangerous."
323 + ewarn "it WILL overwrite lots of system programs like: ls bash awk grep (bug 60805 for full list)."
324 + ewarn "If you are creating a binary only and not merging this is probably ok."
325 + ewarn "set env VERY_BRAVE_OR_VERY_DUMB=yes if this is really what you want."
326 + die "silly options will destroy your system"
327 + fi
328 +
329 + if use make-symlinks ; then
330 + mv "${ED}"/usr/share/${PN}/busybox-links.tar "${T}"/ || die
331 + fi
332 +}
333 +
334 +pkg_postinst() {
335 + savedconfig_pkg_postinst
336 +
337 + if use make-symlinks ; then
338 + cd "${T}" || die
339 + mkdir _install
340 + tar xf busybox-links.tar -C _install || die
341 + cp -vpPR _install/* "${ROOT}"/ || die "copying links for ${x} failed"
342 + fi
343 +
344 + if use sep-usr ; then
345 + elog "In order to use the sep-usr support, you have to update your"
346 + elog "kernel command line. Add the option:"
347 + elog " init=/ginit"
348 + elog "To launch a different init than /sbin/init, use:"
349 + elog " init=/ginit /sbin/yourinit"
350 + elog "To get a rescue shell, you may boot with:"
351 + elog " init=/ginit bb"
352 + fi
353 +}
354
355 diff --git a/sys-apps/busybox/files/busybox-1.24.1-unzip.patch b/sys-apps/busybox/files/busybox-1.24.1-unzip.patch
356 new file mode 100644
357 index 0000000..722b5fb
358 --- /dev/null
359 +++ b/sys-apps/busybox/files/busybox-1.24.1-unzip.patch
360 @@ -0,0 +1,112 @@
361 +https://bugs.gentoo.org/564246
362 +
363 +From 1de25a6e87e0e627aa34298105a3d17c60a1f44e Mon Sep 17 00:00:00 2001
364 +From: Denys Vlasenko <vda.linux@××××××××××.com>
365 +Date: Mon, 26 Oct 2015 19:33:05 +0100
366 +Subject: [PATCH] unzip: test for bad archive SEGVing
367 +
368 +function old new delta
369 +huft_build 1296 1300 +4
370 +
371 +Signed-off-by: Denys Vlasenko <vda.linux@××××××××××.com>
372 +---
373 + archival/libarchive/decompress_gunzip.c | 11 +++++++----
374 + testsuite/unzip.tests | 23 ++++++++++++++++++++++-
375 + 2 files changed, 29 insertions(+), 5 deletions(-)
376 +
377 +diff --git a/archival/libarchive/decompress_gunzip.c b/archival/libarchive/decompress_gunzip.c
378 +index 7b6f459..30bf451 100644
379 +--- a/archival/libarchive/decompress_gunzip.c
380 ++++ b/archival/libarchive/decompress_gunzip.c
381 +@@ -305,11 +305,12 @@ static int huft_build(const unsigned *b, const unsigned n,
382 + unsigned i; /* counter, current code */
383 + unsigned j; /* counter */
384 + int k; /* number of bits in current code */
385 +- unsigned *p; /* pointer into c[], b[], or v[] */
386 ++ const unsigned *p; /* pointer into c[], b[], or v[] */
387 + huft_t *q; /* points to current table */
388 + huft_t r; /* table entry for structure assignment */
389 + huft_t *u[BMAX]; /* table stack */
390 + unsigned v[N_MAX]; /* values in order of bit length */
391 ++ unsigned v_end;
392 + int ws[BMAX + 1]; /* bits decoded stack */
393 + int w; /* bits decoded */
394 + unsigned x[BMAX + 1]; /* bit offsets, then code stack */
395 +@@ -324,7 +325,7 @@ static int huft_build(const unsigned *b, const unsigned n,
396 +
397 + /* Generate counts for each bit length */
398 + memset(c, 0, sizeof(c));
399 +- p = (unsigned *) b; /* cast allows us to reuse p for pointing to b */
400 ++ p = b;
401 + i = n;
402 + do {
403 + c[*p]++; /* assume all entries <= BMAX */
404 +@@ -365,12 +366,14 @@ static int huft_build(const unsigned *b, const unsigned n,
405 + }
406 +
407 + /* Make a table of values in order of bit lengths */
408 +- p = (unsigned *) b;
409 ++ p = b;
410 + i = 0;
411 ++ v_end = 0;
412 + do {
413 + j = *p++;
414 + if (j != 0) {
415 + v[x[j]++] = i;
416 ++ v_end = x[j];
417 + }
418 + } while (++i < n);
419 +
420 +@@ -432,7 +435,7 @@ static int huft_build(const unsigned *b, const unsigned n,
421 +
422 + /* set up table entry in r */
423 + r.b = (unsigned char) (k - w);
424 +- if (p >= v + n) {
425 ++ if (p >= v + v_end) { // Was "if (p >= v + n)" but v[] can be shorter!
426 + r.e = 99; /* out of values--invalid code */
427 + } else if (*p < s) {
428 + r.e = (unsigned char) (*p < 256 ? 16 : 15); /* 256 is EOB code */
429 +diff --git a/testsuite/unzip.tests b/testsuite/unzip.tests
430 +index 8677a03..ca0a458 100755
431 +--- a/testsuite/unzip.tests
432 ++++ b/testsuite/unzip.tests
433 +@@ -7,7 +7,7 @@
434 +
435 + . ./testing.sh
436 +
437 +-# testing "test name" "options" "expected result" "file input" "stdin"
438 ++# testing "test name" "commands" "expected result" "file input" "stdin"
439 + # file input will be file called "input"
440 + # test can create a file "actual" instead of writing to stdout
441 +
442 +@@ -30,6 +30,27 @@ testing "unzip (subdir only)" "unzip -q foo.zip foo/ && test -d foo && test ! -f
443 + rmdir foo
444 + rm foo.zip
445 +
446 ++# File containing some damaged encrypted stream
447 ++testing "unzip (bad archive)" "uudecode; unzip bad.zip 2>&1; echo \$?" \
448 ++"Archive: bad.zip
449 ++ inflating: ]3j½r«IK-%Ix
450 ++unzip: inflate error
451 ++1
452 ++" \
453 ++"" "\
454 ++begin-base64 644 bad.zip
455 ++UEsDBBQAAgkIAAAAIQA5AAAANwAAADwAAAAQAAcAXTNqwr1ywqtJGxJLLSVJ
456 ++eCkBD0AdKBk8JzQsIj01JC0/ORJQSwMEFAECCAAAAAAhADoAAAAPAAAANgAA
457 ++AAwAAQASw73Ct1DCokohPXQiNjoUNTUiHRwgLT4WHlBLAQIQABQAAggIAAAA
458 ++oQA5AAAANwAAADwAAAAQQAcADAAAACwAMgCAAAAAAABdM2rCvXLCq0kbEkst
459 ++JUl4KQEPQB0oGSY4Cz4QNgEnJSYIPVBLAQIAABQAAggAAAAAIQAqAAAADwAA
460 ++BDYAAAAMAAEADQAAADIADQAAAEEAAAASw73Ct1DKokohPXQiNzA+FAI1HCcW
461 ++NzITNFBLBQUKAC4JAA04Cw0EOhZQSwUGAQAABAIAAgCZAAAAeQAAAAIALhM=
462 ++====
463 ++"
464 ++
465 ++rm *
466 ++
467 + # Clean up scratch directory.
468 +
469 + cd ..
470 +--
471 +2.6.2
472 +