Browse Source

busybox: update patchset to -r2

master
parent
commit
9f851dc7da
  1. 80
      main/busybox/0001-ash-regressions-in-process-substitution.patch
  2. 91
      main/busybox/0001-rev-correct-output-for-long-input-lines.patch
  3. 7
      main/busybox/APKBUILD

80
main/busybox/0001-ash-regressions-in-process-substitution.patch

@ -0,0 +1,80 @@
From dab3c63da581f0d3d58e3ea1a620474eb5dad0ee Mon Sep 17 00:00:00 2001
From: Ron Yorston <rmy@pobox.com>
Date: Mon, 30 Aug 2021 20:31:42 +0100
Subject: [PATCH] ash: regressions in process substitution
Stacy Harper reports that this script:
test() { . /tmp/bb_test; }
echo "export TEST=foo" >/tmp/bb_test
test 2>/dev/null
echo "$TEST"
correctly prints 'foo' in BusyBox 1.33 but hangs in 1.34.
Bisection suggested the problem was caused by commit a1b0d3856 (ash: add
process substitution in bash-compatibility mode). Removing the call to
unwindredir() in cmdloop() introduced in that commit makes the script
work again.
Additionally, these examples of process substitution:
while true; do cat <(echo hi); done
f() { while true; do cat <(echo hi); done }
f
result in running out of file descriptors. This is a regression from
v5 of the process substitution patch caused by changes to evalcommand()
not being transferred to v6.
function old new delta
static.pushredir - 99 +99
evalcommand 1729 1750 +21
exitreset 69 86 +17
cmdloop 372 365 -7
unwindredir 28 - -28
pushredir 112 - -112
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 2/1 up/down: 137/-147) Total: -10 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
---
shell/ash.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/shell/ash.c b/shell/ash.c
index b5947147a..53c140930 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -10278,6 +10278,9 @@ evalcommand(union node *cmd, int flags)
/* First expand the arguments. */
TRACE(("evalcommand(0x%lx, %d) called\n", (long)cmd, flags));
+#if BASH_PROCESS_SUBST
+ redir_stop = redirlist;
+#endif
file_stop = g_parsefile;
back_exitstatus = 0;
@@ -10356,7 +10359,11 @@ evalcommand(union node *cmd, int flags)
lastarg = nargv[-1];
expredir(cmd->ncmd.redirect);
+#if !BASH_PROCESS_SUBST
redir_stop = pushredir(cmd->ncmd.redirect);
+#else
+ pushredir(cmd->ncmd.redirect);
+#endif
preverrout_fd = 2;
if (BASH_XTRACEFD && xflag) {
/* NB: bash closes fd == $BASH_XTRACEFD when it is changed.
@@ -13476,9 +13483,6 @@ cmdloop(int top)
#if JOBS
if (doing_jobctl)
showjobs(SHOW_CHANGED|SHOW_STDERR);
-#endif
-#if BASH_PROCESS_SUBST
- unwindredir(NULL);
#endif
inter = 0;
if (iflag && top) {

91
main/busybox/0001-rev-correct-output-for-long-input-lines.patch

@ -0,0 +1,91 @@
From 4357569fdc7bc482dea0ef0bff57a70e7f06523c Mon Sep 17 00:00:00 2001
From: Ron Yorston <rmy@pobox.com>
Date: Sat, 21 Aug 2021 09:36:27 +0100
Subject: rev: correct output for long input lines
The input buffer is initialised to a reasonable size and extended
if necessary. When this happened the offset into the buffer wasn't
reset to zero so subsequent lines were appended to the long line.
Fix this and add some tests.
function old new delta
rev_main 377 368 -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-9) Total: -9 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
---
testsuite/rev.tests | 46 ++++++++++++++++++++++++++++++++++++++++++++++
util-linux/rev.c | 1 +
2 files changed, 47 insertions(+)
create mode 100755 testsuite/rev.tests
diff --git a/testsuite/rev.tests b/testsuite/rev.tests
new file mode 100755
index 000000000..dd65dcd3b
--- /dev/null
+++ b/testsuite/rev.tests
@@ -0,0 +1,46 @@
+#!/bin/sh
+# Copyright 2021 by Ron Yorston
+# Licensed under GPLv2, see file LICENSE in this source tree.
+
+. ./testing.sh
+
+# testing "test name" "commands" "expected result" "file input" "stdin"
+
+testing "rev works" \
+ "rev input" \
+"\
+1 enil
+
+3 enil
+" \
+ "line 1\n\nline 3\n" \
+ ""
+
+testing "rev file with missing newline" \
+ "rev input" \
+"\
+1 enil
+
+3 enil" \
+ "line 1\n\nline 3" \
+ ""
+
+testing "rev file with NUL character" \
+ "rev input" \
+"\
+nil
+3 enil
+" \
+ "lin\000e 1\n\nline 3\n" \
+ ""
+
+testing "rev file with long line" \
+ "rev input" \
+"\
++--------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------
+cba
+" \
+ "---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+--------------+\nabc\n" \
+ ""
+
+exit $FAILCOUNT
diff --git a/util-linux/rev.c b/util-linux/rev.c
index d439b4da8..63b005c67 100644
--- a/util-linux/rev.c
+++ b/util-linux/rev.c
@@ -109,6 +109,7 @@ int rev_main(int argc UNUSED_PARAM, char **argv)
strrev(buf, strlen(buf));
#endif
fputs_stdout(buf);
+ pos = 0;
}
fclose(fp);
} while (*argv);
--
cgit v1.2.3

7
main/busybox/APKBUILD

@ -4,7 +4,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.34.0
pkgrel=1
pkgrel=2
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url="https://busybox.net/"
arch="all"
@ -21,6 +21,9 @@ options="suid !check"
replaces="busybox-initscripts" # move of default.script
triggers="busybox.trigger=/bin:/usr/bin:/sbin:/usr/sbin:/lib/modules/*"
source="https://busybox.net/downloads/busybox-$pkgver.tar.bz2
0001-rev-correct-output-for-long-input-lines.patch
0001-ash-regressions-in-process-substitution.patch
0001-nologin-Install-applet-to-sbin-instead-of-usr-sbin.patch
0001-adduser-default-to-sbin-nologin-as-shell-for-system-.patch
0001-properly-fix-wget-https-support.patch
@ -228,6 +231,8 @@ ifupdown() {
sha512sums="
c57231e6d5dea8f2f5429673e9ea392a0f4b752731ec1f4903da8ca786914cda3065d80deeb28fb27d77848c892d587adf3b3150218d27cd87c5ece43de1b35a busybox-1.34.0.tar.bz2
054e766429887e610c4a17846f495b7099bb419217f5fcc0dce0ed62b8740c2d4ee53b12a609b1830c26ac2af1eca9beb6140063b7d2665939f99f8664dfcc05 0001-rev-correct-output-for-long-input-lines.patch
61ee8a497ab53ef2cac88eb51929fb0b483930eabb8d015b5fea30eb21257b314b2fe9ec871d6c8b4208964eb1d8329c8db7039297e31618cf555dde65c2db8a 0001-ash-regressions-in-process-substitution.patch
ead3403578c071c2216de17ab0543984c1f1509c12c062f03af49141547c3ea21356f3e8f0f0695550f05a41a1379dd73fc3cc18dcd78addbb411f247351e353 0001-nologin-Install-applet-to-sbin-instead-of-usr-sbin.patch
a2787a3ecaf6746dadef62166e8ee6ecaa166147e5ad8b917c5838536057c875bab5f9cf40c3e05eba74d575484ac662929ac3799d58432d3a99ac46f364f302 0001-adduser-default-to-sbin-nologin-as-shell-for-system-.patch
1efe1c4894ae983fed5ac848125f8603f157b9d91c952c53f4192b48d3e50967e05559851148397b583f34fb02d480393547904b4635e4248248be567ab268ea 0001-properly-fix-wget-https-support.patch

Loading…
Cancel
Save