1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 # T2 SDE: package/.../pdksh/pdksh-5.2.14-1.patch
5 # Copyright (C) 2004 - 2005 The T2 SDE Project
6 # Copyright (C) 1998 - 2003 ROCK Linux Project
8 # More information can be found in the files COPYING and README.
10 # This patch file is dual-licensed. It is available under the license the
11 # patched project is licensed under, as long as it is an OpenSource license
12 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
13 # of the GNU General Public License as published by the Free Software
14 # Foundation; either version 2 of the License, or (at your option) any later
16 # --- T2-COPYRIGHT-NOTE-END ---
19 [ ftp://ftp.cs.mun.ca/pub/pdksh/pdksh-5.2.14-patches.1 ]
21 Here are patches for 3 significant bugs in pdksh-5.2.14:
22 - set -x dumps core (shf.c);
23 - output of "jobs" command is filled with ^A characters (jobs.c);
24 - "typeset -r foo=bar" fails saying foo is readonly (var.c).
29 shf->rp = nbuf + (shf->rp - shf->buf);
30 shf->wp = nbuf + (shf->wp - shf->buf);
31 shf->rbsize += shf->wbsize;
32 - shf->wbsize += shf->wbsize;
33 shf->wnleft += shf->wbsize;
44 - if (vq->flag & RDONLY) {
45 + int no_ro_check = error_ok & 0x4;
47 + if ((vq->flag & RDONLY) && !no_ro_check) {
48 warningf(TRUE, "%s: is read only", vq->name);
53 if (vp->flag&INTEGER) {
54 /* do not zero base before assignment */
55 - setstr(vp, val, KSH_UNWIND_ERROR);
56 + setstr(vp, val, KSH_UNWIND_ERROR | 0x4);
57 /* Done after assignment to override default */
61 /* setstr can't fail (readonly check already done) */
62 - setstr(vp, val, KSH_RETURN_ERROR);
63 + setstr(vp, val, KSH_RETURN_ERROR | 0x4);
66 /* only x[0] is ever exported, so use vpbase */
72 static void check_job ARGS((Job *j));
73 static void put_job ARGS((Job *j, int where));
74 static void remove_job ARGS((Job *j, const char *where));
75 -static void kill_job ARGS((Job *j));
76 -static void fill_command ARGS((char *c, int len, struct op *t));
77 +static int kill_job ARGS((Job *j, int sig));
79 /* initialize job control */
82 && procpid == kshpid)))))
85 - killpg(j->pgrp, SIGHUP);
87 + kill_job(j, SIGHUP);
89 + killpg(j->pgrp, SIGHUP);
91 - if (j->state == PSTOPPED)
92 - killpg(j->pgrp, SIGCONT);
93 + if (j->state == PSTOPPED) {
95 + kill_job(j, SIGCONT);
97 + killpg(j->pgrp, SIGCONT);
103 put_job(j, PJ_PAST_STOPPED);
106 - fill_command(p->command, sizeof(p->command), t);
107 + snptreef(p->command, sizeof(p->command), "%T", t);
109 /* create child process */
116 + kill_job(j, SIGKILL);
117 remove_job(j, "fork failed");
118 #ifdef NEED_PGRP_SYNC
120 @@ -823,11 +829,10 @@
123 if (j->pgrp == 0) { /* started when !Flag(FMONITOR) */
124 - for (p=j->proc_list; p != (Proc *) 0; p = p->next)
125 - if (kill(p->pid, sig) < 0) {
126 - bi_errorf("%s: %s", cp, strerror(errno));
129 + if (kill_job(j, sig) < 0) {
130 + bi_errorf("%s: %s", cp, strerror(errno));
135 if (j->state == PSTOPPED && (sig == SIGTERM || sig == SIGHUP))
136 @@ -1825,50 +1830,17 @@
138 * If jobs are compiled in then this routine expects sigchld to be blocked.
150 for (p = j->proc_list; p != (Proc *) 0; p = p->next)
152 - (void) kill(p->pid, SIGKILL);
155 -/* put a more useful name on a process than snptreef does (in certain cases) */
157 -fill_command(c, len, t)
165 - if (t->type == TEXEC || t->type == TCOM) {
166 - /* Causes problems when set -u is in effect, can also
167 - cause problems when array indices evaluated (may have
168 - side effects, eg, assignment, incr, etc.)
169 - if (t->type == TCOM)
170 - ap = eval(t->args, DOBLANK|DONTRUNCOMMAND);
174 - --len; /* save room for the null */
175 - while (len > 0 && *ap != (char *) 0) {
176 - alen = strlen(*ap);
179 - memcpy(c, *ap, alen);
189 - snptreef(c, len, "%T", t);
190 + if (kill(p->pid, sig) < 0)