-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy path280-23332860.patch
120 lines (116 loc) · 3.05 KB
/
280-23332860.patch
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
This patch has been developed inhouse. This has been submitted
upstream but has not been accepted yet.
Details at https://github.com/att/ast/issues/36
--- INIT.2012-08-01/src/cmd/ksh93/include/defs.h 2017-04-10 15:37:35.435142020 -0700
+++ INIT.2012-08-01/src/cmd/ksh93/include/defs.h 2017-04-10 15:24:04.419549950 -0700
@@ -268,7 +268,10 @@
char *mathnodes; \
void *coshell; \
char *bltin_dir; \
- struct Regress_s*regress;
+ struct Regress_s*regress; \
+ char exittrap; \
+ char errtrap; \
+ char end_fn;
#include <shell.h>
--- INIT.2012-08-01/src/cmd/ksh93/sh/init.c 2017-04-10 15:37:35.701396890 -0700
+++ INIT.2012-08-01/src/cmd/ksh93/sh/init.c 2017-04-10 15:35:53.594855260 -0700
@@ -1584,6 +1584,9 @@
#endif
if(shp->userinit=userinit)
(*userinit)(shp, 0);
+ shp->exittrap = 0;
+ shp->errtrap = 0;
+ shp->end_fn = 0;
return(shp);
}
@@ -1685,6 +1688,9 @@
shp->inpipe = shp->outpipe = 0;
job_clear();
job.in_critical = 0;
+ shp->exittrap = 0;
+ shp->errtrap = 0;
+ shp->end_fn = 0;
return(1);
}
--- INIT.2012-08-01/src/cmd/ksh93/sh/main.c 2017-04-10 15:37:35.664623380 -0700
+++ INIT.2012-08-01/src/cmd/ksh93/sh/main.c 2017-04-10 15:36:23.627865790 -0700
@@ -466,6 +466,9 @@
error_info.line = 1;
shp->inlineno = 1;
shp->binscript = 0;
+ shp->exittrap = 0;
+ shp->errtrap = 0;
+ shp->end_fn = 0;
if(sfeof(iop))
goto eof_or_error;
/* command loop */
--- INIT.2012-08-01/src/cmd/ksh93/sh/xec.c 2017-04-10 15:37:35.844053420 -0700
+++ INIT.2012-08-01/src/cmd/ksh93/sh/xec.c 2017-04-10 15:34:04.652553500 -0700
@@ -1020,6 +1020,8 @@
shp->exitval=0;
shp->lastsig = 0;
shp->lastpath = 0;
+ if(shp->exittrap || shp->errtrap)
+ execflg = 0;
switch(type&COMMSK)
{
case TCOM:
@@ -3408,6 +3410,8 @@
nv_putval(SH_PATHNAMENOD,shp->st.filename,NV_NOFREE);
nv_putval(SH_FUNNAMENOD,shp->st.funname,NV_NOFREE);
}
+ if((execflg & sh_state(SH_NOFORK)))
+ shp->end_fn = 1;
jmpval = sigsetjmp(buffp->buff,0);
if(jmpval == 0)
{
@@ -3455,6 +3459,7 @@
shp->st = *prevscope;
shp->topscope = (Shscope_t*)prevscope;
nv_getval(sh_scoped(shp,IFSNOD));
+ shp->end_fn = 0;
if(nsig)
memcpy((char*)&shp->st.trapcom[0],savstak,nsig);
shp->trapnote=0;
--- INIT.2012-08-01.old/src/cmd/ksh93/bltins/trap.c 2017-01-16 05:20:58.530933660 -0800
+++ INIT.2012-08-01/src/cmd/ksh93/bltins/trap.c 2017-04-11 15:15:25.712874540 -0700
@@ -127,6 +127,17 @@
shp->trapnote |= SH_SIGTRAP;
else
shp->trapnote = 0;
+
+ }
+ if(sig == SH_ERRTRAP)
+ {
+ if(clear)
+ shp->errtrap = 0;
+ else
+ {
+ if(!shp->fn_depth || shp->end_fn)
+ shp->errtrap = 1;
+ }
}
continue;
}
@@ -144,6 +155,8 @@
else if(clear)
{
sh_sigclear(sig);
+ if(sig == 0)
+ shp->exittrap = 0;
if(dflag)
signal(sig,SIG_DFL);
}
@@ -156,6 +169,11 @@
shp->st.trapcom[sig] = (shp->sigflag[sig]&SH_SIGOFF) ? Empty : strdup(action);
if(arg && arg != Empty)
free(arg);
+ if(sig == 0)
+ {
+ if(!shp->fn_depth || shp->end_fn)
+ shp->exittrap = 1;
+ }
}
}
}