Subject: Re: bin/23545: /bin/sh on standalone floppy has bogus jobs output.
To: None <netbsd-bugs@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: netbsd-bugs
Date: 11/23/2003 17:44:53
> >Description:
> jobs does not display the job name on pipelines, displays just |
> >How-To-Repeat:
> cat /etc/passwd | less
> ^Z
> jobs
> >Fix:
This doesn't only apply to pipelines. The following should fix it:
ps->cmd is only 20 (not 200) if SMALL is defined. I presume this is
to reduce the memory footprint (maybe nothing is that short of space
though?). The code to rejenerate the command text from the internal
representation is always present.
David
Index: jobs.c
===================================================================
RCS file: /cvsroot/src/bin/sh/jobs.c,v
retrieving revision 1.60
diff -u -p -r1.60 jobs.c
--- jobs.c 2003/11/14 10:27:10 1.60
+++ jobs.c 2003/11/23 17:37:11
@@ -874,10 +874,8 @@ forkparent(struct job *jp, union node *n
ps->pid = pid;
ps->status = -1;
ps->cmd[0] = 0;
-#ifndef SMALL
if (/* iflag && rootshell && */ n)
commandtext(ps, n);
-#endif
}
TRACE(("In parent shell: child = %d\n", pid));
return pid;
@@ -1210,7 +1208,7 @@ commandtext(struct procstat *ps, union n
int len;
cmdnextc = ps->cmd;
- if (iflag || mflag)
+ if (iflag || mflag || sizeof ps->cmd < 100)
len = sizeof(ps->cmd);
else
len = sizeof(ps->cmd) / 10;
--
David Laight: david@l8s.co.uk