#
14acc88f |
| 07-Apr-2023 |
kre <kre@NetBSD.org> |
The great shell trailing whitespace cleanup of 2023... Inspired by private e-mail comments from mouse@
NFCI.
|
#
f6a25374 |
| 11-Sep-2021 |
christos <christos@NetBSD.org> |
Add jobs -Z (like in zsh(1)) to setproctitle(3).
|
#
dd8b3150 |
| 04-Apr-2021 |
kre <kre@NetBSD.org> |
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:
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
show more ...
|
#
2efe0a73 |
| 11-Sep-2018 |
kre <kre@NetBSD.org> |
Whitespace cleanup from last update. NFC.
|
#
7c63337b |
| 04-Sep-2018 |
kre <kre@NetBSD.org> |
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
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.
show more ...
|
#
45b2221c |
| 28-Oct-2017 |
kre <kre@NetBSD.org> |
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.)
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...)
show more ...
|
#
76088cb0 |
| 18-Jun-2011 |
christos <christos@NetBSD.org> |
PR/45069: Henning Petersen: Use prototypes from builtins.h .
|
#
7983f217 |
| 27-Nov-2003 |
dsl <dsl@NetBSD.org> |
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
|
#
b5b29542 |
| 07-Aug-2003 |
agc <agc@NetBSD.org> |
Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
|
#
e314f958 |
| 22-Jan-2003 |
dsl <dsl@NetBSD.org> |
Support command -p, -v and -V as posix Stop temporary PATH assigments messing up hash table Fix sh -c -e "echo $0 $*" -a x (as posix) (agreed by christos)
|
#
c02b3bbd |
| 24-Nov-2002 |
christos <christos@NetBSD.org> |
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 - differentia
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...)
show more ...
|
#
4783843f |
| 28-Sep-2002 |
christos <christos@NetBSD.org> |
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
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.
show more ...
|
#
6f482334 |
| 27-Sep-2002 |
christos <christos@NetBSD.org> |
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 ca
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.
show more ...
|
#
edcb4544 |
| 27-Sep-2002 |
christos <christos@NetBSD.org> |
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
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.
show more ...
|
#
e6bccfe4 |
| 22-May-2000 |
elric <elric@NetBSD.org> |
Back out previous vfork changes.
|
#
4aeaa113 |
| 13-May-2000 |
elric <elric@NetBSD.org> |
Quick fix.
jobs.h:91: warning: declaration of `vfork' shadows global declaration
|
#
756a2ca1 |
| 13-May-2000 |
elric <elric@NetBSD.org> |
Now we use vfork(2) instead of fork(2) when we can.
|
#
82ec2562 |
| 15-Oct-1997 |
christos <christos@NetBSD.org> |
pid should be pid_t and status should be int! Avoid alignment problems...
|
#
07bae7ed |
| 11-May-1995 |
christos <christos@NetBSD.org> |
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0 bug.
|
#
49f0ad86 |
| 21-Mar-1995 |
cgd <cgd@NetBSD.org> |
convert to new RCS id conventions.
|
#
cafd1f7e |
| 11-Jun-1994 |
mycroft <mycroft@NetBSD.org> |
Add RCS ids.
|
#
37ed7877 |
| 11-May-1994 |
jtc <jtc@NetBSD.org> |
sync with 4.4lite
|
#
8542364e |
| 01-Aug-1993 |
mycroft <mycroft@NetBSD.org> |
Add RCS identifiers.
|
#
06be6008 |
| 23-Mar-1993 |
cgd <cgd@NetBSD.org> |
changed "Id" to "Header" for rcsids
|
#
346aa5dd |
| 22-Mar-1993 |
cgd <cgd@NetBSD.org> |
added rcs ids to all files
|