aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2017-01-03 14:02:44 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2017-01-03 14:02:44 +0100
commit4bc5f6e81705599f3ecc4fda40c1c1d4208bd144 (patch)
tree2aee15c878dd28ba2ed0ec39bf90def660d250bb
parent79a726b37809408850c678d270b229323dace502 (diff)
downloadaports-4bc5f6e81705599f3ecc4fda40c1c1d4208bd144.tar.bz2
aports-4bc5f6e81705599f3ecc4fda40c1c1d4208bd144.tar.xz
main/busybox: fix ash regression
patch from upstream
-rw-r--r--main/busybox/0001-ash-fix-error-code-regression.patch124
-rw-r--r--main/busybox/APKBUILD7
2 files changed, 130 insertions, 1 deletions
diff --git a/main/busybox/0001-ash-fix-error-code-regression.patch b/main/busybox/0001-ash-fix-error-code-regression.patch
new file mode 100644
index 0000000000..31316726ba
--- /dev/null
+++ b/main/busybox/0001-ash-fix-error-code-regression.patch
@@ -0,0 +1,124 @@
+From ea7d2f6ec0596789fc5b2e3fca3b7a602bfa2c26 Mon Sep 17 00:00:00 2001
+From: Ron Yorston <rmy@pobox.com>
+Date: Tue, 3 Jan 2017 11:18:23 +0100
+Subject: [PATCH] ash: fix error code regression
+
+The commit 'ash,hush: set exit code 127 in "sh /does/not/exist" case'
+only partly implemented the dash commit '[ERROR] Allow the originator
+of EXERROR to set the exit status'. This resulted in incorrect error
+codes for a syntax error:
+
+ $ )
+ $ echo $?
+ 0
+
+or a redirection error for a special builtin:
+
+ $ rm -f xxx
+ $ eval cat <xxx
+ $ echo $?
+ 0
+
+Signed-off-by: Ron Yorston <rmy@pobox.com>
+Reported-by: Martijn Dekker <martijn@inlv.org>
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+---
+ shell/ash.c | 8 ++++++--
+ shell/ash_test/ash-misc/exitcode2.right | 4 ++++
+ shell/ash_test/ash-misc/exitcode2.tests | 12 ++++++++++++
+ shell/hush_test/hush-misc/exitcode2.right | 4 ++++
+ shell/hush_test/hush-misc/exitcode2.tests | 12 ++++++++++++
+ 5 files changed, 38 insertions(+), 2 deletions(-)
+ create mode 100644 shell/ash_test/ash-misc/exitcode2.right
+ create mode 100755 shell/ash_test/ash-misc/exitcode2.tests
+ create mode 100644 shell/hush_test/hush-misc/exitcode2.right
+ create mode 100755 shell/hush_test/hush-misc/exitcode2.tests
+
+diff --git a/shell/ash.c b/shell/ash.c
+index 430e42a7b..7c53946ce 100644
+--- a/shell/ash.c
++++ b/shell/ash.c
+@@ -1284,6 +1284,8 @@ ash_msg_and_raise_error(const char *msg, ...)
+ {
+ va_list ap;
+
++ exitstatus = 2;
++
+ va_start(ap, msg);
+ ash_vmsg_and_raise(EXERROR, msg, ap);
+ /* NOTREACHED */
+@@ -9588,11 +9590,13 @@ evalcommand(union node *cmd, int flags)
+ }
+
+ if (status) {
++ bail:
++ exitstatus = status;
++
+ /* We have a redirection error. */
+ if (spclbltin > 0)
+ raise_exception(EXERROR);
+- bail:
+- exitstatus = status;
++
+ goto out;
+ }
+
+diff --git a/shell/ash_test/ash-misc/exitcode2.right b/shell/ash_test/ash-misc/exitcode2.right
+new file mode 100644
+index 000000000..f7cb983c6
+--- /dev/null
++++ b/shell/ash_test/ash-misc/exitcode2.right
+@@ -0,0 +1,4 @@
++./test.sh: line 1: syntax error: unexpected ")"
++Done:2
++./exitcode2.tests: line 11: can't open does_not_exist: no such file
++Done:1
+diff --git a/shell/ash_test/ash-misc/exitcode2.tests b/shell/ash_test/ash-misc/exitcode2.tests
+new file mode 100755
+index 000000000..79a6ebd50
+--- /dev/null
++++ b/shell/ash_test/ash-misc/exitcode2.tests
+@@ -0,0 +1,12 @@
++# syntax error should return status 2
++cat >test.sh <<EOF
++)
++EOF
++chmod +x test.sh
++$THIS_SH ./test.sh
++echo Done:$?
++rm -f test.sh
++
++# redirection error with special builtin should return status 1
++(eval cat <does_not_exist)
++echo Done:$?
+diff --git a/shell/hush_test/hush-misc/exitcode2.right b/shell/hush_test/hush-misc/exitcode2.right
+new file mode 100644
+index 000000000..0a57b9b1b
+--- /dev/null
++++ b/shell/hush_test/hush-misc/exitcode2.right
+@@ -0,0 +1,4 @@
++hush: syntax error: unexpected )
++Done:2
++hush: can't open 'does_not_exist': No such file or directory
++Done:1
+diff --git a/shell/hush_test/hush-misc/exitcode2.tests b/shell/hush_test/hush-misc/exitcode2.tests
+new file mode 100755
+index 000000000..79a6ebd50
+--- /dev/null
++++ b/shell/hush_test/hush-misc/exitcode2.tests
+@@ -0,0 +1,12 @@
++# syntax error should return status 2
++cat >test.sh <<EOF
++)
++EOF
++chmod +x test.sh
++$THIS_SH ./test.sh
++echo Done:$?
++rm -f test.sh
++
++# redirection error with special builtin should return status 1
++(eval cat <does_not_exist)
++echo Done:$?
+--
+2.11.0
+
diff --git a/main/busybox/APKBUILD b/main/busybox/APKBUILD
index a5a79c2c56..0b8c73ff88 100644
--- a/main/busybox/APKBUILD
+++ b/main/busybox/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.26.1
-pkgrel=0
+pkgrel=1
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://busybox.net
arch="all"
@@ -28,6 +28,8 @@ source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2
0011-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch
0012-diff-add-support-for-no-dereference.patch
+ 0001-ash-fix-error-code-regression.patch
+
acpid.logrotate
busyboxconfig
bbsuid.c
@@ -157,6 +159,7 @@ e35fc8b29faf1742c0f09f5c3b95db94 0002-app-location-for-vi-and-lspci.patch
5f97342f411c5ad237a509066f757c1e 0010-su-FEATURE_SU_NULLOK_SECURE.patch
723a879123be8df4726455d857d910aa 0011-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch
14746b0d10711cb4a824a166fc147706 0012-diff-add-support-for-no-dereference.patch
+4570da064e03480aeb76447af1170992 0001-ash-fix-error-code-regression.patch
4046b78ee6a25259954797d73b94f4bd acpid.logrotate
8da7e079770d2bfcc4224afe676e5600 busyboxconfig
378058009a1d6b1e321617b32b933e28 bbsuid.c
@@ -175,6 +178,7 @@ c158a8f317a327edb2f134178ffd7d1d3027a3644e925d93c031448cf35b4b2f 0008-login-mov
343cb66bead0b2a0069263069642ce95f139772dfd4d44d8b81db6d0c142a54d 0010-su-FEATURE_SU_NULLOK_SECURE.patch
9bc67c6af540cbfdc05c020f517e5f0b8def2cb789f83891e6599ff310e999cb 0011-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch
c77369008d38b2e4622bc61a2d546f0005bed5c8e5d6a59c0a24bbad7ad04ea2 0012-diff-add-support-for-no-dereference.patch
+9deb0aaa2d03db0dd9aadc73b4c54557c33c2a380f710638e2dface0e50ca2bf 0001-ash-fix-error-code-regression.patch
f7cbeb5a5a47395ad30454ce8262abcd3e91c33ef803c2ae31a9258d7142dd48 acpid.logrotate
934fd31f15bc68923c571c53f1e78d99fbab673d9053c2b3bf5f14f39aba3486 busyboxconfig
52bd2c7c44779f910eedd2fea73ec0de520add400894cc132276587e25c73e39 bbsuid.c
@@ -193,6 +197,7 @@ fc291167b2e026166e283d98d2d61cb3c9701e5e83c09062692d0c5a77f3b838ba73065706461095
f82caa1dc4395f266b024a7face267a916a80ead95f3d392b10fd397d0fdf62703e3078357bc71962616d6531ea913aef80e1a7cdf8180bca70e723c7d331238 0010-su-FEATURE_SU_NULLOK_SECURE.patch
16b513b34b3bf16002f14566aae66aab986403cb7a0f416c27264b739706bbd624a99fd37d5b56ff6efe623f3cc48aef3e8fe51c4ae2e94eda3fe9e8e618e3a1 0011-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch
361959788bc11b7f20d4029bb0f561759d270983b09c44fe2a01817378c4eb1c98cd8ef73e7ef8c168b7540170f58ddb36b9e4f80a97565f3fe3ba85b593a471 0012-diff-add-support-for-no-dereference.patch
+79d2ec8ad1530aacf8c5ccc5386ede252b06c3d538d1d027f9f4fc29dabcae6832939a15cbe1b78224eae9191684966e5ca5da44c046988b7fd8a55db24dc30e 0001-ash-fix-error-code-regression.patch
dadb4c953ebc755b88ee95c1489feb0c2d352f6e44abc716166024e6eea11ab9d10c84fad62c081775834d205cb04aa1be3c994676c88f4284495c54b9188e8b acpid.logrotate
c762e8cd6f6cc780bff50ece4a651cc8581ef7079216ff7cd3976fba0ea99638ee6bc9b8a378578bab883364774ecc966fc346395ccbdd1ecffbf9396c3db53c busyboxconfig
c1dd56509277c59751907a27f067f1622191ddfd498acfe390d83136d36a41f2bdfc2fd4daf35af77219a66fb00fea20483f34112afd5df2ccd9f36ab548e66f bbsuid.c