slackbuilds_ponce/system/pdksh/patches/117_Debian-test.patch
2010-05-13 01:01:03 +02:00

78 lines
1.6 KiB
Diff

Fix 4-argument test - bug#465250
Index: pdksh-5.2.14/c_test.c
===================================================================
--- pdksh-5.2.14.orig/c_test.c 2009-09-19 12:03:25.000000000 +0200
+++ pdksh-5.2.14/c_test.c 2009-09-19 12:18:27.000000000 +0200
@@ -131,10 +131,27 @@
*/
if (argc <= 5) {
char **owp = wp;
+ char **owpend = te.wp_end;
int invert = 0;
Test_op op;
const char *opnd1, *opnd2;
+ if (argc >= 2 && ((*te.isa)(&te, TM_OPAREN)))
+ {
+ te.pos.wp = te.wp_end - 1;
+ if ((*te.isa)(&te, TM_CPAREN))
+ {
+ argc -= 2;
+ te.wp_end--;
+ te.pos.wp = owp + 2;
+ }
+ else
+ {
+ te.pos.wp = owp + 1;
+ te.wp_end = owpend;
+ }
+ }
+
while (--argc >= 0) {
if ((*te.isa)(&te, TM_END))
return !0;
@@ -173,6 +190,7 @@
break;
}
te.pos.wp = owp + 1;
+ te.wp_end = owpend;
}
return test_parse(&te);
Index: pdksh-5.2.14/tests/debian-117.t
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ pdksh-5.2.14/tests/debian-117.t 2009-09-19 12:22:53.000000000 +0200
@@ -0,0 +1,32 @@
+name: debian-117-1
+description:
+ Check test - bug#465250
+stdin:
+ test \( ! -e \) ; echo $?
+expected-stdout:
+ 1
+---
+name: debian-117-2
+description:
+ Check test - bug#465250
+stdin:
+ test \( -e \) ; echo $?
+expected-stdout:
+ 0
+---
+name: debian-117-3
+description:
+ Check test - bug#465250
+stdin:
+ test ! -e ; echo $?
+expected-stdout:
+ 1
+---
+name: debian-117-4
+description:
+ Check test - bug#465250
+stdin:
+ test -e ; echo $?
+expected-stdout:
+ 0
+---