summaryrefslogtreecommitdiff
path: root/system/pdksh/patches/112_OpenBSD-test.patch
diff options
context:
space:
mode:
authorDaniel LEVAI <leva@ecentrum.hu>2010-05-13 01:01:03 +0200
committerMichiel van Wessem <michiel@slackbuilds.org>2010-05-13 01:01:03 +0200
commit6ec76a9860188c0e2de54daf61f5a4ff590ad8ef (patch)
treeedd70b526118253bc6ab17c0dcd069325fa5016f /system/pdksh/patches/112_OpenBSD-test.patch
parent387f1e8f9c14fc5648eee03d43787806c806fe20 (diff)
downloadslackbuilds-6ec76a9860188c0e2de54daf61f5a4ff590ad8ef.tar.gz
system/pdksh: Added to 13.0 repository
Diffstat (limited to 'system/pdksh/patches/112_OpenBSD-test.patch')
-rw-r--r--system/pdksh/patches/112_OpenBSD-test.patch58
1 files changed, 58 insertions, 0 deletions
diff --git a/system/pdksh/patches/112_OpenBSD-test.patch b/system/pdksh/patches/112_OpenBSD-test.patch
new file mode 100644
index 0000000000..7058a2dac8
--- /dev/null
+++ b/system/pdksh/patches/112_OpenBSD-test.patch
@@ -0,0 +1,58 @@
+From OpenBSD:
+
+2009-03-01 21:11 otto
+
+ * c_test.c (1.18): Fix PR #723: test(1) operator precedence
+ inconsistent with POSIX Make sure ksh builtin test and test(1) do
+ not differ. From Christiano Farina Haesbaert. ok miod@
+
+
+Index: pdksh-5.2.14/c_test.c
+===================================================================
+--- pdksh-5.2.14.orig/c_test.c 2009-09-19 11:22:39.000000000 +0200
++++ pdksh-5.2.14/c_test.c 2009-09-19 12:03:25.000000000 +0200
+@@ -551,15 +551,23 @@
+ }
+ return res;
+ }
+- if ((op = (Test_op) (*te->isa)(te, TM_UNOP))) {
+- /* unary expression */
+- opnd1 = (*te->getopnd)(te, op, do_eval);
+- if (!opnd1) {
+- (*te->error)(te, -1, "missing argument");
+- return 0;
+- }
++ /*
++ * Binary should have precedence over unary in this case
++ * so that something like test \( -f = -f \) is accepted
++ */
++ if ((te->flags & TEF_DBRACKET) || (&te->pos.wp[1] < te->wp_end &&
++ !test_isop(te, TM_BINOP, te->pos.wp[1]))) {
++ if ((op = (Test_op) (*te->isa)(te, TM_UNOP))) {
++ /* unary expression */
++ opnd1 = (*te->getopnd)(te, op, do_eval);
++ if (!opnd1) {
++ (*te->error)(te, -1, "missing argument");
++ return 0;
++ }
+
+- return (*te->eval)(te, op, opnd1, (const char *) 0, do_eval);
++ return (*te->eval)(te, op, opnd1, (const char *) 0,
++ do_eval);
++ }
+ }
+ opnd1 = (*te->getopnd)(te, TO_NONOP, do_eval);
+ if (!opnd1) {
+Index: pdksh-5.2.14/tests/debian-112.t
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ pdksh-5.2.14/tests/debian-112.t 2009-09-19 12:06:33.000000000 +0200
+@@ -0,0 +1,8 @@
++name: debian-112-1
++description:
++ Check test operator precedence
++stdin:
++ test \( -f = -f \) && echo OK
++expected-stdout:
++ OK
++---