The NetBSD Project

CVS log for src/bin/sh/jobs.c

[BACK] Up to [cvs.NetBSD.org] / src / bin / sh

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.117.2.1 / (download) - annotate - [select for diffs], Sat Feb 3 14:31:38 2024 UTC (7 weeks, 5 days ago) by martin
Branch: netbsd-10
CVS Tags: netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4
Changes since 1.117: +4 -3 lines
Diff to previous 1.117 (colored) next main 1.118 (colored) to selected 1.60 (colored)

Pull up following revision(s) (requested by kre in ticket #577):

	bin/sh/jobs.c: revision 1.119

PR bin/57894

For jobs -p for a non-job-control job, avoid just printing 0 (as
there is no process group pid) and instead output what we used to,
the pid of one of the processes in the job (usually the right one!)

Revision 1.119 / (download) - annotate - [select for diffs], Tue Jan 30 19:05:07 2024 UTC (8 weeks, 2 days ago) by kre
Branch: MAIN
CVS Tags: HEAD
Changes since 1.118: +4 -3 lines
Diff to previous 1.118 (colored) to selected 1.60 (colored)

PR bin/57894

For jobs -p for a non-job-control job, avoid just printing 0 (as
there is no process group pid) and instead output what we used to,
the pid of one of the processes in the job (usually the right one!)

XXX pullup -10 (9 and earlier not affected).

Revision 1.118 / (download) - annotate - [select for diffs], Fri Apr 7 10:34:13 2023 UTC (11 months, 3 weeks ago) by kre
Branch: MAIN
Changes since 1.117: +5 -6 lines
Diff to previous 1.117 (colored) to selected 1.60 (colored)


The great shell trailing whitespace cleanup of 2023...
Inspired by private e-mail comments from mouse@

NFCI.

Revision 1.117 / (download) - annotate - [select for diffs], Sun Oct 30 01:46:16 2022 UTC (16 months, 4 weeks ago) by kre
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1
Branch point for: netbsd-10
Changes since 1.116: +25 -17 lines
Diff to previous 1.116 (colored) to selected 1.60 (colored)

PR bin/57053 is related (peripherally) here.

sh has been remembering the process group of a job for a while now, but
using that for almost nothing.

The old way to resume a job, was to try each pid in the job with a
SIGCONT (using it as the process group identifier via killpg()) until
one worked (or none did, in which case resuming would be impossible,
but that never actually happened).   This wasn't as bad as it seems,
as in practice the first process attempted was *always* the correct
one.  Why the loop was considered necessary I am not sure.  Nothing
but the first could possibly work.

This worked until a fix for an obscure possible bug was added a
while ago - now a process which has already finished, and had its
zombie collected via wait*() is no longer ever considered to have
a pid which is a candidate for use in any system call.  That's
because the kernel might have reassigned that pid for some newly
created process (we have no idea how much time might have passed
since the pid was returned to the kernel for reuse, it might have
happened weeks ago).

This is where the example in bin/57053 revealed a problem.

That PR is really about a quite different problem in zsh (from pksrc)
and should be pkg/57053, but as the test case also hit the problem
here, it was assumed (by some) they were the same issue.

The example is (in a small directory)
	ls | less
which is then suspended (^Z), and resumed (fg).   Since the directory
is small, ls will be finished, and reaped by sh - so the code would
now refuse to use its pid for the killpg() call to send the SIGCONT.
The (useless) loop would attempt to use less's pid for this purpose
(it is still alive at this point) but that would fail, as that pid
is not a process group identifier, of anything.   Hence the job
could not be resumed.

Before the PR (or preceding mailing list discussion) the change here
had already been made (part of a much bigger set of changes, some of
which might follow - sometime).   We now actually use the job's
remembered process group identifier when we want the process group
identifier, instead of trying to guess which pid it happens to be
(which actually never took any guessing, it was, and is always the
pid of the first process created for the job).   A couple of minor
fixes to how the pgrp is obtained, and used, accompany the changes
to use it when appropriate.

Revision 1.116 / (download) - annotate - [select for diffs], Mon Apr 18 06:02:27 2022 UTC (23 months, 1 week ago) by kre
Branch: MAIN
Changes since 1.115: +28 -23 lines
Diff to previous 1.115 (colored) to selected 1.60 (colored)

Introduce a new macro JNUM to replace the idiom jp-jobtab+1
(the job number, given jp a pointer to a jobs table entry)
used open coded previously in many places (mostly in DEBUG mode
trace messages, so not included in most shells, but there are
a few others).

Make the type of JNUM() be int rather than the ptrdiff_t the
open coded version became ... which when used in some printf()
type function arg list was cast to some other arbitrary (but not
consistent) int type for which there is a standard %Xd type
format conversion.   Now we can (and do) just use %d for this.

If the number of jobs ever exceeds the range of an int, we would
have far more serious problems than the broken output this would
cause.

While here improve a comment or two, and use JOBRUNNING instead
of 0 where the intent is the former (JOBRUNNING is #defined as 0).

NFCI.

Revision 1.115 / (download) - annotate - [select for diffs], Sun Dec 19 21:15:27 2021 UTC (2 years, 3 months ago) by andvar
Branch: MAIN
Changes since 1.114: +3 -3 lines
Diff to previous 1.114 (colored) to selected 1.60 (colored)

s/forground/foreground/ in comments.

Revision 1.114 / (download) - annotate - [select for diffs], Sun Oct 10 18:46:25 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.113: +11 -13 lines
Diff to previous 1.113 (colored) to selected 1.60 (colored)

sh: remove useless do-while-0 loop

28 years was more than enough for the useless 'continue' statement in
this do-while-0 "loop". Without the 'continue' statement, there is no
need for the "loop" anymore. The comment at its top was confusing since
the word 'while' suggested a loop, but there was none, so remove that as
well.

Pointed out by Tom Ivar Helbekkmo on source-changes-d.

No change to the resulting binary.

Revision 1.113 / (download) - annotate - [select for diffs], Sun Oct 10 08:35:34 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.112: +3 -5 lines
Diff to previous 1.112 (colored) to selected 1.60 (colored)

sh: remove no-op 'continue' from do-while-0 loop

With Clang, the only change to the binary are the line number changes
from __LINE__, GCC generates a bit different code.

No functional change.

Revision 1.112 / (download) - annotate - [select for diffs], Sun Sep 12 01:30:41 2021 UTC (2 years, 6 months ago) by kre
Branch: MAIN
Changes since 1.111: +6 -3 lines
Diff to previous 1.111 (colored) to selected 1.60 (colored)


Don't dereference NULL on "jobs -Z" (with no title given), instead
do setproctitle(NULL) (which is not the same thing at all).  Do the
same with jobs -Z '' as setting the title to "sh: " isn't useful.

Improve the way this is documented, and note that it is only done
this way because zsh did it first (ie: pass on the balme, doing this
in the jobs command is simply absurd.)

Revision 1.111 / (download) - annotate - [select for diffs], Sat Sep 11 20:43:32 2021 UTC (2 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.110: +17 -5 lines
Diff to previous 1.110 (colored) to selected 1.60 (colored)

Add jobs -Z (like in zsh(1)) to setproctitle(3).

Revision 1.106.2.2 / (download) - annotate - [select for diffs], Wed Apr 28 09:58:42 2021 UTC (2 years, 11 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-3-RELEASE, netbsd-9-2-RELEASE
Changes since 1.106.2.1: +31 -3 lines
Diff to previous 1.106.2.1 (colored) to branchpoint 1.106 (colored) next main 1.107 (colored) to selected 1.60 (colored)

Pull up following revision(s) (requested by kre in ticket #1259):

	bin/sh/jobs.h: revision 1.24
	bin/sh/eval.c: revision 1.182
	bin/sh/jobs.c: revision 1.110

Related to PR bin/48875

Correct an issue found by Oguz <oguzismailuysal@gmail.com> and reported
in e-mail (on the bug-bash list initially!) with the code changed to deal
with PR bin/48875

With:
	 sh -c 'echo start at $SECONDS;
			(sleep 3 & (sleep 1& wait) );
		echo end at $SECONDS'

The shell should say "start at 0\nend at 1\n", but instead (before
this fix, in -9 and HEAD, but not -8) does "start at 0\nend at 3\n"
(Not in -8 as the 48875 changes were never pulled up)>

There was an old problem, fixed years ago, which cause the same symptom,
related to the way the jobs table was cleared (or not) in subshells, and
it seemed like that might have resurfaced.

But not so, the issue here is the sub-shell elimination, which was part
of the 48875 "fix" (not really, it wasn't really a bug, just sub-optimal
and unexpected behaviour).

What the shell actually has been running in this case is:

	 sh -c 'echo start at $SECONDS;
			(sleep 3 & sleep 1& wait );
		echo end at $SECONDS'

as the inner subshell was deemed unnecessary - all its parent would
do is wait for its exit status, and then exit with that status - we
may as well simply replace the current sub-shell with the new one,
let it do its thing, and we're done...

But not here, the running "sleep 3" will remain a child of that merged
sub-shell, and the "wait" will thus wait for it, along with the sleep 1
which is all it should be seeing.

For now, fix this by not eliminating a sub-shell if there are existing
unwaited upon children in the current one.  It might be possible to
simply disregard the old child for the purposes of wait (and "jobs", etc,
all cmds which look at the jobs table) but the bookkeeping required to
make that work reliably is likely to take some time to get correct...

Along with this fix comes a fix to DEBUG mode shells, which, in situations
like this, could dump core in the debug code if the relevant tracing was
enabled, and add a new trace for when the jobs table is cleared (which was
added predating the discovery of the actual cause of this issue, but seems
worth keeping.)   Neither of these changes have any effect on shells
compiled normally.

XXX pullup -9

Revision 1.110 / (download) - annotate - [select for diffs], Sun Apr 4 13:24:07 2021 UTC (2 years, 11 months ago) by kre
Branch: MAIN
CVS Tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.109: +31 -3 lines
Diff to previous 1.109 (colored) to selected 1.60 (colored)

Related to PR bin/48875

Correct an issue found by Oguz <oguzismailuysal@gmail.com> and reported
in e-mail (on the bug-bash list initially!) with the code changed to deal
with PR bin/48875

With:

	 sh -c 'echo start at $SECONDS;
			(sleep 3 & (sleep 1& wait) );
		echo end at $SECONDS'

The shell should say "start at 0\nend at 1\n", but instead (before
this fix, in -9 and HEAD, but not -8) does "start at 0\nend at 3\n"
(Not in -8 as the 48875 changes were never pulled up)>

There was an old problem, fixed years ago, which cause the same symptom,
related to the way the jobs table was cleared (or not) in subshells, and
it seemed like that might have resurfaced.

But not so, the issue here is the sub-shell elimination, which was part
of the 48875 "fix" (not really, it wasn't really a bug, just sub-optimal
and unexpected behaviour).

What the shell actually has been running in this case is:

	 sh -c 'echo start at $SECONDS;
			(sleep 3 & sleep 1& wait );
		echo end at $SECONDS'

as the inner subshell was deemed unnecessary - all its parent would
do is wait for its exit status, and then exit with that status - we
may as well simply replace the current sub-shell with the new one,
let it do its thing, and we're done...

But not here, the running "sleep 3" will remain a child of that merged
sub-shell, and the "wait" will thus wait for it, along with the sleep 1
which is all it should be seeing.

For now, fix this by not eliminating a sub-shell if there are existing
unwaited upon children in the current one.  It might be possible to
simply disregard the old child for the purposes of wait (and "jobs", etc,
all cmds which look at the jobs table) but the bookkeeping required to
make that work reliably is likely to take some time to get correct...

Along with this fix comes a fix to DEBUG mode shells, which, in situations
like this, could dump core in the debug code if the relevant tracing was
enabled, and add a new trace for when the jobs table is cleared (which was
added predating the discovery of the actual cause of this issue, but seems
worth keeping.)   Neither of these changes have any effect on shells
compiled normally.

XXX pullup -9

Revision 1.109 / (download) - annotate - [select for diffs], Sun Aug 30 19:45:05 2020 UTC (3 years, 6 months ago) by kre
Branch: MAIN
Changes since 1.108: +3 -3 lines
Diff to previous 1.108 (colored) to selected 1.60 (colored)


Since "struct job" gained a pgrp member some time ago now, use it
instead of simply assuming that the pid of the first (leftmost) process
in a pipeline is the pgrp - someday we may switch things around and
create pipelines right to left instead, which has several advantages,
but which would invalidate the assumption which was being made here.

Revision 1.108 / (download) - annotate - [select for diffs], Thu Aug 20 23:03:17 2020 UTC (3 years, 7 months ago) by kre
Branch: MAIN
Changes since 1.107: +140 -20 lines
Diff to previous 1.107 (colored) to selected 1.60 (colored)


Add lots of comments explaining what is happening in here.

Also enhance some of the DEBUG mode trace output (nothing visible
in a normal shell build).

A couple of very minor code changes that no-one should ever notice
(eg: one less wait() call in the case that there is nothing pending).

Revision 1.98.4.4 / (download) - annotate - [select for diffs], Tue Apr 21 19:37:34 2020 UTC (3 years, 11 months ago) by martin
Branch: phil-wifi
Changes since 1.98.4.3: +2 -2 lines
Diff to previous 1.98.4.3 (colored) to branchpoint 1.98 (colored) next main 1.99 (colored) to selected 1.60 (colored)

Ooops, restore accidently removed files from merge mishap

Revision 1.98.4.3, Tue Apr 21 18:41:06 2020 UTC (3 years, 11 months ago) by martin
Branch: phil-wifi
Changes since 1.98.4.2: +2 -2 lines
FILE REMOVED

Sync with HEAD

Revision 1.98.4.2 / (download) - annotate - [select for diffs], Wed Apr 8 14:03:04 2020 UTC (3 years, 11 months ago) by martin
Branch: phil-wifi
Changes since 1.98.4.1: +5 -2 lines
Diff to previous 1.98.4.1 (colored) to branchpoint 1.98 (colored) to selected 1.60 (colored)

Merge changes from current as of 20200406

Revision 1.106.2.1 / (download) - annotate - [select for diffs], Mon Feb 10 18:54:14 2020 UTC (4 years, 1 month ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-1-RELEASE, netbsd-9-0-RELEASE
Changes since 1.106: +5 -2 lines
Diff to previous 1.106 (colored) to selected 1.60 (colored)

Pull up following revision(s) (requested by kre in ticket #684):

	bin/sh/jobs.c: revision 1.107
	bin/sh/main.c: revision 1.83
	bin/sh/main.c: revision 1.84
	bin/sh/main.c: revision 1.85

If we are invoked with SIGCHLD ignored, we fail badly, as we assume
that we can always wait(2) for our children, and an ignored SIGCHLD
prevents that.   Recent versions of bash can be convinced (due to a
bug most likely) to invoke us that way.   Always return SIGCHLD to
SIG_DFL during init - we already prevent scripts from fiddling it.

All ash derived shells apparently have this problem (observed by
Martijn Dekker, and notified on the bash-bug list).  Actual issue
diagnosed by Harald van Dijk (same list).

Actually, the issue with bash (in previous) is more likely that the
SIGCHLD is blocked rather than ignored.   We want neither.   Make sure
SIGCHLD is unblocked as well as SIG_DFL.

XXX pullup -9

bin/sh: Fixes -Werror=shadow causing build breaks.
Conflicting variable name, sigset_t sigs has been renamed to sigset_t mask

Reviewed by: kamil@

Avoid a core dump if a child process that is not one of our
children happens to exit while we are waiting for another child
to exit.

This can happen with code like
	sh -c '
		sleep 5 &
		exec sh -c "sleep 10 & wait !$"
	      '

when the inner "sh" is waiting for the 10 second sleep to be
done, the 5 second sleep started earlier terminates.   It is
a child of our process, as the inner shell is the same process
as the outer one, but not a known child (the inner shell has no
idea what the outer one did before it started).

This was observed in the wild by Martijn Dekker (where the outer
shell was bash but that's irrelevant).

XXX pullup -9

Revision 1.107 / (download) - annotate - [select for diffs], Fri Feb 7 02:06:12 2020 UTC (4 years, 1 month ago) by kre
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, is-mlppp-base, is-mlppp
Changes since 1.106: +5 -2 lines
Diff to previous 1.106 (colored) to selected 1.60 (colored)

Avoid a core dump if a child process that is not one of our
children happens to exit while we are waiting for another child
to exit.

This can happen with code like

	sh -c '
		sleep 5 &
		exec sh -c "sleep 10 & wait !$"
	      '

when the inner "sh" is waiting for the 10 second sleep to be
done, the 5 second sleep started earlier terminates.   It is
a child of our process, as the inner shell is the same process
as the outer one, but not a known child (the inner shell has no
idea what the outer one did before it started).

This was observed in the wild by Martijn Dekker (where the outer
shell was bash but that's irrelevant).

XXX pullup -9

Revision 1.98.4.1 / (download) - annotate - [select for diffs], Mon Jun 10 21:41:03 2019 UTC (4 years, 9 months ago) by christos
Branch: phil-wifi
Changes since 1.98: +47 -31 lines
Diff to previous 1.98 (colored) to selected 1.60 (colored)

Sync with HEAD

Revision 1.106 / (download) - annotate - [select for diffs], Tue Mar 26 13:32:26 2019 UTC (5 years ago) by kre
Branch: MAIN
CVS Tags: phil-wifi-20191119, phil-wifi-20190609, netbsd-9-base, netbsd-9-0-RC2, netbsd-9-0-RC1
Branch point for: netbsd-9
Changes since 1.105: +18 -8 lines
Diff to previous 1.105 (colored) to selected 1.60 (colored)

Fix a logic botch that prevented "wait -n" (with no pid args) from
finding a job that had previously terminated.

Now in that case JOBWANTED is set on all jobs (since any will do)
which then simplifies a later test which no longer needs to special
case "wait -n".   Further, we always look to see if any wanted
job has already terminated, even if there are still running jobs
we can wait upon - if anything is already ready, that's where we start
harvesting (and finish, if -n is specified).

Revision 1.105 / (download) - annotate - [select for diffs], Sat Feb 9 09:31:33 2019 UTC (5 years, 1 month ago) by kre
Branch: MAIN
Changes since 1.104: +13 -8 lines
Diff to previous 1.104 (colored) to selected 1.60 (colored)


In the unlikely event that restarting a job fails (the fg bg and various
%x commands) generate the most useful error message (from errno value)
rather than whichever happened last.

In posix mode, cause the "jobs" command to delete records of completed
jobs it reports on (as posix requires) as is done in interactive shells.
We don't (won't) do this in !posix mode, as the ability to throw in a
"jobs" command in a script to debug what is happening is too useful to
lose -- and any script that is relying on "jobs" instead of "wait" to
cleanup background processes (from the sh jobs table, sh always collects
zombies from the kernel) is absurd and not worth considering (besides
which I've never seen one).

Revision 1.104 / (download) - annotate - [select for diffs], Sat Feb 9 03:35:55 2019 UTC (5 years, 1 month ago) by kre
Branch: MAIN
Changes since 1.103: +3 -4 lines
Diff to previous 1.103 (colored) to selected 1.60 (colored)


INTON / INTOFF audit and cleanup.

No visible differences expected - there is a remote chance that
some internal lossage may no longer occur in interactive shells
that receive SIGINT (untrapped) at inopportune times, but you would
have had to have been very unlucky to have ever suffered from that.

Revision 1.98.2.4 / (download) - annotate - [select for diffs], Wed Dec 26 14:01:03 2018 UTC (5 years, 3 months ago) by pgoyette
Branch: pgoyette-compat
CVS Tags: pgoyette-compat-merge-20190127
Changes since 1.98.2.3: +6 -3 lines
Diff to previous 1.98.2.3 (colored) to branchpoint 1.98 (colored) next main 1.99 (colored) to selected 1.60 (colored)

Sync with HEAD, resolve a few conflicts

Revision 1.103 / (download) - annotate - [select for diffs], Mon Dec 3 02:38:30 2018 UTC (5 years, 3 months ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226
Changes since 1.102: +6 -3 lines
Diff to previous 1.102 (colored) to selected 1.60 (colored)

When forking a child shell, arrange for errors/exit to always unwind
to the main handler, rather than wherever the parent shell would go.

nb: not needed for vfork(), after vfork() we never go that path - which
is good or we'd be corrupting the parent's handler.

This allows the child to always exit (when it should) rather than being
caught up doing something else (and while it would eventually exit, the
status would be incorrect in some cases).

One test is:
	sh -c 'trap "(! :) && echo BUG || echo nobug" EXIT'
from Martijn Dekker

Fix from FreeBSD (missed earlier).

XXX - 2b part of the 48875 pullup to -8

Revision 1.98.2.3 / (download) - annotate - [select for diffs], Mon Nov 26 01:49:54 2018 UTC (5 years, 4 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.98.2.2: +3 -7 lines
Diff to previous 1.98.2.2 (colored) to branchpoint 1.98 (colored) to selected 1.60 (colored)

Sync with HEAD, resolve a couple of conflicts

Revision 1.102 / (download) - annotate - [select for diffs], Sun Oct 28 18:16:01 2018 UTC (5 years, 5 months ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-1126
Changes since 1.101: +3 -7 lines
Diff to previous 1.101 (colored) to selected 1.60 (colored)


Use strsignal() rather than direct reference to sys_siglist[]
(apart from being cleaner, it also simplifies the code, as
strsignal() never fails ... it also removes one reference to NSIG).

Revision 1.85.2.3 / (download) - annotate - [select for diffs], Tue Oct 9 09:51:57 2018 UTC (5 years, 5 months ago) by martin
Branch: netbsd-8
CVS Tags: netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1
Changes since 1.85.2.2: +4 -5 lines
Diff to previous 1.85.2.2 (colored) to branchpoint 1.85 (colored) next main 1.86 (colored) to selected 1.60 (colored)

Pull up following revision(s) (requested by kre in ticket #1050):

	bin/sh/jobs.c: revision 1.101

A change in rev 1.91 interacted badly with the way that showjobs()
worked, preventing $(jobs) (and more usefully $(jobs -p) from
working.   Fix that.

XXX pullup -8

Revision 1.98.2.2 / (download) - annotate - [select for diffs], Sun Sep 30 01:44:21 2018 UTC (5 years, 5 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.98.2.1: +4 -5 lines
Diff to previous 1.98.2.1 (colored) to branchpoint 1.98 (colored) to selected 1.60 (colored)

Ssync with HEAD

Revision 1.101 / (download) - annotate - [select for diffs], Thu Sep 13 22:12:35 2018 UTC (5 years, 6 months ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-1020, pgoyette-compat-0930
Changes since 1.100: +4 -5 lines
Diff to previous 1.100 (colored) to selected 1.60 (colored)


A change in rev 1.91 interacted badly with the way that showjobs()
worked, preventing $(jobs) (and more usefully $(jobs -p) from
working.   Fix that.

XXX pullup -8

Revision 1.98.2.1 / (download) - annotate - [select for diffs], Thu Sep 6 06:51:32 2018 UTC (5 years, 6 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.98: +12 -8 lines
Diff to previous 1.98 (colored) to selected 1.60 (colored)

Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)

Revision 1.100 / (download) - annotate - [select for diffs], Tue Sep 4 23:16:30 2018 UTC (5 years, 6 months ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-0906
Changes since 1.99: +6 -6 lines
Diff to previous 1.99 (colored) to selected 1.60 (colored)

Change the way the pipefail option works.   Now it is the setting of
the option when a pipeline is created that controls the way the exit
status of the pipeline is calculated.  Previously it was the state of
the option when the exit status of the pipeline was collected.

This makes no difference at all for foreground pipelines (there is
no way to change the option between starting and completing the
pipeline) but it does for asynchronous (background) pipelines.

This was always the right way to implement it - it was originally
done the other way as I could not find any other shell implemented
this way - they all seemed to do it our previous way, and I could
not see a good reason to be the sole different shell.

However, now I know that ksh93 works as we will now work, and I
am told that if the option is added to the FreeBSD shell (apparently
the code exists, uncommitted) it will be the same.

Revision 1.99 / (download) - annotate - [select for diffs], Tue Sep 4 01:09:28 2018 UTC (5 years, 6 months ago) by kre
Branch: MAIN
Changes since 1.98: +8 -4 lines
Diff to previous 1.98 (colored) to selected 1.60 (colored)


PR bin/38004

Save more characters of command in non-interactive jobs, in case of
core dumps and similar (16 effective chars was a few too little).

Arrange for number to increase if command buffer size increases.

Revision 1.98 / (download) - annotate - [select for diffs], Sat Dec 30 23:24:19 2017 UTC (6 years, 2 months ago) by kre
Branch: MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-base, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315
Branch point for: phil-wifi, pgoyette-compat
Changes since 1.97: +7 -5 lines
Diff to previous 1.97 (colored) to selected 1.60 (colored)

In addition to previous the which fixed a (harmless) MSAN detected ref
of uninit'd field also fix a couple more (still harmless) related
technical C usage bugs.

Explaining why these issues were harmless would take too long to include here.

Revision 1.97 / (download) - annotate - [select for diffs], Sat Dec 30 20:42:28 2017 UTC (6 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.96: +6 -4 lines
Diff to previous 1.96 (colored) to selected 1.60 (colored)

initialize just used and prev_job

Revision 1.96 / (download) - annotate - [select for diffs], Sat Dec 30 01:21:25 2017 UTC (6 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.95: +3 -3 lines
Diff to previous 1.95 (colored) to selected 1.60 (colored)

initialize the jobtab; it is easier than putting checks for used everywhere.

Revision 1.85.2.2 / (download) - annotate - [select for diffs], Fri Nov 17 14:56:52 2017 UTC (6 years, 4 months ago) by martin
Branch: netbsd-8
CVS Tags: netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1
Changes since 1.85.2.1: +54 -20 lines
Diff to previous 1.85.2.1 (colored) to branchpoint 1.85 (colored) to selected 1.60 (colored)

Pull up following revision(s) (requested by kre in ticket #337):
	bin/sh/jobs.c: revision 1.91 (patch)


PR bin/52640  PR bin/52641

Don't delete jobs from the jobs table merely because they finished,
if they are not the job we are waiting upon.   (bin/52640 part 1)

In a sub-shell environment, don't allow wait to find jobs from the
parent shell that had already exited (before the sub-shell was
created) and return status for them as if they are our children.
(bin/52640 part 2)

Don't have the "jobs" command also be an implicit "wait" command
in non-interactive shells.  (bin/52641)

Use WCONTINUED (when it exists) so we can report on stopped jobs that
"mysteriously" move back to running state without the user issuing
a "bg" command (eg: kill -CONT <pid>)   Previously they would keep
being reported as stopped until they exited.
When a job is detected as having changed status just as we're
issuing a "jobs" command (i.e.: the change occurred between the last
prompt and the jobs command being entered) don't report it twice,
once from the status change, and then again in the jobs command
output.   Once is enough (keep the jobs output, suppress the other).

Apply some sanity to the way jobs_invalid is processed - ignore it
in getjob() instead of just ignoring it most of the time there, and
instead always check it before calling getjob() in situations where
we can handle only children of the current shell.  This allows the
(totally broken) save/clear/restore of jobs_invalid in jobscmd() to
be done away with (previously an error while in the clear state would
have left jobs_invalid incorrectly cleared - shouldn't have mattered
since jobs_invalid => subshell => error causes exit, but better to be safe).

Add/improve the DEBUG more tracing.

Revision 1.95 / (download) - annotate - [select for diffs], Sat Oct 28 06:36:17 2017 UTC (6 years, 5 months ago) by kre
Branch: MAIN
Changes since 1.94: +212 -50 lines
Diff to previous 1.94 (colored) to selected 1.60 (colored)

Add '-n' and '-p var' args to the wait command (-n: wait for any,
-p var: set var to identifier, from arg list, or PID if no job args)
of the job for which status is returned (becomes $? after wait.)

Note: var is unset if the status returned from wait came from wait
itself rather than from some job exiting (so it is now possible to
tell whether 127 means "no such job" or "job did exit(127)", and
whether $? > 128 means "wait was interrupted" or "job was killed
by a signal or did exit(>128)".   ($? is too limited to to allow
indicating whether the job died with a signal, or exited with a
status such that it looks like it did...)

Revision 1.94 / (download) - annotate - [select for diffs], Sat Oct 28 04:50:38 2017 UTC (6 years, 5 months ago) by kre
Branch: MAIN
Changes since 1.93: +3 -3 lines
Diff to previous 1.93 (colored) to selected 1.60 (colored)


Another %zu for size_t (this one in a DEBUG mode trace call, so it
doesn't actually ever bother anyone in practice.)

Revision 1.93 / (download) - annotate - [select for diffs], Wed Oct 25 08:50:05 2017 UTC (6 years, 5 months ago) by martin
Branch: MAIN
Changes since 1.92: +3 -3 lines
Diff to previous 1.92 (colored) to selected 1.60 (colored)

Use %zu for size_t

Revision 1.92 / (download) - annotate - [select for diffs], Wed Oct 25 05:42:56 2017 UTC (6 years, 5 months ago) by kre
Branch: MAIN
Changes since 1.91: +43 -3 lines
Diff to previous 1.91 (colored) to selected 1.60 (colored)

Add options to the builtin jobid command to allow discovering the
process group (-g), the process leader pid (-p) ($! if the job was &'d)
and the job identifier (-j) (the %n that refers to the job) in addition to
(default) the list of all pids in the job (which it has always done).
No change to the (single) "job" arg, which is a specifier of the job:
the process leader pid, or one of the % forms, and defaults to %% (aka %+).
(This is all now documented in sh(1))

Also document the jobs command properly (no change to the command, just
document what it actually is.)

And while here, a whole new section in sh(1) "Job Control".  It probably
needs better wording, but this is (perhaps) better than the nothing that
was there before.

Revision 1.91 / (download) - annotate - [select for diffs], Mon Oct 23 10:52:07 2017 UTC (6 years, 5 months ago) by kre
Branch: MAIN
Changes since 1.90: +54 -20 lines
Diff to previous 1.90 (colored) to selected 1.60 (colored)

PR bin/52640  PR bin/52641

Don't delete jobs from the jobs table merely because they finished,
if they are not the job we are waiting upon.   (bin/52640 part 1)

In a sub-shell environment, don't allow wait to find jobs from the
parent shell that had already exited (before the sub-shell was
created) and return status for them as if they are our children.
(bin/52640 part 2)

Don't have the "jobs" command also be an implicit "wait" command
in non-interactive shells.  (bin/52641)

Use WCONTINUED (when it exists) so we can report on stopped jobs that
"mysteriously" move back to running state without the user issuing
a "bg" command (eg: kill -CONT <pid>)   Previously they would keep
being reported as stopped until they exited.

When a job is detected as having changed status just as we're
issuing a "jobs" command (i.e.: the change occurred between the last
prompt and the jobs command being entered) don't report it twice,
once from the status change, and then again in the jobs command
output.   Once is enough (keep the jobs output, suppress the other).

Apply some sanity to the way jobs_invalid is processed - ignore it
in getjob() instead of just ignoring it most of the time there, and
instead always check it before calling getjob() in situations where
we can handle only children of the current shell.  This allows the
(totally broken) save/clear/restore of jobs_invalid in jobscmd() to
be done away with (previously an error while in the clear state would
have left jobs_invalid incorrectly cleared - shouldn't have mattered
since jobs_invalid => subshell => error causes exit, but better to be safe).

Add/improve the DEBUG more tracing.

XXX pullup -8

Revision 1.90 / (download) - annotate - [select for diffs], Thu Oct 19 01:57:18 2017 UTC (6 years, 5 months ago) by kre
Branch: MAIN
Changes since 1.89: +42 -31 lines
Diff to previous 1.89 (colored) to selected 1.60 (colored)

Re-factor the code that extracts status from exited jobs, avoiding
code duplication, and reducing the size of /bin/sh by a trivial amount.

NFCI.

This is being done now as there are two other changes forthcoming, both
of which benefit - one would result in even more code duplication without
this, the other might need to alter how this is done, and doing it after this
means there's just one place to change (if required).

Revision 1.89 / (download) - annotate - [select for diffs], Fri Sep 29 17:53:57 2017 UTC (6 years, 6 months ago) by kre
Branch: MAIN
Changes since 1.88: +4 -4 lines
Diff to previous 1.88 (colored) to selected 1.60 (colored)


DEBUG only changes (non-debug, ie: normal, shell unaffected)
Add a little extra info in a few of the trace messages.

Revision 1.88 / (download) - annotate - [select for diffs], Mon Jul 24 14:17:11 2017 UTC (6 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.87: +20 -4 lines
Diff to previous 1.87 (colored) to selected 1.60 (colored)

Implement the "pipefail" option (same semantics as in other shells)
to cause (when set, which it is not by default) the exit status of a
pipe to be 0 iff all commands in the pipe exited with status 0, and
otherwise, the status of the rightmost command to exit with a non-0
status.

In the doc, while describing this, also reword some of the text about
commands in general, how they are structured, and when they are executed.

Revision 1.85.2.1 / (download) - annotate - [select for diffs], Sun Jul 23 14:58:14 2017 UTC (6 years, 8 months ago) by snj
Branch: netbsd-8
CVS Tags: matt-nb8-mediatek-base, matt-nb8-mediatek
Changes since 1.85: +49 -31 lines
Diff to previous 1.85 (colored) to selected 1.60 (colored)

Pull up following revision(s) (requested by kre in ticket #103):
	bin/kill/kill.c: 1.28
	bin/sh/Makefile: 1.111-1.113
	bin/sh/arith_token.c: 1.5
	bin/sh/arith_tokens.h: 1.2
	bin/sh/arithmetic.c: 1.3
	bin/sh/arithmetic.h: 1.2
	bin/sh/bltin/bltin.h: 1.15
	bin/sh/cd.c: 1.49-1.50
	bin/sh/error.c: 1.40
	bin/sh/eval.c: 1.142-1.151
	bin/sh/exec.c: 1.49-1.51
	bin/sh/exec.h: 1.26
	bin/sh/expand.c: 1.113-1.119
	bin/sh/expand.h: 1.23
	bin/sh/histedit.c: 1.49-1.52
	bin/sh/input.c: 1.57-1.60
	bin/sh/input.h: 1.19-1.20
	bin/sh/jobs.c: 1.86-1.87
	bin/sh/main.c: 1.71-1.72
	bin/sh/memalloc.c: 1.30
	bin/sh/memalloc.h: 1.17
	bin/sh/mknodenames.sh: 1.4
	bin/sh/mkoptions.sh: 1.3-1.4
	bin/sh/myhistedit.h: 1.12-1.13
	bin/sh/nodetypes: 1.16-1.18
	bin/sh/option.list: 1.3-1.5
	bin/sh/parser.c: 1.133-1.141
	bin/sh/parser.h: 1.22-1.23
	bin/sh/redir.c: 1.58
	bin/sh/redir.h: 1.24
	bin/sh/sh.1: 1.149-1.159
	bin/sh/shell.h: 1.24
	bin/sh/show.c: 1.43-1.47
	bin/sh/show.h: 1.11
	bin/sh/syntax.c: 1.4
	bin/sh/syntax.h: 1.8
	bin/sh/trap.c: 1.41
	bin/sh/var.c: 1.56-1.65
	bin/sh/var.h: 1.29-1.35
An initial attempt at implementing LINENO to meet the specs.
Aside from one problem (not too hard to fix if it was ever needed) this version
does about as well as most other shell implementations when expanding
$((LINENO)) and better for ${LINENO} as it retains the "LINENO hack" for the
latter, and that is very accurate.
Unfortunately that means that ${LINENO} and $((LINENO)) do not always produce
the same value when used on the same line (a defect that other shells do not
share - aside from the FreeBSD sh as it is today, where only the LINENO hack
exists and so (like for us before this commit) $((LINENO)) is always either
0, or at least whatever value was last set, perhaps by
	LINENO=${LINENO}
which does actually work ... for that one line...)
This could be corrected by simply removing the LINENO hack (look for the string
LINENO in parser.c) in which case ${LINENO} and $((LINENO)) would give the
same (not perfectly accurate) values, as do most other shells.
POSIX requires that LINENO be set before each command, and this implementation
does that fairly literally - except that we only bother before the commands
which actually expand words (for, case and simple commands).   Unfortunately
this forgot that expansions also occur in redirects, and the other compound
commands can also have redirects, so if a redirect on one of the other compound
commands wants to use the value of $((LINENO)) as a part of a generated file
name, then it will get an incorrect value.  This is the "one problem" above.
(Because the LINENO hack is still enabled, using ${LINENO} works.)
This could be fixed, but as this version of the LINENO implementation is just
for reference purposes (it will be superseded within minutes by a better one)
I won't bother.  However should anyone else decide that this is a better choice
(it is probably a smaller implementation, in terms of code & data space then
the replacement, but also I would expect, slower, and definitely less accurate)
this defect is something to bear in mind, and fix.
This version retains the *BSD historical practice that line numbers in functions
(all functions) count from 1 from the start of the function, and elsewhere,
start from 1 from where the shell started reading the input file/stream in
question.  In an "eval" expression the line number starts at the line of the
"eval" (and then increases if the input is a multi-line string).
Note: this version is not documented (beyond as much as LINENO was before)
hence this slightly longer than usual commit message.
A better LINENO implementation.   This version deletes (well, #if 0's out)
the LINENO hack, and uses the LINENO var for both ${LINENO} and $((LINENO)).
(Code to invert the LINENO hack when required, like when de-compiling the
execution tree to provide the "jobs" command strings, is still included,
that can be deleted when the LINENO hack is completely removed - look for
refs to VSLINENO throughout the code.  The var funclinno in parser.c can
also be removed, it is used only for the LINENO hack.)
This version produces accurate results: $((LINENO)) was made as accurate
as the LINENO hack made ${LINENO} which is very good.  That's why the
LINENO hack is not yet completely removed, so it can be easily re-enabled.
If you can tell the difference when it is in use, or not in use, then
something has broken (or I managed to miss a case somewhere.)
The way that LINENO works is documented in its own (new) section in the
man page, so nothing more about that, or the new options, etc, here.
This version introduces the possibility of having a "reference" function
associated with a variable, which gets called whenever the value of the
variable is required (that's what implements LINENO).  There is just
one function pointer however, so any particular variable gets at most
one of the set function (as used for PATH, etc) or the reference function.
The VFUNCREF bit in the var flags indicates which func the variable in
question uses (if any - the func ptr, as before, can be NULL).
I would not call the results of this perfect yet, but it is close.
Unbreak (at least) i386 build .... I have no idea why this built for me on
amd64 (problem was missing prototype for snprintf witout <stdio.h>)
While here, add some (DEBUG mode only) tracing that proved useful in
solving another problem.
Set the line number before expanding args, not after.   As the line_number
would have usually been set earlier, this change is mostly an effective
no-op, but it is better this way (just in case) - not observed to have
caused any problems.
Undo some over agressive fixes for a (pre-commit) bug that did not
need these changes to be fixed - and these cause problems in another
absurd use case.   Either of these issues is unlikely to be seen by
anyone who isn't an idiot masochist...
PR bin/52280
removescapes_nl in expari() even when not quoted,
CRTNONL's appear regardless of quoting (unlike CTLESC).
New sentence, new line. Whitespace.
Improve the (new) LINENO section, markup changes (with thanks to wiz@ for
assistace) and some better wording in a few placed.
I am an idiot...  revert the previous unintended commit.
Remove some left over baggage from the LINENO v1 implementation that
didn't get removed with v2, and should have.   This would have had
(I think, without having tested it) one very minor effect on the way
LINENO worked in the v2 implementation, but my guess is it would have
taken a long time before anyone noticed...
Correct spelling in comments of DEBUG only code...
(Perhaps) temporary fix to pkgtools (cwrappers) build (configure).
Expanding  `` containing \ \n sequences looks to have been giving
problems.   I don't think this is the correct fix, but it will do
no worse harm than (perhaps) incorrectly calculating LINENO in this
kind of (rare) circumstance.   I'll look and see if there should be
a better fix later.
s/volatile/const/ -- wonderful how opposites attract like this.
NFC (normal use) - DEBUG only change, when showing empty arg list don't
omit terminating \n.
Free stack memory in a couple of obscure cases where it wasn't
being done (one in probably dead code that is never compiled, the other
in a very rare error case.)   Since it is stack memory it wasn't lost
in any case, just held longer than needed.
Many internal memory management type fixes.
PR bin/52302   (core dump with interactive shell, here doc and error
on same line) is fixed.   (An old bug.)
echo "$( echo x; for a in $( seq 1000 ); do printf '%s\n'; done; echo y )"
consistently prints 1002 lines (x, 1000 empty ones, then y) as it should
(And you don't want to know what it did before, or why.) (Another old one.)
(Recently added) Problems with ~ expansion fixed (mem management related).
Proper fix for the cwrappers configure problem (which includes the quick
fix that was done earlier, but extends upon that to be correct). (This was
another newly added problem.)
And the really devious (and rare) old bug - if STACKSTRNUL() needs to
allocate a new buffer in which to store the \0, calculate the size of
the string space remaining correctly, unlike when SPUTC() grows the
buffer, there is no actual data being stored in the STACKSTRNUL()
case - the string space remaining was calculated as one byte too few.
That would be harmless, unless the next buffer also filled, in which
case it was assumed that it was really full, not one byte less, meaning
one junk char (a nul, or anything) was being copied into the next (even
bigger buffer) corrupting the data.
Consistent use of stalloc() to allocate a new block of (stack) memory,
and grabstackstr() to claim a block of (stack) memory that had already
been occupied but not claimed as in use.  Since grabstackstr is implemented
as just a call to stalloc() this is a no-op change in practice, but makes
it much easier to comprehend what is really happening.  Previous code
sometimes used stalloc() when the use case was really for grabstackstr().
Change grabstackstr() to actually use the arg passed to it, instead of
(not much better than) guessing how much space to claim,
More care when using unstalloc()/ungrabstackstr() to return space, and in
particular when the stack must be returned to its previous state, rather than
just returning no-longer needed space, neither of those work.  They also don't
work properly if there have been (really, even might have been) any stack mem
allocations since the last stalloc()/grabstackstr().   (If we know there
cannot have been then the alloc/release sequence is kind of pointless.)
To work correctly in general we must use setstackmark()/popstackmark() so
do that when needed.  Have those also save/restore the top of stack string
space remaining.
	[Aside: for those reading this, the "stack" mentioned is not
	in any way related to the thing used for maintaining the C
	function call state, ie: the "stack segment" of the program,
	but the shell's internal memory management strategy.]
More comments to better explain what is happening in some cases.
Also cleaned up some hopelessly broken DEBUG mode data that were
recently added (no effect on anyone but the poor semi-human attempting
to make sense of it...).
User visible changes:
Proper counting of line numbers when a here document is delimited
by a multi-line end-delimiter, as in
	cat << 'REALLY
	END'
	here doc line 1
	here doc line 2
	REALLY
	END
(which is an obscure case, but nothing says should not work.)  The \n
in the end-delimiter of the here doc (the last one) was not incrementing
the line number, which from that point on in the script would be 1 too
low (or more, for end-delimiters with more than one \n in them.)
With tilde expansion:
	unset HOME; echo ~
changed to return getpwuid(getuid())->pw_home instead of failing (returning ~)
POSIX says this is unspecified, which makes it difficult for a script to
compensate for being run without HOME set (as in env -i sh script), so
while not able to be used portably, this seems like a useful extension
(and is implemented the same way by some other shells).
Further, with
	HOME=; printf %s ~
we now write nothing (which is required by POSIX - which requires ~ to
expand to the value of $HOME if it is set) previously if $HOME (in this
case) or a user's directory in the passwd file (for ~user) were a null
STRING, We failed the ~ expansion and left behind '~' or '~user'.
Changed the long name for the -L option from lineno_fn_relative
to local_lineno as the latter seemed to be marginally more popular,
and perhaps more importantly, is the same length as the peviously
existing quietprofile option, which means the man page indentation
for the list of options can return to (about) what it was before...
(That is, less indented, which means more data/line, which means less
lines of man page - a good thing!)
Cosmetic changes to variable flags - make their values more suited
to my delicate sensibilities...  (NFC).
Arrange not to barf (ever) if some turkey makes _ readonly.  Do this
by adding a VNOERROR flag that causes errors in var setting to be
ignored (intended use is only for internal shell var setting, like of "_").
(nb: invalid var name errors ignore this flag, but those should never
occur on a var set by the shell itself.)
From FreeBSD: don't simply discard memory if a variable is not set for
any reason (including because it is readonly) if the var's value had
been malloc'd.  Free it instead...
NFC - DEBUG changes, update this to new TRACE method.
KNF - white space and comment formatting.
NFC - DEBUG mode only change - convert this to the new TRACE() format.
NFC - DEBUG mode only change - complete a change made earlier (marking
the line number when included in the trace line tag to show whether it
comes from the parser, or the elsewhere as they tend to be quite different).
Initially only one case was changed, while I pondered whether I liked it
or not.  Now it is all done...   Also when there is a line tag at all,
always include the root/sub-shell indicator character, not only when the
pid is included.
NFC: DEBUG related comment change - catch up with reality.
NFC: DEBUG mode only change.  Fix botched cleanup of one TRACE().
"b" more forgiving when sorting options to allow reasonable (and intended)
flexibility in option.list format.   Changes nothing for current option.list.
Now that excessive use of STACKSTRNUL has served its purpose (well, accidental
purpose) in exposing the bug in its implementation, go back to not using
it when not needed for DEBUG TRACE purposes.   This change should have no
practical effect on either a DEBUG shell (where the STACKSTRNUL() calls
remain) or a non DEBUG shell where they are not needed.
Correct the initial line number used for processing -c arg strings.
(It was inheriting the value from end of profile file processing) - I didn't
notice before as I usually test with empty or no profile files to avoid
complications.   Trivial change which should have very limited impact.
Fix from FreeBSD (applied there in July 2008...)
Don't dump core with input like sh -c 'x=; echo >&$x' - that is where
the word after a >& or <& redirect expands to nothing at all.
Another fix from FreeBSD (this one from April 2009).
When processing a string (as in eval, trap, or sh -c) don't allow
trailing \n's to destroy the exit status of the last command executed.
That is:
	sh -c 'false
	'
	echo $?
should produce 1, not 0.
It is amazing what nonsense appears to work sometimes... (all my nonsense too!)
Two bugs here, one benign because of the way the script is used.
The other hidden by NetBSD's sort being stable, and the data not really
requiring sorting at all...
So as it happens these fixes change nothing, but they are needed anyway.
(The contents of the generated file are only used in DEBUG shells, so
this is really even less important than it seems.)
Another ancient (highly improbable) bug bites the dust.   This one
caused by incorrect macro usage (ie: using the wrong one) which has
been in the sources since version 1.1 (ie: forever).
Like the previous (STACKSTRNUL) bug, the probability of this one
actually occurring has been infinitesimal but the LINENO code increases
that to infinitesimal and a smidgen... (or a few, depending upon usage).
Still, apparently that was enough, Kamil Rytarowski discovered that the
zsh configure script (damn competition!) managed to trigger this problem.
source .editrc after we initialize so that commands persist!
Make arg parsing in kill POSIX compatible with POSIX (XBD 2.12) by
parsing the way getopt(3) would, if only it could handle the (required)
-signumber and -signame options.  This adds two "features" to kill,
-ssigname and -lstatus now work (ie: one word with all of the '-', the
option letter, and its value) and "--" also now works (kill -- -pid1 pid2
will not attempt to send the pid1 signal to pid2, but rather SIGTERM
to the pid1 process group and pid2).  It is still the case that (apart
from --) at most 1 option is permitted (-l, -s, -signame, or -signumber.)
Note that we now have an ambiguity, -sname might mean "-s name" or
send the signal "sname" - if one of those turns out to be valid, that
will be accepted, otherwise the error message will indicate that "sname"
is not a valid signal name, not that "name" is not.   Keeping the "-s"
and signal name as separate words avoids this issue.
Also caution: should someone be weird enough to define a new signal
name (as in the part after SIG) which is almost the same name as an
existing name that starts with 'S' by adding an extra 'S' prepended
(eg: adding a SIGSSYS) then the ambiguity problem becomes much worse.
In that case "kill -ssys" will be resolved in favour of the "-s"
flag being used (the more modern syntax) and would send a SIGSYS, rather
that a SIGSSYS.    So don't do that.
While here, switch to using signalname(3) (bye bye NSIG, et. al.), add
some constipation, and show a little pride in formatting the signal names
for "kill -l" (and in the usage when appropriate -- same routine.)   Respect
COLUMNS (POSIX XBD 8.3) as primary specification of the width (terminal width,
not number of columns to print) for kill -l, a very small value for COLUMNS
will cause kill -l output to list signals one per line, a very large
value will cause them all to be listed on one line.) (eg: "COLUMNS=1 kill -l")
TODO: the signal printing for "trap -l" and that for "kill -l"
should be switched to use a common routine (for the sh builtin versions.)
All changes of relevance here are to bin/kill - the (minor) changes to bin/sh
are only to properly expose the builtin version of getenv(3) so the builtin
version of kill can use it (ie: make its prototype available.)
Properly support EDITRC - use it as (naming) the file when setting
up libedit, and re-do the config whenever EDITRC is set.
Get rid of workarounds for ancient groff html backend.
Simplify macro usage.
Make one example more like a real world possibility (it still isn't, but
is closer) - though the actual content is irrelevant to the point being made.
Add literal prompt support this allows one to do:
CA="$(printf '\1')"
PS1="${CA}$(tput bold)${CA}\$${CA}$(tput sgr0)${CA} "
Now libedit supports embedded mode switch sequence, improve sh
support for them (adds PSlit variable to set the magic character).
NFC: DEBUG only change - provide an externally visible (to the DEBUG sh
internals) interface to one of the internal (private to trace code) functions
Include redirections in trace output from "set -x"
Implement PS1, PS2 and PS4 expansions (variable expansions, arithmetic
expansions, and if enabled by the promptcmds option, command substitutions.)
Implement a bunch of new shell environment variables. many mostly useful
in prompts when expanded at prompt time, but all available for general use.
Many of the new ones are not available in SMALL shells (they work as normal
if assigned, but the shell does not set or use them - and there is no magic
in a SMALL shell (usually for install media.))
Omnibus manual update for prompt expansions and new variables.  Throw in
some random cleanups as a bonus.
Correct a markup typo (why did I not see this before the prev commit??)
Sort options (our default is 0..9AaBbZz).
Fix markup problems and a typo.
Make $- list flags in the same order they appear in sh(1)
Do a better job of detecting the error in pkgsrc/devel/libbson-1.6.3's
configure script, ie: $(( which is intended to be a sub-shell in a
command substitution, but is an arith subst instead, it needs to be
written $( ( to do as intended.   Instead of just blindly carrying on to
find the missing )) somewhere, anywhere, give up as soon as we have seen
an unbalanced ')' that isn't immediately followed by another ')' which
in a valid arith subst it always would be.
While here, there has been a comment in the code for quite a while noting a
difference in the standard between the text descr & grammar when it comes to
the syntax of case statements.   Add more comments to explain why parsing it
as we do is in fact definitely the correct way (ie: the grammar wins arguments
like this...).
DEBUG and white space changes only.   Convert TRACE() calls for DEBUg mode
to the new style.   NFC (when not debugging sh).
Mostly DEBUG and white space changes.   Convert DEEBUG TRACE() calls to
the new format.   Also #if 0 a function definition that is used nowhere.
While here, change the function of pushfile() slightly - it now sets
the buf pointer in the top (new) input descriptor to NULL, instead of
simply leaving it - code that needs a buffer always (before and after)
must malloc() one and assign it after the call.  But code which does not
(which will be reading from a string or similar) now does not have to
explicitly set it to NULL (cleaner interface.)   NFC intended (or observed.)
DEBUG changes: convert DEBUG TRACE() calls to new format.
ALso, cause exec failures to always cause the shell to exit with
status 126 or 127, whatever the cause.  127 is intended for lookup
failures (and is used that way), 126 is used for anything else that
goes wrong (as in several other shells.)  We no longer use 2 (more easily
confused with an exit status of the command exec'd) for shell exec failures.
DEBUG only changes.  Convert the TRACE() calls in the remaining files
that still used it to the new format.   NFC.
Fix a reference after free (and consequent nonsense diagnostic for
attempts to set readonly variables) I added in 1.60 by incompletely
copying the FreeBSD fix for the lost memory issue.

Revision 1.87 / (download) - annotate - [select for diffs], Sat Jun 17 12:12:50 2017 UTC (6 years, 9 months ago) by kre
Branch: MAIN
CVS Tags: perseant-stdc-iso10646-base, perseant-stdc-iso10646
Changes since 1.86: +35 -22 lines
Diff to previous 1.86 (colored) to selected 1.60 (colored)


NFC - DEBUG mode only change - convert this to the new TRACE() format.

Revision 1.86 / (download) - annotate - [select for diffs], Wed Jun 7 05:08:32 2017 UTC (6 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.85: +16 -11 lines
Diff to previous 1.85 (colored) to selected 1.60 (colored)

A better LINENO implementation.   This version deletes (well, #if 0's out)
the LINENO hack, and uses the LINENO var for both ${LINENO} and $((LINENO)).
(Code to invert the LINENO hack when required, like when de-compiling the
execution tree to provide the "jobs" command strings, is still included,
that can be deleted when the LINENO hack is completely removed - look for
refs to VSLINENO throughout the code.  The var funclinno in parser.c can
also be removed, it is used only for the LINENO hack.)

This version produces accurate results: $((LINENO)) was made as accurate
as the LINENO hack made ${LINENO} which is very good.  That's why the
LINENO hack is not yet completely removed, so it can be easily re-enabled.
If you can tell the difference when it is in use, or not in use, then
something has broken (or I managed to miss a case somewhere.)

The way that LINENO works is documented in its own (new) section in the
man page, so nothing more about that, or the new options, etc, here.

This version introduces the possibility of having a "reference" function
associated with a variable, which gets called whenever the value of the
variable is required (that's what implements LINENO).  There is just
one function pointer however, so any particular variable gets at most
one of the set function (as used for PATH, etc) or the reference function.
The VFUNCREF bit in the var flags indicates which func the variable in
question uses (if any - the func ptr, as before, can be NULL).

I would not call the results of this perfect yet, but it is close.

Revision 1.79.6.3 / (download) - annotate - [select for diffs], Fri May 19 00:22:51 2017 UTC (6 years, 10 months ago) by pgoyette
Branch: prg-localcount2
Changes since 1.79.6.2: +25 -11 lines
Diff to previous 1.79.6.2 (colored) to branchpoint 1.79 (colored) next main 1.80 (colored) to selected 1.60 (colored)

Resolve conflicts from previous merge (all resulting from $NetBSD
keywork expansion)

Revision 1.85 / (download) - annotate - [select for diffs], Thu May 18 13:34:17 2017 UTC (6 years, 10 months ago) by kre
Branch: MAIN
CVS Tags: prg-localcount2-base3, netbsd-8-base
Branch point for: netbsd-8
Changes since 1.84: +3 -2 lines
Diff to previous 1.84 (colored) to selected 1.60 (colored)


DEBUG mode only change - correctly track internal shell sub-shell nesting
levels for debug output.  This change accidentally omitted earlier (only
effect is incorrect nesting levels shown in trace output when the option
to show them is enabled.)   NFC for any normal shell build.

Revision 1.84 / (download) - annotate - [select for diffs], Thu May 11 14:57:14 2017 UTC (6 years, 10 months ago) by kre
Branch: MAIN
Changes since 1.83: +24 -11 lines
Diff to previous 1.83 (colored) to selected 1.60 (colored)


Avoid truncating the command string saved with background jobs if
one of the words happens to contain ${#var}.  (This is the command
string shown by the "jobs" command, and when a background job completes)

While here, undo the LINENO hack when building that string.
And one ot two other foibles...

Revision 1.79.6.2 / (download) - annotate - [select for diffs], Thu May 11 02:58:28 2017 UTC (6 years, 10 months ago) by pgoyette
Branch: prg-localcount2
Changes since 1.79.6.1: +17 -3 lines
Diff to previous 1.79.6.1 (colored) to branchpoint 1.79 (colored) to selected 1.60 (colored)

Sync with HEAD

Revision 1.83 / (download) - annotate - [select for diffs], Tue May 9 05:14:03 2017 UTC (6 years, 10 months ago) by kre
Branch: MAIN
CVS Tags: prg-localcount2-base2
Changes since 1.82: +5 -2 lines
Diff to previous 1.82 (colored) to selected 1.60 (colored)


If we are going to permit
	! ! pipeline
(And for now the other places where ! is permitted)
we should at least generate the logically correct exit
status:
	! ! (exit 5); echo $?
should print 1, not 5.   ksh and bosh do it this way - and it makes sense.
bash and the FreeBSD sh echo "5" (as did we until now.)
dash, zsh, yash all enforce the standard syntax, and prohibit this.

Revision 1.82 / (download) - annotate - [select for diffs], Thu May 4 04:37:51 2017 UTC (6 years, 10 months ago) by kre
Branch: MAIN
Changes since 1.81: +10 -3 lines
Diff to previous 1.81 (colored) to selected 1.60 (colored)


Implement the ';&' (used instead of ';;') case statement list terminator
which causes fall through the to command list of the following pattern
(wuthout evaluating that pattern).   This has been approved for inclusion
in the next major version of the POSIX standard (Issue 8), and is
implemented by most other shells.

Now all form a circle and together attempt to summon the great wizd
in the hopes that his magic spells can transform the poor attempt
at documenting this feature into something rational...

Revision 1.81 / (download) - annotate - [select for diffs], Wed May 3 21:31:03 2017 UTC (6 years, 10 months ago) by kre
Branch: MAIN
Changes since 1.80: +6 -2 lines
Diff to previous 1.80 (colored) to selected 1.60 (colored)


Don't forget the ! reserved word exists (node ype NNOT) when displaying
"jobs" output (or other places where the cmd string is shown - like
when reporting status when a background job completes.)

Without this fix, try
	! sleep 5 &
	jobs
	wait
and try not to wonder at the '???" that appears instead of "! sleep 5"

Revision 1.79.6.1 / (download) - annotate - [select for diffs], Tue May 2 03:19:14 2017 UTC (6 years, 10 months ago) by pgoyette
Branch: prg-localcount2
Changes since 1.79: +16 -19 lines
Diff to previous 1.79 (colored) to selected 1.60 (colored)

Sync with HEAD - tag prg-localcount2-base1

Revision 1.80 / (download) - annotate - [select for diffs], Sat Apr 29 15:14:28 2017 UTC (6 years, 11 months ago) by kre
Branch: MAIN
CVS Tags: prg-localcount2-base1
Changes since 1.79: +16 -19 lines
Diff to previous 1.79 (colored) to selected 1.60 (colored)


Keep track of which file descriptors the shell is using for its
own purposes, and move them elsewhere whenever a user redirection
happens to pick the same number.   With this we can move the shell
file descriptors back to lower values (be slightly kinder to the kernel)
since we can no longer clash.   (Also get rid of a little old unneeded code.)

This also completes the fdflags command, which no longer permits access
to (by way or either obtaining, or changing) the shell's internal fds.

Revision 1.79 / (download) - annotate - [select for diffs], Sat May 7 20:07:47 2016 UTC (7 years, 10 months ago) by kre
Branch: MAIN
CVS Tags: prg-localcount2-base, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, localcount-20160914, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan
Branch point for: prg-localcount2
Changes since 1.78: +6 -2 lines
Diff to previous 1.78 (colored) to selected 1.60 (colored)


Slightly improve "jobs" command output in cases where a job includes
embedded background commands or pipelines.   (just slightly...)
OK christos@

Revision 1.78 / (download) - annotate - [select for diffs], Tue May 3 23:55:12 2016 UTC (7 years, 10 months ago) by kre
Branch: MAIN
Changes since 1.77: +4 -4 lines
Diff to previous 1.77 (colored) to selected 1.60 (colored)


Unbreak build ... again...   gcc is insane.

Revision 1.77 / (download) - annotate - [select for diffs], Tue May 3 20:46:35 2016 UTC (7 years, 10 months ago) by kre
Branch: MAIN
Changes since 1.76: +18 -11 lines
Diff to previous 1.76 (colored) to selected 1.60 (colored)


PR bin/51114 - print the correct values for >&- and >& N (N > 9)
in output from the "jobs" command (and other places that use the
same routines.)

Revision 1.76 / (download) - annotate - [select for diffs], Mon May 2 01:46:31 2016 UTC (7 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.75: +3 -11 lines
Diff to previous 1.75 (colored) to selected 1.60 (colored)

Fix handing of user file descriptors outside the 0..9 range.
Also, move (most of) the shell's internal use fd's to much
higher values (depending upon what ulimit -n allows) so they
are less likely to clash with user supplied fd numbers.  A future
patch will (hopefully) avoid this problem completely by dynamically
moving the shell's internal fds around as needed. (From kre@)

Revision 1.69.4.2 / (download) - annotate - [select for diffs], Sun Nov 15 17:41:26 2015 UTC (8 years, 4 months ago) by bouyer
Branch: netbsd-6
Changes since 1.69.4.1: +5 -6 lines
Diff to previous 1.69.4.1 (colored) to branchpoint 1.69 (colored) next main 1.70 (colored) to selected 1.60 (colored)

Pull up following revision(s) (requested by christos in ticket #1323):
	bin/sh/jobs.c: revision 1.74
	bin/sh/jobs.c: revision 1.75
	bin/sh/trap.c: revision 1.36
	bin/sh/trap.c: revision 1.37
	bin/sh/trap.h: revision 1.21
	bin/sh/trap.h: revision 1.22
Process pending signals while waiting for a job:
    $ cat << EOF > hup.sh
    #!/bin/sh
    trap 'echo SIGHUP; exit 1' 1
    sleep 10000 &
    wait
    EOF
    $ chmod +x ./hup.sh
    $ ./hup.sh &
    $ kill -HUP %1
report the signal that wait was interrupted by, which is not always SIGINT
anymore.

Revision 1.73.2.1 / (download) - annotate - [select for diffs], Wed Nov 4 17:58:38 2015 UTC (8 years, 4 months ago) by riz
Branch: netbsd-7
CVS Tags: netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1
Changes since 1.73: +5 -6 lines
Diff to previous 1.73 (colored) next main 1.74 (colored) to selected 1.60 (colored)

Pull up following revision(s) (requested by christos in ticket #964):
	bin/sh/jobs.c: revision 1.74
	bin/sh/jobs.c: revision 1.75
	bin/sh/trap.c: revision 1.36
	bin/sh/trap.c: revision 1.37
	bin/sh/trap.h: revision 1.21
	bin/sh/trap.h: revision 1.22
Process pending signals while waiting for a job:
    $ cat << EOF > hup.sh
    #!/bin/sh
    trap 'echo SIGHUP; exit 1' 1
    sleep 10000 &
    wait
    EOF
    $ chmod +x ./hup.sh
    $ ./hup.sh &
    $ kill -HUP %1
report the signal that wait was interrupted by, which is not always SIGINT
anymore.

Revision 1.75 / (download) - annotate - [select for diffs], Sat Aug 22 12:12:47 2015 UTC (8 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.74: +4 -4 lines
Diff to previous 1.74 (colored) to selected 1.60 (colored)

report the signal that wait was interrupted by, which is not always SIGINT
anymore.

Revision 1.74 / (download) - annotate - [select for diffs], Sat Aug 22 09:55:23 2015 UTC (8 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.73: +3 -4 lines
Diff to previous 1.73 (colored) to selected 1.60 (colored)

Process pending signals while waiting for a job:
    $ cat << EOF > hup.sh
    #!/bin/sh
    trap 'echo SIGHUP; exit 1' 1
    sleep 10000 &
    wait
    EOF
    $ chmod +x ./hup.sh
    $ ./hup.sh &
    $ kill -HUP %1

Revision 1.69.4.1 / (download) - annotate - [select for diffs], Sun Dec 7 15:58:27 2014 UTC (9 years, 3 months ago) by martin
Branch: netbsd-6
Changes since 1.69: +3 -3 lines
Diff to previous 1.69 (colored) to selected 1.60 (colored)

Pullup the following revisions, requested by spz in #1205:
src/bin/sh/jobs.c	1.73

PR/48729: Torbjn Granlund: Avoid negative index in array ref.

Revision 1.70.2.2 / (download) - annotate - [select for diffs], Tue Aug 19 23:45:11 2014 UTC (9 years, 7 months ago) by tls
Branch: tls-maxphys
Changes since 1.70.2.1: +8 -6 lines
Diff to previous 1.70.2.1 (colored) to branchpoint 1.70 (colored) next main 1.71 (colored) to selected 1.60 (colored)

Rebase to HEAD as of a few days ago.

Revision 1.72.2.1 / (download) - annotate - [select for diffs], Sun Aug 10 06:41:18 2014 UTC (9 years, 7 months ago) by tls
Branch: tls-earlyentropy
Changes since 1.72: +3 -3 lines
Diff to previous 1.72 (colored) next main 1.73 (colored) to selected 1.60 (colored)

Rebase.

Revision 1.69.2.3 / (download) - annotate - [select for diffs], Thu May 22 11:26:23 2014 UTC (9 years, 10 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.69.2.2: +8 -6 lines
Diff to previous 1.69.2.2 (colored) to branchpoint 1.69 (colored) next main 1.70 (colored) to selected 1.60 (colored)

sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")

Revision 1.73 / (download) - annotate - [select for diffs], Fri Apr 11 01:49:45 2014 UTC (9 years, 11 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, netbsd-7-base, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0
Branch point for: netbsd-7
Changes since 1.72: +3 -3 lines
Diff to previous 1.72 (colored) to selected 1.60 (colored)

PR/48729: Torbjn Granlund: Avoid negative index in array ref.

Revision 1.72 / (download) - annotate - [select for diffs], Sun Jan 26 22:38:20 2014 UTC (10 years, 2 months ago) by christos
Branch: MAIN
CVS Tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3
Branch point for: tls-earlyentropy
Changes since 1.71: +7 -5 lines
Diff to previous 1.71 (colored) to selected 1.60 (colored)

explain why forks fail

Revision 1.70.2.1 / (download) - annotate - [select for diffs], Mon Feb 25 00:23:53 2013 UTC (11 years, 1 month ago) by tls
Branch: tls-maxphys
Changes since 1.70: +19 -6 lines
Diff to previous 1.70 (colored) to selected 1.60 (colored)

resync with head

Revision 1.69.2.2 / (download) - annotate - [select for diffs], Wed Jan 23 00:04:05 2013 UTC (11 years, 2 months ago) by yamt
Branch: yamt-pagecache
CVS Tags: yamt-pagecache-tag8
Changes since 1.69.2.1: +19 -6 lines
Diff to previous 1.69.2.1 (colored) to branchpoint 1.69 (colored) to selected 1.60 (colored)

sync with head

Revision 1.71 / (download) - annotate - [select for diffs], Mon Dec 31 14:10:15 2012 UTC (11 years, 2 months ago) by dsl
Branch: MAIN
CVS Tags: yamt-pagecache-base8, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, khorben-n900, agc-symver-base, agc-symver
Changes since 1.70: +19 -6 lines
Diff to previous 1.70 (colored) to selected 1.60 (colored)

Add support for '%n' being a shorthand for 'fg %n'.

Revision 1.69.2.1 / (download) - annotate - [select for diffs], Tue Apr 17 00:01:38 2012 UTC (11 years, 11 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.69: +4 -3 lines
Diff to previous 1.69 (colored) to selected 1.60 (colored)

sync with head

Revision 1.70 / (download) - annotate - [select for diffs], Thu Feb 23 18:23:33 2012 UTC (12 years, 1 month ago) by joerg
Branch: MAIN
CVS Tags: yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4
Branch point for: tls-maxphys
Changes since 1.69: +4 -3 lines
Diff to previous 1.69 (colored) to selected 1.60 (colored)

Don't use a for-loop with empty body.

Revision 1.68.6.1 / (download) - annotate - [select for diffs], Thu Jun 23 14:17:48 2011 UTC (12 years, 9 months ago) by cherry
Branch: cherry-xenmp
Changes since 1.68: +3 -2 lines
Diff to previous 1.68 (colored) next main 1.69 (colored) to selected 1.60 (colored)

Catchup with rmind-uvmplock merge.

Revision 1.69 / (download) - annotate - [select for diffs], Sat Jun 18 21:18:46 2011 UTC (12 years, 9 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus
Branch point for: yamt-pagecache, netbsd-6
Changes since 1.68: +3 -2 lines
Diff to previous 1.68 (colored) to selected 1.60 (colored)

PR/45069: Henning Petersen: Use prototypes from builtins.h .

Revision 1.68 / (download) - annotate - [select for diffs], Sun Dec 21 17:16:11 2008 UTC (15 years, 3 months ago) by christos
Branch: MAIN
CVS Tags: matt-premerge-20091211, matt-mips64-premerge-20101231, jym-xensuspend-nbase, jym-xensuspend-base, jym-xensuspend, cherry-xenmp-base, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Branch point for: cherry-xenmp
Changes since 1.67: +12 -9 lines
Diff to previous 1.67 (colored) to selected 1.60 (colored)

don't free other jobs when we are specifically using the wait built-in.

Revision 1.67 / (download) - annotate - [select for diffs], Sun Dec 21 00:19:59 2008 UTC (15 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.66: +6 -6 lines
Diff to previous 1.66 (colored) to selected 1.60 (colored)

PR/35055: Wada Keiji: wait did not keep the status of terminated jobs as
expected.

Revision 1.66 / (download) - annotate - [select for diffs], Thu Oct 16 15:36:23 2008 UTC (15 years, 5 months ago) by dholland
Branch: MAIN
CVS Tags: netbsd-5-base, netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, netbsd-5, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-base2
Changes since 1.65: +6 -3 lines
Diff to previous 1.65 (colored) to selected 1.60 (colored)

Wrap declaration of a STATIC function that's only conditionally defined
in a suitable ifdef, so things still compile if STATIC is defined as
"static", which is for some reason not the default.

Revision 1.65 / (download) - annotate - [select for diffs], Mon Apr 24 19:00:29 2006 UTC (17 years, 11 months ago) by snj
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-pf42-base, yamt-pf42, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, wrstuden-revivesa, wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4, mjf-devfs2-base, mjf-devfs2, matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, matt-armv6-nbase, matt-armv6-base, matt-armv6, keiichi-mipv6-base, keiichi-mipv6, hpcarm-cleanup-nbase, hpcarm-cleanup-base, hpcarm-cleanup, cube-autoconf-base, cube-autoconf, abandoned-netbsd-4-base, abandoned-netbsd-4
Changes since 1.64: +3 -3 lines
Diff to previous 1.64 (colored) to selected 1.60 (colored)

It's "its."

Revision 1.64 / (download) - annotate - [select for diffs], Fri Sep 30 18:57:55 2005 UTC (18 years, 6 months ago) by tv
Branch: MAIN
Changes since 1.63: +5 -5 lines
Diff to previous 1.63 (colored) to selected 1.60 (colored)

Make slightly more portable without extra conditionals needed:

- Use getpgrp() rather than getpgid(0).
  (getpgrp() is already used elsewhere in this same file.)

- Use waitpid(-1, a, b) rather than wait3(a, b, NULL).

Revision 1.63 / (download) - annotate - [select for diffs], Wed Jun 1 15:41:19 2005 UTC (18 years, 10 months ago) by lukem
Branch: MAIN
Changes since 1.62: +3 -2 lines
Diff to previous 1.62 (colored) to selected 1.60 (colored)

appease gcc -Wuninitialized

Revision 1.62 / (download) - annotate - [select for diffs], Thu Dec 18 00:56:05 2003 UTC (20 years, 3 months ago) by christos
Branch: MAIN
CVS Tags: netbsd-3-base, netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1, netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0, netbsd-3, netbsd-2-base, netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-1, netbsd-2-0-base, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2-0, netbsd-2
Changes since 1.61: +3 -3 lines
Diff to previous 1.61 (colored) to selected 1.60 (colored)

PR/23786: Robert Nestor: wait command returns the wrong status code. This
seems to be an off-by-one error, since njobs is decremented before we use
it. I hope this does not break the vfork case!

Revision 1.61 / (download) - annotate - [select for diffs], Thu Nov 27 21:16:14 2003 UTC (20 years, 4 months ago) by dsl
Branch: MAIN
Changes since 1.60: +3 -5 lines
Diff to previous 1.60 (colored)

Generate command line when SMALL is defined and make buffer full sized.
All the code has been present for a while, and the memory cost is (about)
180 bytes per process.
Fixes PR bin/23545

Revision 1.60 / (download) - annotate - [selected], Fri Nov 14 10:27:10 2003 UTC (20 years, 4 months ago) by dsl
Branch: MAIN
Changes since 1.59: +3 -3 lines
Diff to previous 1.59 (colored)

Add '\n' to "fork failed" trace messages.

Revision 1.59 / (download) - annotate - [select for diffs], Tue Aug 26 18:12:33 2003 UTC (20 years, 7 months ago) by jmmv
Branch: MAIN
Changes since 1.58: +3 -3 lines
Diff to previous 1.58 (colored) to selected 1.60 (colored)

s/FD_SETFD/F_SETFD/

Revision 1.58 / (download) - annotate - [select for diffs], Thu Aug 7 09:05:33 2003 UTC (20 years, 7 months ago) by agc
Branch: MAIN
Changes since 1.57: +3 -7 lines
Diff to previous 1.57 (colored) to selected 1.60 (colored)

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.

Revision 1.57 / (download) - annotate - [select for diffs], Mon Jan 27 12:54:08 2003 UTC (21 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.56: +14 -4 lines
Diff to previous 1.56 (colored) to selected 1.60 (colored)

- use FD_CLOEXEC properly
- move ttyfd to a high fd
suggested by Tim Robbins at FreeBSD.

Revision 1.56 / (download) - annotate - [select for diffs], Mon Nov 25 12:13:03 2002 UTC (21 years, 4 months ago) by agc
Branch: MAIN
CVS Tags: fvdl_fs64_base
Changes since 1.55: +5 -5 lines
Diff to previous 1.55 (colored) to selected 1.60 (colored)

Make this compile on some of the more esoteric architectures (e.g. those
which are not i386)

Revision 1.55 / (download) - annotate - [select for diffs], Sun Nov 24 22:35:40 2002 UTC (21 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.54: +536 -313 lines
Diff to previous 1.54 (colored) to selected 1.60 (colored)

Fixes from David Laight:
- ansification
- format of output of jobs command (etc)
- job identiers %+, %- etc
- $? and $(...)
- correct quoting of output of set, export -p and readonly -p
- differentiation between nornal and 'posix special' builtins
- correct behaviour (posix) for errors on builtins and special builtins
- builtin printf and kill
- set -o debug (if compiled with DEBUG)
- cd src obj (as ksh - too useful to do without)
- unset -e name, remove non-readonly variable from export list.
  (so I could unset -e PS1 before running the test shell...)

Revision 1.54 / (download) - annotate - [select for diffs], Wed Oct 23 19:46:06 2002 UTC (21 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.53: +3 -3 lines
Diff to previous 1.53 (colored) to selected 1.60 (colored)

From David Laight:

> Also 'jobs' fails in a non-interactive shell.
> In showjobs(), the code that puts the process back into its
> own process group should only be run if the shell is actually
> doing job control - eg if 'mflag' is set.

Revision 1.53 / (download) - annotate - [select for diffs], Sat Sep 28 03:15:43 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.52: +11 -3 lines
Diff to previous 1.52 (colored) to selected 1.60 (colored)

Revert the previous for now.  This is truly gross.

Revision 1.52 / (download) - annotate - [select for diffs], Sat Sep 28 03:08:00 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.51: +5 -13 lines
Diff to previous 1.51 (colored) to selected 1.60 (colored)

Remove the duplicate setpgid() in forkparent().  The real bug was freeing the
job structure in the child and referencing freed memory.

Revision 1.51 / (download) - annotate - [select for diffs], Sat Sep 28 01:25:01 2002 UTC (21 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.50: +18 -21 lines
Diff to previous 1.50 (colored) to selected 1.60 (colored)

Revert previous change. No need to save rootshell. It is only affecting
the non-vfork case. Having said that, it would be nice if pipelines of
simple commands were vforked too. Right now they are not.
Explain that setpgid() might fail because we are doing it both in the
parent and the child case, because we don't know which one will come
first.
Suspending a pipeline prints %1 Suspended n times where n is the number
of processes, but that was there before. It is easy to fix, but I'll
leave the code alone for now.

Revision 1.50 / (download) - annotate - [select for diffs], Fri Sep 27 22:56:24 2002 UTC (21 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.49: +14 -12 lines
Diff to previous 1.49 (colored) to selected 1.60 (colored)

Deal with rootshell not being maintained correctly in the vfork() case.
Propagate isroot, throughout the eval process and maintain it properly.
Fixes sleep 10 | cat^C not exiting because sleep and cat ended up in
their own process groups, because wasroot was always true in the children.

Revision 1.49 / (download) - annotate - [select for diffs], Fri Sep 27 21:32:25 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.48: +2 -7 lines
Diff to previous 1.48 (colored) to selected 1.60 (colored)

Clean up INTOFF/INTON usage a little -- none of fork{shell,parent,child}()
screw with them now, only their callers.

Revision 1.48 / (download) - annotate - [select for diffs], Fri Sep 27 21:04:08 2002 UTC (21 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.47: +6 -6 lines
Diff to previous 1.47 (colored) to selected 1.60 (colored)

off by one in nprocs.

Revision 1.47 / (download) - annotate - [select for diffs], Fri Sep 27 18:56:53 2002 UTC (21 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.46: +160 -87 lines
Diff to previous 1.46 (colored) to selected 1.60 (colored)

VFork()ing shell: From elric@netbsd.org:
Plus my changes:
	- walking process group fix in foregrounding a job.
	- reset of process group in parent shell if interrupted before the wait.
	- move INTON lower in the dowait so that the job structure is
	  consistent.
	- error check all setpgid(), tcsetpgrp() calls.
	- eliminate unneeded strpgid() call.
	- check that we don't belong in the process group before we try to
	  set it.

Revision 1.46 / (download) - annotate - [select for diffs], Wed May 15 16:33:35 2002 UTC (21 years, 10 months ago) by christos
Branch: MAIN
CVS Tags: netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1, netbsd-1-6-PATCH002-RELEASE, netbsd-1-6-PATCH002-RC4, netbsd-1-6-PATCH002-RC3, netbsd-1-6-PATCH002-RC2, netbsd-1-6-PATCH002-RC1, netbsd-1-6-PATCH002, netbsd-1-6-PATCH001-RELEASE, netbsd-1-6-PATCH001-RC3, netbsd-1-6-PATCH001-RC2, netbsd-1-6-PATCH001-RC1, netbsd-1-6-PATCH001, netbsd-1-6
Changes since 1.45: +4 -2 lines
Diff to previous 1.45 (colored) to selected 1.60 (colored)

implement noclobber. From Ben Harris, with minor tweaks from me. Two
unimplemented comments to go. Go Ben!

Revision 1.45 / (download) - annotate - [select for diffs], Wed Apr 10 15:52:07 2002 UTC (21 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.44: +11 -4 lines
Diff to previous 1.44 (colored) to selected 1.60 (colored)

Try harder to find a tty.

Revision 1.44 / (download) - annotate - [select for diffs], Wed Apr 3 14:30:44 2002 UTC (22 years ago) by christos
Branch: MAIN
Changes since 1.43: +59 -37 lines
Diff to previous 1.43 (colored) to selected 1.60 (colored)

PR/16174: Matthias Buelow: Job control fails on jobs that fd == 2 does not
point to a tty.

Unfortunately the shell assumed that it could do all process group
handling ioctls to fd=2, but this is not correct. Jobs that redirected
fd=2 would be unable to perform the ioctls and silently fail since
the error reporting channel is fd=2... Instead open /dev/tty set
it to close on exec, and use that instead (like all other shells
do). We don't handle the case where the OS does not provide FD_CLOEXEC
or FIOCLEX, because I am lazy.

While I am there:
- Simplify the code by defining functions for tc{g,s}pgrp when OLD_TTY_DRIVER
  is defined.
- make sure that 'sh &' works by stopping itself. Don't kill the shell's
  process group, kill the shell itself.

Revision 1.43.2.1 / (download) - annotate - [select for diffs], Wed Mar 27 20:37:38 2002 UTC (22 years ago) by elric
Branch: ELRICshvfork
Changes since 1.43: +103 -78 lines
Diff to previous 1.43 (colored) next main 1.44 (colored) to selected 1.60 (colored)

Doing the vfork work on ash on a branch to try to shake out the
problems before I expose everyone to them.  This checkin represents
a merge of the prior work, which I backed out a while ago, to the
HEAD only and does not incorporate any additional bugfixes.  The
additional bugfixes and code-cleanup will occur in later checkins.

For reference the patches that were used are:
cvs diff -kk -r1.51 -r1.55 eval.c  | patch
cvs diff -kk -r1.27 -r1.28 exec.c  | patch
cvs diff -kk -r1.15 -r1.16 exec.h  | patch
cvs diff -kk -r1.32 -r1.33 input.c | patch
cvs diff -kk -r1.10 -r1.11 input.h | patch
cvs diff -kk -r1.32 -r1.35 jobs.c  | patch
cvs diff -kk -r1.9  -r1.11 jobs.h  | patch
cvs diff -kk -r1.36 -r1.37 main.c  | patch
cvs diff -kk -r1.20 -r1.21 redir.c | patch
cvs diff -kk -r1.10 -r1.11 redir.h | patch
cvs diff -kk -r1.10 -r1.12 shell.h | patch
cvs diff -kk -r1.22 -r1.23 trap.c  | patch
cvs diff -kk -r1.12 -r1.13 trap.h  | patch
cvs diff -kk -r1.23 -r1.24 var.c   | patch
cvs diff -kk -r1.16 -r1.17 var.h   | patch

All other changes were simply the resolution of the resulting
conflicts, which occured only in the merge of jobs.c.

Begins to address PR: bin/5475

Revision 1.43 / (download) - annotate - [select for diffs], Fri Mar 22 19:50:42 2002 UTC (22 years ago) by christos
Branch: MAIN
CVS Tags: ELRICshvfork-base
Branch point for: ELRICshvfork
Changes since 1.42: +6 -4 lines
Diff to previous 1.42 (colored) to selected 1.60 (colored)

PR/16010: Andreas Gustafsson: wait is not interruptible.

Revision 1.42 / (download) - annotate - [select for diffs], Tue Mar 12 03:45:02 2002 UTC (22 years ago) by simonb
Branch: MAIN
Changes since 1.41: +7 -5 lines
Diff to previous 1.41 (colored) to selected 1.60 (colored)

In forkshell() don't free the current job.  Fixes problem with previous
commit where pipeline commands didn't inherit the correct process group.
Reviewed by Christos.

Change a trace format string arg to use %p instead of %x and a long cast.

Revision 1.41 / (download) - annotate - [select for diffs], Tue Mar 12 00:44:16 2002 UTC (22 years ago) by christos
Branch: MAIN
Changes since 1.40: +6 -3 lines
Diff to previous 1.40 (colored) to selected 1.60 (colored)

PR/15877: Ed Ravin: make sure that we cleanup enough of the job structure,
in jobfree() so that we don't fail when we use a malloc where free() trashes
freed memory.

Revision 1.40 / (download) - annotate - [select for diffs], Sun Sep 16 16:34:23 2001 UTC (22 years, 6 months ago) by wiz
Branch: MAIN
Changes since 1.39: +3 -3 lines
Diff to previous 1.39 (colored) to selected 1.60 (colored)

Spell 'occurred' with two 'r's.

Revision 1.39 / (download) - annotate - [select for diffs], Thu Sep 13 21:33:05 2001 UTC (22 years, 6 months ago) by assar
Branch: MAIN
Changes since 1.38: +3 -3 lines
Diff to previous 1.38 (colored) to selected 1.60 (colored)

(waitproc): handle jp == NULL, it happens

Revision 1.38 / (download) - annotate - [select for diffs], Mon Sep 10 15:47:03 2001 UTC (22 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.37: +9 -9 lines
Diff to previous 1.37 (colored) to selected 1.60 (colored)

Don't wait with UNTRACED for jobs that have not been started with job control
(i.e. processes started from shell scripts). Fixes problem where kill -STOP'ing
a subprocess of a shell script would cause the shell to proceed to the next
command.

Revision 1.37 / (download) - annotate - [select for diffs], Wed Jun 13 08:48:06 2001 UTC (22 years, 9 months ago) by lukem
Branch: MAIN
Changes since 1.36: +3 -3 lines
Diff to previous 1.36 (colored) to selected 1.60 (colored)

fix grammar

Revision 1.36 / (download) - annotate - [select for diffs], Mon May 22 10:18:47 2000 UTC (23 years, 10 months ago) by elric
Branch: MAIN
CVS Tags: netbsd-1-5-base, netbsd-1-5-RELEASE, netbsd-1-5-PATCH003, netbsd-1-5-PATCH002, netbsd-1-5-PATCH001, netbsd-1-5-BETA2, netbsd-1-5-BETA, netbsd-1-5-ALPHA2, netbsd-1-5, minoura-xpg4dl-base, minoura-xpg4dl
Changes since 1.35: +75 -103 lines
Diff to previous 1.35 (colored) to selected 1.60 (colored)

Back out previous vfork changes.

Revision 1.35 / (download) - annotate - [select for diffs], Mon May 15 03:42:48 2000 UTC (23 years, 10 months ago) by elric
Branch: MAIN
Changes since 1.34: +5 -3 lines
Diff to previous 1.34 (colored) to selected 1.60 (colored)

INTON and FORCEINTON modify global variables, and so should not be
executed while we are vforked.

Revision 1.34 / (download) - annotate - [select for diffs], Sat May 13 20:59:41 2000 UTC (23 years, 10 months ago) by elric
Branch: MAIN
Changes since 1.33: +2 -3 lines
Diff to previous 1.33 (colored) to selected 1.60 (colored)

Unused variable pgrp on line 576.

Revision 1.33 / (download) - annotate - [select for diffs], Sat May 13 20:50:15 2000 UTC (23 years, 10 months ago) by elric
Branch: MAIN
Changes since 1.32: +101 -74 lines
Diff to previous 1.32 (colored) to selected 1.60 (colored)

Now we use vfork(2) instead of fork(2) when we can.

Revision 1.29.2.2 / (download) - annotate - [select for diffs], Sat Oct 9 21:27:31 1999 UTC (24 years, 5 months ago) by cgd
Branch: netbsd-1-4
CVS Tags: netbsd-1-4-PATCH003, netbsd-1-4-PATCH002
Changes since 1.29.2.1: +16 -13 lines
Diff to previous 1.29.2.1 (colored) to branchpoint 1.29 (colored) next main 1.30 (colored) to selected 1.60 (colored)

pull up rev 1.32 from trunk (requested by mycroft):
  Allow the tty interrupt character (e.g. ^C) to interrupt loops run
  in an interactive shell again.

Revision 1.32 / (download) - annotate - [select for diffs], Tue Aug 31 08:58:47 1999 UTC (24 years, 7 months ago) by mycroft
Branch: MAIN
CVS Tags: wrstuden-devbsize-base, wrstuden-devbsize-19991221, wrstuden-devbsize, comdex-fall-1999-base, comdex-fall-1999
Changes since 1.31: +16 -13 lines
Diff to previous 1.31 (colored) to selected 1.60 (colored)

It turns out that the code disabled in revision 1.30 *does* have an important
function (which nobody was able to explain): it's critical to allowing a
complex command run from an interactive shell to be terminated.  So, reinstate
it and fix it correctly.  See the comment if you really want the gory details.

Revision 1.31 / (download) - annotate - [select for diffs], Fri Jul 9 03:05:50 1999 UTC (24 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.30: +8 -7 lines
Diff to previous 1.30 (colored) to selected 1.60 (colored)

compile with WARNS = 2

Revision 1.29.2.1 / (download) - annotate - [select for diffs], Mon Apr 19 04:07:53 1999 UTC (24 years, 11 months ago) by mycroft
Branch: netbsd-1-4
CVS Tags: netbsd-1-4-RELEASE, netbsd-1-4-PATCH001
Changes since 1.29: +11 -3 lines
Diff to previous 1.29 (colored) to selected 1.60 (colored)

Pull up rev 1.30:
Disable bogus-looking code that cause us to throw away SIGINTs.

Revision 1.30 / (download) - annotate - [select for diffs], Mon Apr 5 14:59:35 1999 UTC (24 years, 11 months ago) by mycroft
Branch: MAIN
Changes since 1.29: +11 -3 lines
Diff to previous 1.29 (colored) to selected 1.60 (colored)

Disable bogus-looking code that cause us to throw away SIGINTs.

Revision 1.29 / (download) - annotate - [select for diffs], Thu Feb 4 16:17:39 1999 UTC (25 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: netbsd-1-4-base
Branch point for: netbsd-1-4
Changes since 1.28: +4 -2 lines
Diff to previous 1.28 (colored) to selected 1.60 (colored)

PR/4966: Joel Reicher: Implement <> redirections which are documented in
the man page.

Revision 1.28 / (download) - annotate - [select for diffs], Tue Jul 28 11:41:55 1998 UTC (25 years, 8 months ago) by mycroft
Branch: MAIN
Changes since 1.27: +3 -4 lines
Diff to previous 1.27 (colored) to selected 1.60 (colored)

Be more retentive about use of NOTREACHED and noreturn.

Revision 1.27 / (download) - annotate - [select for diffs], Wed May 20 00:31:11 1998 UTC (25 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.26: +7 -5 lines
Diff to previous 1.26 (colored) to selected 1.60 (colored)

cast pid's to longs for OS's where this is the case.

Revision 1.23.2.1 / (download) - annotate - [select for diffs], Fri May 8 06:01:04 1998 UTC (25 years, 10 months ago) by mycroft
Branch: netbsd-1-3
CVS Tags: netbsd-1-3-PATCH003-CANDIDATE2, netbsd-1-3-PATCH003-CANDIDATE1, netbsd-1-3-PATCH003-CANDIDATE0, netbsd-1-3-PATCH003, netbsd-1-3-PATCH002
Changes since 1.23: +11 -7 lines
Diff to previous 1.23 (colored) next main 1.24 (colored) to selected 1.60 (colored)

Sync with trunk, per request of christos.

Revision 1.26 / (download) - annotate - [select for diffs], Tue Apr 7 10:16:04 1998 UTC (25 years, 11 months ago) by fair
Branch: MAIN
Changes since 1.25: +9 -6 lines
Diff to previous 1.25 (colored) to selected 1.60 (colored)

Change a few things to reference /usr/include/paths.h instead of local
references. Fixing the default PATH is a bit more effort.

Revision 1.25 / (download) - annotate - [select for diffs], Wed Feb 4 23:49:25 1998 UTC (26 years, 1 month ago) by thorpej
Branch: MAIN
Changes since 1.24: +4 -3 lines
Diff to previous 1.24 (colored) to selected 1.60 (colored)

Sigh, have to cast pointer diffs to long.

Revision 1.24 / (download) - annotate - [select for diffs], Wed Feb 4 20:10:16 1998 UTC (26 years, 1 month ago) by thorpej
Branch: MAIN
Changes since 1.23: +3 -3 lines
Diff to previous 1.23 (colored) to selected 1.60 (colored)

Fix printf formats so they work on the Alpha.

Revision 1.23 / (download) - annotate - [select for diffs], Wed Oct 8 20:31:52 1997 UTC (26 years, 5 months ago) by christos
Branch: MAIN
CVS Tags: netbsd-1-3-base, netbsd-1-3-RELEASE, netbsd-1-3-PATCH001, netbsd-1-3-BETA
Branch point for: netbsd-1-3
Changes since 1.22: +43 -35 lines
Diff to previous 1.22 (colored) to selected 1.60 (colored)

PR/3662: David Holland: Make /bin/sh use the symbolic macros for wait().

Revision 1.22 / (download) - annotate - [select for diffs], Fri Jul 4 21:02:04 1997 UTC (26 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.21: +3 -3 lines
Diff to previous 1.21 (colored) to selected 1.60 (colored)

Fix compiler warnings.

Revision 1.17.6.1 / (download) - annotate - [select for diffs], Sun Jan 26 04:57:23 1997 UTC (27 years, 2 months ago) by rat
Branch: netbsd-1-2
CVS Tags: netbsd-1-2-PATCH001
Changes since 1.17: +53 -21 lines
Diff to previous 1.17 (colored) next main 1.18 (colored) to selected 1.60 (colored)

Update /bin/sh from trunk per request of Christos Zoulas.  Fixes
many bugs.

Revision 1.21 / (download) - annotate - [select for diffs], Sat Jan 11 02:04:36 1997 UTC (27 years, 2 months ago) by tls
Branch: MAIN
Changes since 1.20: +9 -9 lines
Diff to previous 1.20 (colored) to selected 1.60 (colored)

kill 'register'

Revision 1.20 / (download) - annotate - [select for diffs], Sat Nov 2 18:26:04 1996 UTC (27 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.19: +3 -3 lines
Diff to previous 1.19 (colored) to selected 1.60 (colored)

Fix problems that gcc -Wall found (from Todd Miller, OpenBSD)

Revision 1.19 / (download) - annotate - [select for diffs], Wed Oct 16 14:42:20 1996 UTC (27 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.18: +19 -14 lines
Diff to previous 1.18 (colored) to selected 1.60 (colored)

PR/2808: Don't include <sgtty.h> unless OLD_TTY_DRIVER is defined.
         Remove extraneous newline from error messages.

Revision 1.18 / (download) - annotate - [select for diffs], Tue Sep 17 14:44:05 1996 UTC (27 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.17: +29 -2 lines
Diff to previous 1.17 (colored) to selected 1.60 (colored)

ioctl(TIOC[GS]PGRP) -> tc[gs]etpgrp()

Revision 1.17 / (download) - annotate - [select for diffs], Tue Jul 4 16:26:45 1995 UTC (28 years, 9 months ago) by pk
Branch: MAIN
CVS Tags: netbsd-1-2-base, netbsd-1-2-RELEASE, netbsd-1-2-BETA, netbsd-1-1-base, netbsd-1-1-RELEASE, netbsd-1-1-PATCH001, netbsd-1-1
Branch point for: netbsd-1-2
Changes since 1.16: +6 -2 lines
Diff to previous 1.16 (colored) to selected 1.60 (colored)

Relocate pointers after re-allocation of the job table.

Revision 1.16 / (download) - annotate - [select for diffs], Thu May 11 21:29:18 1995 UTC (28 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.15: +27 -29 lines
Diff to previous 1.15 (colored) to selected 1.60 (colored)

Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0
bug.

Revision 1.15 / (download) - annotate - [select for diffs], Tue Mar 21 09:09:17 1995 UTC (29 years ago) by cgd
Branch: MAIN
Changes since 1.14: +7 -2 lines
Diff to previous 1.14 (colored) to selected 1.60 (colored)

convert to new RCS id conventions.

Revision 1.14 / (download) - annotate - [select for diffs], Fri Dec 23 13:24:41 1994 UTC (29 years, 3 months ago) by cgd
Branch: MAIN
Changes since 1.13: +5 -3 lines
Diff to previous 1.13 (colored) to selected 1.60 (colored)

be more careful with casts.

Revision 1.13 / (download) - annotate - [select for diffs], Sun Dec 4 07:12:15 1994 UTC (29 years, 4 months ago) by cgd
Branch: MAIN
Changes since 1.12: +40 -13 lines
Diff to previous 1.12 (colored) to selected 1.60 (colored)

from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch
some of the worst style errors.

Revision 1.12 / (download) - annotate - [select for diffs], Fri Sep 23 11:28:42 1994 UTC (29 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.11: +6 -6 lines
Diff to previous 1.11 (colored) to selected 1.60 (colored)

Eliminate uses of some obsolete functions.

Revision 1.11 / (download) - annotate - [select for diffs], Sat Jun 11 16:12:01 1994 UTC (29 years, 9 months ago) by mycroft
Branch: MAIN
CVS Tags: netbsd-1-0-base, netbsd-1-0-RELEASE, netbsd-1-0-PATCH1, netbsd-1-0-PATCH06, netbsd-1-0-PATCH05, netbsd-1-0-PATCH04, netbsd-1-0-PATCH03, netbsd-1-0-PATCH02, netbsd-1-0-PATCH0, netbsd-1-0
Changes since 1.10: +2 -1 lines
Diff to previous 1.10 (colored) to selected 1.60 (colored)

Add RCS ids.

Revision 1.10 / (download) - annotate - [select for diffs], Thu May 12 16:32:42 1994 UTC (29 years, 10 months ago) by jtc
Branch: MAIN
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored) to selected 1.60 (colored)

POSIX.1 changed getpgrp

Revision 1.9 / (download) - annotate - [select for diffs], Thu May 12 16:09:11 1994 UTC (29 years, 10 months ago) by jtc
Branch: MAIN
Changes since 1.8: +5 -5 lines
Diff to previous 1.8 (colored) to selected 1.60 (colored)

Use libc's sys_siglist[] instead of building and using our own array of
signal names. (from charles)

Revision 1.8 / (download) - annotate - [select for diffs], Wed May 11 17:10:06 1994 UTC (29 years, 10 months ago) by jtc
Branch: MAIN
Changes since 1.7: +58 -32 lines
Diff to previous 1.7 (colored) to selected 1.60 (colored)

sync with 4.4lite

Revision 1.1.1.2 / (download) - annotate - [select for diffs] (vendor branch), Wed May 11 17:01:51 1994 UTC (29 years, 10 months ago) by jtc
Branch: WFJ-920714, CSRG
CVS Tags: lite-1
Changes since 1.1.1.1: +50 -20 lines
Diff to previous 1.1.1.1 (colored) to selected 1.60 (colored)

44lite code

Revision 1.7 / (download) - annotate - [select for diffs], Fri Aug 6 21:50:16 1993 UTC (30 years, 7 months ago) by mycroft
Branch: MAIN
Changes since 1.6: +9 -9 lines
Diff to previous 1.6 (colored) to selected 1.60 (colored)

Use sys_signame[].

Revision 1.6 / (download) - annotate - [select for diffs], Sun Aug 1 18:58:14 1993 UTC (30 years, 8 months ago) by mycroft
Branch: MAIN
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored) to selected 1.60 (colored)

Add RCS identifiers.

Revision 1.5 / (download) - annotate - [select for diffs], Sun May 2 01:28:41 1993 UTC (30 years, 11 months ago) by sef
Branch: MAIN
CVS Tags: netbsd-0-9-base, netbsd-0-9-RELEASE, netbsd-0-9-BETA, netbsd-0-9-ALPHA2, netbsd-0-9-ALPHA, netbsd-0-9
Changes since 1.4: +6 -3 lines
Diff to previous 1.4 (colored) to selected 1.60 (colored)

Jim "wilson@moria.cygnus.com" Wilson's patches to make C News (and other
things) work.

Revision 1.4 / (download) - annotate - [select for diffs], Mon Apr 26 06:09:17 1993 UTC (30 years, 11 months ago) by dpassage
Branch: MAIN
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored) to selected 1.60 (colored)

Removed a cast that was causing another stoopid compile error.

Revision 1.3 / (download) - annotate - [select for diffs], Tue Mar 23 00:28:11 1993 UTC (31 years ago) by cgd
Branch: MAIN
CVS Tags: netbsd-alpha-1, netbsd-0-8
Changes since 1.2: +1 -1 lines
Diff to previous 1.2 (colored) to selected 1.60 (colored)

changed "Id" to "Header" for rcsids

Revision 1.2 / (download) - annotate - [select for diffs], Mon Mar 22 08:04:00 1993 UTC (31 years ago) by cgd
Branch: MAIN
Changes since 1.1: +1 -0 lines
Diff to previous 1.1 (colored) to selected 1.60 (colored)

added rcs ids to all files

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Sun Mar 21 09:45:37 1993 UTC (31 years ago) by cgd
Branch: WFJ-920714, CSRG
CVS Tags: patchkit-0-2-2, WFJ-386bsd-01
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored) to selected 1.60 (colored)

initial import of 386bsd-0.1 sources

Revision 1.1 / (download) - annotate - [select for diffs], Sun Mar 21 09:45:37 1993 UTC (31 years ago) by cgd
Branch: MAIN
Diff to selected 1.60 (colored)

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>