summaryrefslogtreecommitdiff
path: root/system/pdksh/patches/117_Debian-test.patch
blob: 5756df78d951918663fd1c3fe365acdb2ce7ff08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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
+---