Up to [cvs.NetBSD.org] / src / bin / sh
Request diff between arbitrary revisions
Default branch: MAIN
Revision 1.188 / (download) - annotate - [select for diffs], Wed Jan 5 15:25:44 2022 UTC (13 months ago) by kre
Branch: MAIN
CVS Tags: netbsd-10-base,
netbsd-10,
HEAD
Changes since 1.187: +5 -4
lines
Diff to previous 1.187 (colored)
Use a volative local shadow of a field in an (on-stack) non-volatile struct that is to be referenced after a return from setjmp() via longjmp(). This doesn't ever seem to have caused a problem, but I think using volative vars is required here. For reasons I never bothered to discover, even though this change certainly requires a store into stack memory which wasn't required before, earlier measurements showed the shell getting (slightly) smaller with this change in place. NFCI
Revision 1.187 / (download) - annotate - [select for diffs], Sun Dec 5 04:35:38 2021 UTC (14 months ago) by msaitoh
Branch: MAIN
Changes since 1.186: +3 -3
lines
Diff to previous 1.186 (colored)
s/commmand/command/ in comment.
Revision 1.186 / (download) - annotate - [select for diffs], Mon Nov 22 05:17:43 2021 UTC (14 months, 2 weeks ago) by kre
Branch: MAIN
Changes since 1.185: +8 -2
lines
Diff to previous 1.185 (colored)
PR bin/53550 Here we go again... One more time to redo how here docs are processed (it has been a few years since the last time!) This is actually a relatively minor change, mostly to timimg (to just when things happen). Now here docs are expanded at the same time the "filename" word in a redirect is expanded, rather than later when the heredoc was being sent to its process. This actually makes things more consistent - but does break one of the ATF tests which was testing that we were (effectively) internally inconsistent in this area. Not all shells agree on the context in which redirection expansions should happen, some make any side effects visible to the parent shell (the majority do) others do the redirection expansions in a subshell so any side effcts are lost. We used to have a foot in each camp, with the majority for everything but here docs, and the minority for here docs. Now we're all the way with LBJ ... (or something like that).
Revision 1.185 / (download) - annotate - [select for diffs], Tue Nov 16 11:27:50 2021 UTC (14 months, 3 weeks ago) by kre
Branch: MAIN
Changes since 1.184: +3 -2
lines
Diff to previous 1.184 (colored)
Detect write errors to stdout, and exit(1) from some built-in commands which (primarily) are used just to generate output (or with a particular option combination do so).
Revision 1.184 / (download) - annotate - [select for diffs], Tue Nov 16 11:25:44 2021 UTC (14 months, 3 weeks ago) by kre
Branch: MAIN
Changes since 1.183: +3 -2
lines
Diff to previous 1.183 (colored)
Fix value of ${LINENO} in "for" commands. This affects (as best I can tell) only uses of ${LINENO} in PS4 when -x is enabled (and perhaps only when the list contains no expansions). "for" like "case" (which was already handled) is special in that it generates trace output before actually executing any kind of simple command.
Revision 1.183 / (download) - annotate - [select for diffs], Wed Nov 10 15:26:34 2021 UTC (14 months, 4 weeks ago) by kre
Branch: MAIN
Changes since 1.182: +8 -2
lines
Diff to previous 1.182 (colored)
DEBUG mode changes only. NFC (NC) for any normally compiled shell. Mostly adding DEBUG mode tracing (when appropriate verbose tracing is enabled generally) whenever a shell (including sushell) process exits, so shells that the tracing should indicate why ehslls that vanish did that. Note for future investigators: if the relevant tracing is enabled, and a (sub-)shell still simply seems to have vanished without trace, the likely cause is that it was killed by a signal - and of those, the most common that occurs is SIGPIPE.
Revision 1.175.2.3 / (download) - annotate - [select for diffs], Wed Apr 28 09:58:42 2021 UTC (21 months, 1 week ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-3-RELEASE,
netbsd-9-2-RELEASE
Changes since 1.175.2.2: +3 -3
lines
Diff to previous 1.175.2.2 (colored) to branchpoint 1.175 (colored) next main 1.176 (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.182 / (download) - annotate - [select for diffs], Sun Apr 4 13:24:07 2021 UTC (22 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.181: +3 -3
lines
Diff to previous 1.181 (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.181 / (download) - annotate - [select for diffs], Thu Aug 20 23:09:56 2020 UTC (2 years, 5 months ago) by kre
Branch: MAIN
Changes since 1.180: +25 -2
lines
Diff to previous 1.180 (colored)
Be less conservative about when we do clear_traps() when we have traps_invalid (that is, when we actually nuke the parent shell's caught traps in a subshell). This allows more reasonable use of "trap -p" (and similar) in subshells than existed before (and in particular, that command can be in a function now - there can also be several related commands like traps=$(trap -p INT; trap -p QUIT; trap -p HUP) A side effect of all of this is that (eval "$(trap -p)"; ...) now allows copying caught traps into a subshell environment, if desired. Also att the ksh93 variant (the one not picked by POSIX as it isn't generally as useful) of "trap -p" (but call it "trap -P" which extracts just the trap action for named signals (giving more than one is usually undesirable). This allows eval "$(trap -P INT)" to run the action for SIGINT traps, without needing to attempt to parse the "trap -p" output.
Revision 1.180 / (download) - annotate - [select for diffs], Thu May 14 08:34:17 2020 UTC (2 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.179: +3 -3
lines
Diff to previous 1.179 (colored)
Remove extra semicolon.
Revision 1.179 / (download) - annotate - [select for diffs], Thu Apr 23 09:01:33 2020 UTC (2 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.178: +2 -3
lines
Diff to previous 1.178 (colored)
Stop forcing the -e option off in the subshell createds for a command substitution. This was inherited in the big "-e" fixup patch set (rev 1.50) of Jan 2000, which came from dash. dash no longer acts this way.
Revision 1.155.2.4 / (download) - annotate - [select for diffs], Tue Apr 21 19:37:34 2020 UTC (2 years, 9 months ago) by martin
Branch: phil-wifi
Changes since 1.155.2.3: +2 -2
lines
Diff to previous 1.155.2.3 (colored) to branchpoint 1.155 (colored) next main 1.156 (colored)
Ooops, restore accidently removed files from merge mishap
Revision 1.155.2.3, Tue Apr 21 18:41:06 2020 UTC (2 years, 9 months ago) by martin
Branch: phil-wifi
Changes since 1.155.2.2: +2 -2
lines
FILE REMOVED
Sync with HEAD
Revision 1.155.2.2 / (download) - annotate - [select for diffs], Wed Apr 8 14:03:04 2020 UTC (2 years, 10 months ago) by martin
Branch: phil-wifi
Changes since 1.155.2.1: +25 -15
lines
Diff to previous 1.155.2.1 (colored) to branchpoint 1.155 (colored)
Merge changes from current as of 20200406
Revision 1.178 / (download) - annotate - [select for diffs], Tue Feb 4 16:06:59 2020 UTC (3 years ago) by kre
Branch: MAIN
CVS Tags: phil-wifi-20200421,
phil-wifi-20200411,
phil-wifi-20200406,
is-mlppp-base,
is-mlppp
Changes since 1.177: +10 -6
lines
Diff to previous 1.177 (colored)
After bug report 262 (from 2010) https://austingroupbugs.net/view.php?id=252 the Austin Group decided to require processing of "--" by the "." and "exec" commands to solve a problem where some shells did option processing for those commands (permitted) and others did not (also permitted) which left no safe way to process a file with a name beginning with "-". This has finally made its way into what will be the next version of the POSIX standard. Since this shell did no option processing at all for those commands, we need to update. This is that update. The sole effect is that a "--" 'option' (to "." or "exec") is ignored. This means that if you want to use "--" as the arg to one of those commands, it needs to be given twice ". -- --". Apart from that there should be no difference at all (though the "--" can now be used in other situations, where we did not require it before, and still do not).
Revision 1.175.2.2 / (download) - annotate - [select for diffs], Thu Dec 26 20:16:47 2019 UTC (3 years, 1 month ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-1-RELEASE,
netbsd-9-0-RELEASE,
netbsd-9-0-RC2
Changes since 1.175.2.1: +5 -4
lines
Diff to previous 1.175.2.1 (colored) to branchpoint 1.175 (colored)
Pull up following revision(s) (requested by kre in ticket #582): bin/sh/eval.c: revision 1.177 Use fork() rather than vfork() when forking to run a background process with redirects. If we use vfork() and a redirect hangs (eg: opening a fifo) which the parent was intended to unhang, then the parent never gets to continue to unhang the child. eg: mkfifo f; cat <f &; echo foo>f The parent should not be waiting for a background process, even just for its exec() to complete. if there are no redirects there is (should be) nothing left that might be done that will cause any noticeable delay, so vfork() should be safe in all other cases.
Revision 1.177 / (download) - annotate - [select for diffs], Sat Dec 21 18:54:15 2019 UTC (3 years, 1 month ago) by kre
Branch: MAIN
Changes since 1.176: +5 -4
lines
Diff to previous 1.176 (colored)
Use fork() rather than vfork() when forking to run a background process with redirects. If we use vfork() and a redirect hangs (eg: opening a fifo) which the parent was intended to unhang, then the parent never gets to continue to unhang the child. eg: mkfifo f; cat <f &; echo foo>f The parent should not be waiting for a background process, even just for its exec() to complete. if there are no redirects there is (should be) nothing left that might be done that will cause any noticeable delay, so vfork() should be safe in all other cases.
Revision 1.175.2.1 / (download) - annotate - [select for diffs], Wed Dec 11 14:52:50 2019 UTC (3 years, 1 month ago) by martin
Branch: netbsd-9
Changes since 1.175: +14 -9
lines
Diff to previous 1.175 (colored)
Pull up following revision(s) (requested by kre in ticket #542): bin/sh/eval.c: revision 1.176 bin/sh/trap.c: revision 1.53 PR bin/54743 Having traps set should not enforce a fork for the next command, whatever that command happens to be, only for commands which would normally fork if they weren't the last command expected to be executed (ie: builtins and functions shouldn't be exexuted in a sub-shell merely because a trap is set). As it was (for example) trap 'whatever' SIGANY; wait $anypid was guaranteed to fail the wait, as the subshell it was executed in could not have any children. XXX pullup -9 PR bin/54743 If a builtin command or function is the final command intended to be executed, and is interrupted by a caught signal, the trap handler for that signal was not executed - the shell simply exited (an exit trap handler would still have been run - if there was one the handler for the signal may have been invoked during the execution of the exit trap handler, which, if it happened, is incorrect sequencing). Now, if we're exiting, and there are pending signals, run their handlers just before running the EXIT trap handler, if any. There are almost certainly plenty more issues with traps that need solving. Later, XXX pullup -9 (-8 is too different in this area, and this problem suitably obscure, that we won't bother) (the -7 sh is simply obsolete).
Revision 1.176 / (download) - annotate - [select for diffs], Mon Dec 9 00:14:24 2019 UTC (3 years, 2 months ago) by kre
Branch: MAIN
Changes since 1.175: +14 -9
lines
Diff to previous 1.175 (colored)
PR bin/54743 Having traps set should not enforce a fork for the next command, whatever that command happens to be, only for commands which would normally fork if they weren't the last command expected to be executed (ie: builtins and functions shouldn't be exexuted in a sub-shell merely because a trap is set). As it was (for example) trap 'whatever' SIGANY; wait $anypid was guaranteed to fail the wait, as the subshell it was executed in could not have any children. XXX pullup -9
Revision 1.155.2.1 / (download) - annotate - [select for diffs], Mon Jun 10 21:41:03 2019 UTC (3 years, 8 months ago) by christos
Branch: phil-wifi
Changes since 1.155: +353 -180
lines
Diff to previous 1.155 (colored)
Sync with HEAD
Revision 1.175 / (download) - annotate - [select for diffs], Sat May 4 02:52:55 2019 UTC (3 years, 9 months ago) by kre
Branch: MAIN
CVS Tags: phil-wifi-20191119,
phil-wifi-20190609,
netbsd-9-base,
netbsd-9-0-RC1
Branch point for: netbsd-9
Changes since 1.174: +4 -2
lines
Diff to previous 1.174 (colored)
When a return occurs in the test part of a loop statement (while/until) (inside a function or dot script) the exit status of that return statement should become the exit status of the function (or dot script) - we were ignoring it, That is fn() { while return 7; do return 9; done; return 11; } should exit with status 7. It was exiting 0. This is apparently another old ash bug that has been fixed everywhere else in the past. Issue pointed out by Martijn Dekker, (fairly obvious) fix borrowed from FreeBSD, due for return sometime next century.
Revision 1.174 / (download) - annotate - [select for diffs], Sat Feb 9 09:17:59 2019 UTC (4 years ago) by kre
Branch: MAIN
Changes since 1.173: +12 -2
lines
Diff to previous 1.173 (colored)
DEBUG mode build changes - add extra trace output. NFC for any normal shell build.
Revision 1.173 / (download) - annotate - [select for diffs], Sat Feb 9 09:15:22 2019 UTC (4 years ago) by kre
Branch: MAIN
Changes since 1.172: +2 -3
lines
Diff to previous 1.172 (colored)
Delete extern decl for trap[] - hasn't been needed for a while now.
Revision 1.172 / (download) - annotate - [select for diffs], Sat Feb 9 03:35:55 2019 UTC (4 years ago) by kre
Branch: MAIN
Changes since 1.171: +8 -10
lines
Diff to previous 1.171 (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.171 / (download) - annotate - [select for diffs], Mon Feb 4 11:16:41 2019 UTC (4 years ago) by kre
Branch: MAIN
Changes since 1.170: +19 -2
lines
Diff to previous 1.170 (colored)
PR bin/53919 Suppress shell error messages while expanding $ENV (which also causes errors while expanding $PS1 $PS2 and $PS4 to be suppressed as well). This allows any random garbage that happens to be in ENV to not cause noise when the shell starts (which is effectively all it did). On a parse error (for any of those vars) we also use "" as the result, which will be a null prompt, and avoid attempting to open any file for ENV. This does not in any way change what happens for a correctly parsed command substitution (either when it is executed when permitted for one of the prompts, or when it is not (which is always for ENV)) and commands run from those can still produce error output (but shell errors remain suppressed).
Revision 1.153.2.8 / (download) - annotate - [select for diffs], Sat Jan 26 21:58:12 2019 UTC (4 years ago) by pgoyette
Branch: pgoyette-compat
CVS Tags: pgoyette-compat-merge-20190127
Changes since 1.153.2.7: +24 -3
lines
Diff to previous 1.153.2.7 (colored) to branchpoint 1.153 (colored) next main 1.154 (colored)
Sync with HEAD
Revision 1.170 / (download) - annotate - [select for diffs], Mon Jan 21 14:18:59 2019 UTC (4 years ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-20190127
Changes since 1.169: +24 -3
lines
Diff to previous 1.169 (colored)
When we are about to execute something, and the traps are invalid (which means this is the very first execution in a new subshell) clear the traps completely, unless the command is "trap". We were allowing any special builtin, which was probably harmless, but not intended. Also (though not required) permit "command trap" and "eval trap" and combinations thereof, because they might be useful, and there is no particular reason why not. This is all a part of making t=$(trap) work as POSIX requires, but almost nothing beyond that. The "trap" command must be alone (modulo eval and command) in the subshell for the exception to apply, no t=$(trap; echo) or anything like that. Martijn Dekker asked for "command trap" to work (no idea why though, it converts "trap" from being a special builtin, to a normal one, which means an error won't cause the shell to exit ... if there's an error, the "trap" command won't do anything useful, and as we permit no more commands (for this special treatment) the shell is going to exit anyway, this difference is not really significant.
Revision 1.153.2.7 / (download) - annotate - [select for diffs], Fri Jan 18 08:48:24 2019 UTC (4 years ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.153.2.6: +8 -4
lines
Diff to previous 1.153.2.6 (colored) to branchpoint 1.153 (colored)
Synch with HEAD
Revision 1.169 / (download) - annotate - [select for diffs], Wed Jan 9 10:57:43 2019 UTC (4 years, 1 month ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-20190118
Changes since 1.168: +8 -4
lines
Diff to previous 1.168 (colored)
When an error occurs in a builtin from which we do not exit (a normal builtin, though those are not genrally an issue for this problem, or a special builtin that has been prefixed by "command") make sure that we discard any pending input that might have been queued up, but not yet processed. We had the mechanism to fix this from when expansion of PS1 etc was added (which has a similar problem to deal with) - all taken from FreeBSD - but did not bother to use it here until now... This fixes an error detected by newly added ATF tests of the eval builtin, where eval 'syntax error another command' would go ahead and evaluate "another command" which should not happen (note: only when there was a \n between the two).
Revision 1.153.2.6 / (download) - annotate - [select for diffs], Wed Dec 26 14:01:03 2018 UTC (4 years, 1 month ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.153.2.5: +54 -31
lines
Diff to previous 1.153.2.5 (colored) to branchpoint 1.153 (colored)
Sync with HEAD, resolve a few conflicts
Revision 1.168 / (download) - annotate - [select for diffs], Mon Dec 3 06:43:19 2018 UTC (4 years, 2 months ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-1226
Changes since 1.167: +23 -4
lines
Diff to previous 1.167 (colored)
Cleanup traps a bit - attempt to handle weird uses in traps, such as traps that issue break/continue/return to cause the loop/function executing when the trap occurred to break/continue/return, and generating the correct exit code from the shell including when a signal is caught, but the trap handler for it exits. All that from FreeBSD. Also make T=$(trap) work as it is supposed to (also trap -p). For now this is handled by the same technique as $(jobs) - rather than clearing the traps in subshells, just mark them invalid, and then whenever they're invalid, clear them before executing anything other than the special blessed "trap" command. Eventually we will handle these using non-subshell command substitution instead (not creating a subshell environ when the commands in a command-sub alter nothing in the environment).
Revision 1.167 / (download) - annotate - [select for diffs], Mon Dec 3 06:42:25 2018 UTC (4 years, 2 months ago) by kre
Branch: MAIN
Changes since 1.166: +7 -6
lines
Diff to previous 1.166 (colored)
Fix "export -x" (and its consequences) to behave as originally intended (and as documented) rather than how it has been behaving (which was not very rational.) Since it is unlikely that anyone is using this, the change should be mostly invisible. While here, a couple of other minor cleanups: . One call of geteuid() is enough in choose_ps1() . Fix a typo in a comment . Improve appearance (whitspace changes) in find_var()
Revision 1.166 / (download) - annotate - [select for diffs], Mon Dec 3 06:40:26 2018 UTC (4 years, 2 months ago) by kre
Branch: MAIN
Changes since 1.165: +6 -20
lines
Diff to previous 1.165 (colored)
Revamp aliases - as dumb an idea as they are, if we're going to have them, they should work as documented, not cause core dumps, reference after free, incorrect replacements, failing to implement alias after alias, ... The big comment that ended: This is a good idea ------- ***NOT*** and the hack it was describing are gone. Note that most of this was from original CVS version 1.1 code (ie: came from the original import, even before 4.4-Lite was merged. That is, May 1994. And no-one in 24.5 years noticed (or at least complained about) all the bugs (or at least, most of them)). With these changes, aliases ought to work (if you can call it that) as they are expected to by POSIX. Now if only we could get POSIX to delete them (or make them optional)... Changes partly inspired by similar changes made by FreeBSD, (as was the previous change to alias.c, forgot ack in commit log for that one, apologies) but done a little differently, and perhaps with a slightly better outcome.
Revision 1.165 / (download) - annotate - [select for diffs], Fri Nov 30 23:22:45 2018 UTC (4 years, 2 months ago) by kre
Branch: MAIN
Changes since 1.164: +3 -3
lines
Diff to previous 1.164 (colored)
It is not only the EXIT trap we need to check for when deciding no fork is required, but any trap (dumb mistake...) XXX - include in 48875 pullup to -8
Revision 1.164 / (download) - annotate - [select for diffs], Mon Nov 26 13:47:39 2018 UTC (4 years, 2 months ago) by kre
Branch: MAIN
Changes since 1.163: +23 -6
lines
Diff to previous 1.163 (colored)
Make it be that an empty command is treated as a regular builtin for the purposes of any redirects it might have -- ie: as posix requires, make the redirects appear to have been executed in a subshell environment, so if one fails, aside from a diagnositc msg, all the running script sees is a command that failed ($? != 0), rather that having the shell exit which used to happen (the empty command was being treated as a special builtin). Continue to treat the empty command as special for the purposes of var assigns it might contain (those are not executed in a sub-shell and persist) - an error there (eg: assigning to a readonly var) will continue to cause the shell (non-interactive shell) to exit. This makes the NetBSD shell behave like all other (reasonably modern) shells - fix method (not the implementation, details differ) taken from FreeBSD who fixed this back in early 2010. Problem pointed out in (non-list) mail by Martijn Dekker.
Revision 1.153.2.5 / (download) - annotate - [select for diffs], Mon Nov 26 01:49:54 2018 UTC (4 years, 2 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.153.2.4: +4 -2
lines
Diff to previous 1.153.2.4 (colored) to branchpoint 1.153 (colored)
Sync with HEAD, resolve a couple of conflicts
Revision 1.163 / (download) - annotate - [select for diffs], Fri Nov 23 23:37:22 2018 UTC (4 years, 2 months ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-1126
Changes since 1.162: +4 -2
lines
Diff to previous 1.162 (colored)
Handle eval $'continue\ncommand' (and similar) in a loop correctly ... "command" should not be executed. (The issue affects multi-line eval strings only - ie: commands after the next \n are not skipped). Bug noted by Martijn Dekker in off-list e-mail. Fix from FreeBSD: src/bin/sh/eval.c: Revision 272983 Sun Oct 12 13:12:06 2014 UTC by jilles
Revision 1.153.2.4 / (download) - annotate - [select for diffs], Sat Oct 20 06:58:15 2018 UTC (4 years, 3 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.153.2.3: +4 -4
lines
Diff to previous 1.153.2.3 (colored) to branchpoint 1.153 (colored)
Sync with head
Revision 1.162 / (download) - annotate - [select for diffs], Tue Oct 9 02:43:41 2018 UTC (4 years, 4 months ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-1020
Changes since 1.161: +4 -4
lines
Diff to previous 1.161 (colored)
When (about to) send the -x output for the end of a compound command (which has redirects, and so is included in -x output) use the -x/+x setting that existed when the comoound started, so if the state of xtrace changes during the command we don't end up with just half of the -x output (either the intro, or the conclusion, depending on which way the change happened). [this also happens to avoid a core dump in the previous code, but that could have been done other ways, this way actually simplifies things (less code)]
Revision 1.153.2.3 / (download) - annotate - [select for diffs], Thu Sep 6 06:51:32 2018 UTC (4 years, 5 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.153.2.2: +246 -149
lines
Diff to previous 1.153.2.2 (colored) to branchpoint 1.153 (colored)
Sync with HEAD Resolve a couple of conflicts (result of the uimin/uimax changes)
Revision 1.140.2.7 / (download) - annotate - [select for diffs], Sat Aug 25 17:14:38 2018 UTC (4 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.140.2.6: +2 -3
lines
Diff to previous 1.140.2.6 (colored) to branchpoint 1.140 (colored) next main 1.141 (colored)
Fix merge mishap due to #983 / #989 pullup order.
Revision 1.140.2.6 / (download) - annotate - [select for diffs], Sat Aug 25 14:48:22 2018 UTC (4 years, 5 months ago) by martin
Branch: netbsd-8
Changes since 1.140.2.5: +3 -3
lines
Diff to previous 1.140.2.5 (colored) to branchpoint 1.140 (colored)
Pull up following revision(s) (requested by kre in ticket #989): bin/sh/eval.c: revision 1.156 bin/sh/eval.h: revision 1.20 bin/sh/exec.c: revision 1.53 Fix several bugs in the command / type builtin ( including PR bin/48499 ) 1. Make command -pv (and -pV) work (which is not as easy as the PR suggests it might be (the "check and cause error" was there because it did not work, not in order to prevent it from working). 2. Stop -v and -V being both used (that makes no sense). 3. Stop the "type" builtin inheriting the args (-pvV) that "command" has (which it did, as when -v -or -V is used with command, it and type are implemented using the same code). 4. make "command -v word" DTRT for sh keywords (was treating them as an error). 5. Require at least one arg for "command -[vV]" or "type" else usage & error. Strictly this should also apply to "command" and "command -p" (no -v) but that's handled elsewhere, so perhaps some other time. Perhaps "command -v" (and -V) should be limited to 1 command name (where "type" can have many) as in the POSIX definitions, but I don't think that matters. 6. With "command -V alias", (or "type alias" which is the same thing), (but not "command -v alias") alter the output format, so we get ll is an alias for: ls -al instead of the old ll is an alias for ls -al (and note there was a space, for some reason, after "for") That is, unless the alias value contains any \n characters, in which case (something approximating) the old multi-line format is retained. Also note: that if code wants to parse/use the value of an alias, it should be using the output of "alias name", not command or type. Note that none of the above affects "command [-p] cmd" (no -v or -V options) only "command -[vV]" and "type". Note also that the changes to eval.[ch] are merely to make syspath() visible in exec.c rather than static in eval.c
Revision 1.140.2.5 / (download) - annotate - [select for diffs], Sat Aug 25 14:22:49 2018 UTC (4 years, 5 months ago) by martin
Branch: netbsd-8
Changes since 1.140.2.4: +17 -26
lines
Diff to previous 1.140.2.4 (colored) to branchpoint 1.140 (colored)
Pull up following revision(s) (requested by kre in ticket #983): bin/sh/eval.c: revision 1.158 bin/sh/eval.h: revision 1.21 bin/sh/main.c: revision 1.74 PR bin/48875 Revert the changes that were made 19 May 2016 (principally eval.c 1.125) and the bug fixes in subsequent days (eval.c 1.126 and 1.127) and also update some newer code that was added more recently which acted in accordance with those changes (make that code be as it would have been if the changes now being reverted had never been made). While the changes made did solve the problem, in a sense, they were never correct (see the PR for some discussion) and it had always been intended that they be reverted. However, in practical sh code, no issues were reported - until just recently - so nothing was done, until now... After this commit, the validate_fn_redirects test case of the sh ATF test t_redir will fail. In particular, the subtest of that test case which is described in the source (of the test) as: This one is the real test for PR bin/48875 will fail. Alternative changes, not to "fix" the problem in the PR, but to often avoid it will be coming very soon - after which that ATF test will succeed again. XXX pullup-8
Revision 1.140.2.4 / (download) - annotate - [select for diffs], Sat Aug 25 11:45:40 2018 UTC (4 years, 5 months ago) by martin
Branch: netbsd-8
Changes since 1.140.2.3: +16 -6
lines
Diff to previous 1.140.2.3 (colored) to branchpoint 1.140 (colored)
Pull up following revision(s) (requested by kre in ticket #982): bin/sh/eval.c: revision 1.157 PR bin/42184 PR bin/52687 (detailing the same bug). Fix "command not found" handling so that the error message goes to stderr (after any redirections are applied). More importantly, in foo > /tmp/junk /tmp/junk should be created, before any attempt is made to execute (the assumed non-existing) "foo". All this was always true for any command (not found command) containing a / in its name foo/bar >/tmp/junk 2>>/tmp/errs would have created /tmp/junk, then complained (in /tmp/errs) about foo/bar not being found. Now that happens for ordinary commands as well. The fix (which I found when I saw differences between our code and FreeBSD's, where, for the benefit of PR 42184, this has been fixed, sometime in the past 9 years) is frighteningly simple. Simply do not short circuit execution (or print any error) when the initial lookup fails to find the command - it will fail anyway when we actually try running it. The cost is a (seemingly unnecessary, except that it really is) fork in this case. This is what I had been planning, but I expected it would be much more difficult than it turned out.... XXX pullup-8
Revision 1.161 / (download) - annotate - [select for diffs], Sat Aug 25 02:42:49 2018 UTC (4 years, 5 months ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-0930,
pgoyette-compat-0906
Changes since 1.160: +4 -3
lines
Diff to previous 1.160 (colored)
PR bin/53548 Deal with the new shell internal exit reason EXEXIT in the case of a shell which has vfork()'d. It takes a peculiar set of circumstances to get into a situation where this is ever relevant, but it can be done. See the PR for details.
Revision 1.160 / (download) - annotate - [select for diffs], Wed Aug 22 20:08:54 2018 UTC (4 years, 5 months ago) by kre
Branch: MAIN
Changes since 1.159: +2 -2
lines
Diff to previous 1.159 (colored)
Fix (hopefully) the problem reported on current-users by Patrick Welche. we had incorrect usage of setstackmark()/popstackmark() There was an ancient idiom (imported from CSRG in 1993) where code can do: setstackmark(&smark); loop until whatever condition { /* do lots of code */ popstackmark(&smark); } popstackmark(&smark); The 1st (inner) popstackmark() resets the stack, conserving memory, The 2nd one is needed just in case the "whatever condition" was never true, and the first one was never executed. This is (was) safe as all popstackmark() did was reset the stack. That could be done over and over again with no harm. That is, until 2000 when a fix from FreeBSD for another problem was imported. That connected all the stack marks as a list (so they can be located). That caused the problem, as the idiom was not changed, now there is this list of marks, and popstackmark() was removing an entry. It rarely (never?) caused any problems as the idiom was rarely used (the shell used to do loops like above, mostly, without the inner popstackmark()). Further, the stack mark list is only ever used when a memory block is realloc'd. That is, until last weekend - with the recent set of changes. Part of that copied code from FreeBSD introduced the idiom above into more functions - functions used much more, and with a greater possibility of stack marks being set on blocks that are realloc'd and so cause the problem. In the FreeBSD code, they changed the idiom, and always do a setstackmark() immediately after the inner popstackmark(). But not for reasons related to a list of stack marks, as in the intervening period, FreeBSD deleted that, but for another reason. We do not have their issue, and I did not believe that their updated idiom was needed (I did some analysis of exactly this issue - just missed the important part!), and just continued using the old one. Hence Patrick's core dump.... The solution used here is to split popstackmark() into 2 halves, popstackmark() continues to do what it has (recently) done, but is now implemented as a call of (a new func) rststackmark() which does all the original work of popstackmark - but not removing the entry from the stack mark list (which remains in popstackmark()). Then in the idiom above, the inner popstackmark() turns into a call of rststackmark() so the stack is reset, but the stack mark list is unchanged. Tail recursion elimination makes this essentially free.
Revision 1.159 / (download) - annotate - [select for diffs], Sun Aug 19 23:50:27 2018 UTC (4 years, 5 months ago) by kre
Branch: MAIN
Changes since 1.158: +226 -130
lines
Diff to previous 1.158 (colored)
PR bin/48875 (is related, and ameliorated, but not exactly "fixed") Import a whole set of tree evaluation enhancements from FreeBSD. With these, before forking, the shell predicts (often) when all it will have to do after forking (in the parent) is wait for the child and then exit with the status from the child, and in such a case simply does not fork, but rather allows the child to take over the parent's role. This turns out to handle the particular test case from PR bin/48875 in such a way that it works as hoped, rather than as it did (the delay there was caused by an extra copy of the shell hanging around waiting for the background child to complete ... and keeping the command substitution stdout open, so the "real" parent had to wait in case more output appeared). As part of doing this, redirection processing for compound commands gets moved out of evalsubshell() and into a new evalredir(), which allows us to properly handle errors occurring while performing those redirects, and not mishandle (as in simply forget) fd's which had been moved out of the way temporarily. evaltree() has its degree of recursion reduced by making it loop to handle the subsequent operation: that is instead of (for any binop like ';' '&&' (etc)) where it used to evaltree(node->left); evaltree(node->right); return; it now does (kind of) next = node; while ((node = next) != NULL) { next = NULL; if (node is a binary op) { evaltree(node->left); if appropriate /* if && test for success, etc */ next = node->right; continue; } /* similar for loops, etc */ } which can be a good saving, as while the left side (now) tends to be (usually) a simple (or simpleish) command, the right side can be many commands (in a command sequence like a; b; c; d; ... the node at the top of the tree will now have "a" as its left node, and the tree for b; c; d; ... as its right node - until now everything was evaluated recursively so it made no difference, and the tree was constructed the other way). if/while/... statements are done similarly, recurse to evaluate the condition, then if the (or one of the) body parts is to be evaluated, set next to that, and loop (previously it recursed). There is more to do in this area (particularly in the way that case statements are processed - we can avoid recursion there as well) but that can wait for another day. While doing all of this we keep much better track of when the shell is just going to exit once the current tree is evaluated (with a new predicate at_eof() to tell us that we have, for sure, reached the end of the input stream, that is, this shell will, for certain, not be reading more command input) and use that info to avoid unneeded forks. For that we also need another new predicate (have_traps()) to determine of there are any caught traps which might occur - if there are, we need to remain to (potentially) handle them, so these optimisations will not occur (to make the issue in PR 48875 appear again, run the same code, but with a trap set to execute some code when a signal (or EXIT) occurs - note that the trap must be set in the appropriate level of sub-shell to have this effect, any caught traps are cleared in a subshell whenever one is created). There is still work to be done to handle traps properly, whatever weirdness they do (some of which is related to some of this.) These changes do not need man page updates, but 48875 does - an update to sh.1 will be forthcoming once it is decided what it should say... Once again, all the heavy lifting for this set of changes comes directly (with thanks) from the FreeBSD shell. XXX pullup-8 (but not very soon)
Revision 1.158 / (download) - annotate - [select for diffs], Sun Aug 19 11:16:13 2018 UTC (4 years, 5 months ago) by kre
Branch: MAIN
Changes since 1.157: +17 -27
lines
Diff to previous 1.157 (colored)
PR bin/48875 Revert the changes that were made 19 May 2016 (principally eval.c 1.125) and the bug fixes in subsequent days (eval.c 1.126 and 1.127) and also update some newer code that was added more recently which acted in accordance with those changes (make that code be as it would have been if the changes now being reverted had never been made). While the changes made did solve the problem, in a sense, they were never correct (see the PR for some discussion) and it had always been intended that they be reverted. However, in practical sh code, no issues were reported - until just recently - so nothing was done, until now... After this commit, the validate_fn_redirects test case of the sh ATF test t_redir will fail. In particular, the subtest of that test case which is described in the source (of the test) as: This one is the real test for PR bin/48875 will fail. Alternative changes, not to "fix" the problem in the PR, but to often avoid it will be coming very soon - after which that ATF test will succeed again. XXX pullup-8
Revision 1.157 / (download) - annotate - [select for diffs], Tue Aug 14 13:36:42 2018 UTC (4 years, 5 months ago) by kre
Branch: MAIN
Changes since 1.156: +16 -6
lines
Diff to previous 1.156 (colored)
PR bin/42184 PR bin/52687 (detailing the same bug). Fix "command not found" handling so that the error message goes to stderr (after any redirections are applied). More importantly, in foo > /tmp/junk /tmp/junk should be created, before any attempt is made to execute (the assumed non-existing) "foo". All this was always true for any command (not found command) containing a / in its name foo/bar >/tmp/junk 2>>/tmp/errs would have created /tmp/junk, then complained (in /tmp/errs) about foo/bar not being found. Now that happens for ordinary commands as well. The fix (which I found when I saw differences between our code and FreeBSD's, where, for the benefit of PR 42184, this has been fixed, sometime in the past 9 years) is frighteningly simple. Simply do not short circuit execution (or print any error) when the initial lookup fails to find the command - it will fail anyway when we actually try running it. The cost is a (seemingly unnecessary, except that it really is) fork in this case. This is what I had been planning, but I expected it would be much more difficult than it turned out.... XXX pullup-8
Revision 1.153.2.2 / (download) - annotate - [select for diffs], Sat Jul 28 04:32:56 2018 UTC (4 years, 6 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.153.2.1: +3 -3
lines
Diff to previous 1.153.2.1 (colored) to branchpoint 1.153 (colored)
Sync with HEAD
Revision 1.156 / (download) - annotate - [select for diffs], Wed Jul 25 14:42:50 2018 UTC (4 years, 6 months ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-0728
Changes since 1.155: +3 -3
lines
Diff to previous 1.155 (colored)
Fix several bugs in the command / type builtin ( including PR bin/48499 ) 1. Make command -pv (and -pV) work (which is not as easy as the PR suggests it might be (the "check and cause error" was there because it did not work, not in order to prevent it from working). 2. Stop -v and -V being both used (that makes no sense). 3. Stop the "type" builtin inheriting the args (-pvV) that "command" has (which it did, as when -v -or -V is used with command, it and type are implemented using the same code). 4. make "command -v word" DTRT for sh keywords (was treating them as an error). 5. Require at least one arg for "command -[vV]" or "type" else usage & error. Strictly this should also apply to "command" and "command -p" (no -v) but that's handled elsewhere, so perhaps some other time. Perhaps "command -v" (and -V) should be limited to 1 command name (where "type" can have many) as in the POSIX definitions, but I don't think that matters. 6. With "command -V alias", (or "type alias" which is the same thing), (but not "command -v alias") alter the output format, so we get ll is an alias for: ls -al instead of the old ll is an alias for ls -al (and note there was a space, for some reason, after "for") That is, unless the alias value contains any \n characters, in which case (something approximating) the old multi-line format is retained. Also note: that if code wants to parse/use the value of an alias, it should be using the output of "alias name", not command or type. Note that none of the above affects "command [-p] cmd" (no -v or -V options) only "command -[vV]" and "type". Note also that the changes to eval.[ch] are merely to make syspath() visible in exec.c rather than static in eval.c
Revision 1.140.2.3 / (download) - annotate - [select for diffs], Fri Jul 13 14:29:15 2018 UTC (4 years, 6 months ago) by martin
Branch: netbsd-8
CVS Tags: netbsd-8-0-RELEASE
Changes since 1.140.2.2: +8 -5
lines
Diff to previous 1.140.2.2 (colored) to branchpoint 1.140 (colored)
Pull up following revision(s) (requested by kre in ticket #906): bin/sh/eval.c: revision 1.155 bin/sh/mknodes.sh: revision 1.3 bin/sh/nodes.c.pat: revision 1.14 bin/sh/exec.h: revision 1.27 bin/sh/exec.c: revision 1.52 Deal with ref after free found by ASAN when a function redefines itself, or some other function which is still active. This was a long known bug (fixed ages ago in the FreeBSD sh) which hadn't been fixed as in practice, the situation that causes the problem simply doesn't arise .. ASAN found it in the sh dotcmd tests which do have this odd "feature" in the way they are written (but where it never caused a problem, as the tests are so simple that no mem is ever allocated between when the old version of the function was deleted, and when it finished executing, so its code all remained intact, despite having been freed.) The fix is taken from the FreeBSD sh. XXX -- pullup-8 (after a while to ensure no other problems arise).
Revision 1.153.2.1 / (download) - annotate - [select for diffs], Mon Jun 25 07:25:04 2018 UTC (4 years, 7 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.153: +9 -6
lines
Diff to previous 1.153 (colored)
Sync with HEAD
Revision 1.155 / (download) - annotate - [select for diffs], Fri Jun 22 11:04:55 2018 UTC (4 years, 7 months ago) by kre
Branch: MAIN
CVS Tags: phil-wifi-base,
pgoyette-compat-0625
Branch point for: phil-wifi
Changes since 1.154: +8 -5
lines
Diff to previous 1.154 (colored)
Deal with ref after free found by ASAN when a function redefines itself, or some other function which is still active. This was a long known bug (fixed ages ago in the FreeBSD sh) which hadn't been fixed as in practice, the situation that causes the problem simply doesn't arise .. ASAN found it in the sh dotcmd tests which do have this odd "feature" in the way they are written (but where it never caused a problem, as the tests are so simple that no mem is ever allocated between when the old version of the function was deleted, and when it finished executing, so its code all remained intact, despite having been freed.) The fix is taken from the FreeBSD sh. XXX -- pullup-8 (after a while to ensure no other problems arise).
Revision 1.154 / (download) - annotate - [select for diffs], Sun Jun 17 17:19:06 2018 UTC (4 years, 7 months ago) by kre
Branch: MAIN
Changes since 1.153: +3 -3
lines
Diff to previous 1.153 (colored)
NFC: correct typo in a comment.
Revision 1.153 / (download) - annotate - [select for diffs], Sun Nov 19 03:23:01 2017 UTC (5 years, 2 months ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-base,
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: pgoyette-compat
Changes since 1.152: +37 -36
lines
Diff to previous 1.152 (colored)
Implement the -X option - an apparent variant of -x which sends all trace output to the stderr which existed when the -X option was (last) enabled. It also enables tracing by enabling -x (and when reset, +X, also resets the 'x' flag (+x)). Note that it is still -x/+x which actually enables/disables the trace output. Hence "apparent variant" - what -X actually does (aside from setting -x) is just to lock the trace output, rather than having it follow wherever stderr is later redirected.
Revision 1.152 / (download) - annotate - [select for diffs], Fri Sep 29 17:53:57 2017 UTC (5 years, 4 months ago) by kre
Branch: MAIN
Changes since 1.151: +7 -5
lines
Diff to previous 1.151 (colored)
DEBUG only changes (non-debug, ie: normal, shell unaffected) Add a little extra info in a few of the trace messages.
Revision 1.140.2.2 / (download) - annotate - [select for diffs], Sun Jul 23 14:58:14 2017 UTC (5 years, 6 months ago) by snj
Branch: netbsd-8
CVS Tags: netbsd-8-0-RC2,
netbsd-8-0-RC1,
matt-nb8-mediatek-base,
matt-nb8-mediatek
Changes since 1.140.2.1: +143 -74
lines
Diff to previous 1.140.2.1 (colored) to branchpoint 1.140 (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.151 / (download) - annotate - [select for diffs], Fri Jun 30 23:01:21 2017 UTC (5 years, 7 months ago) by kre
Branch: MAIN
CVS Tags: perseant-stdc-iso10646-base,
perseant-stdc-iso10646
Changes since 1.150: +40 -6
lines
Diff to previous 1.150 (colored)
Include redirections in trace output from "set -x"
Revision 1.150 / (download) - annotate - [select for diffs], Mon Jun 19 03:21:31 2017 UTC (5 years, 7 months ago) by kre
Branch: MAIN
Changes since 1.149: +1 -1
lines
Diff to previous 1.149 (colored)
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.
Revision 1.149 / (download) - annotate - [select for diffs], Mon Jun 19 02:51:51 2017 UTC (5 years, 7 months ago) by kre
Branch: MAIN
Changes since 1.148: +3 -3
lines
Diff to previous 1.148 (colored)
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.
Revision 1.148 / (download) - annotate - [select for diffs], Sat Jun 17 11:53:24 2017 UTC (5 years, 7 months ago) by kre
Branch: MAIN
Changes since 1.147: +69 -67
lines
Diff to previous 1.147 (colored)
NFC - DEBUG changes, update this to new TRACE method. KNF - white space and comment formatting.
Revision 1.147 / (download) - annotate - [select for diffs], Sat Jun 17 10:46:34 2017 UTC (5 years, 7 months ago) by kre
Branch: MAIN
Changes since 1.146: +3 -3
lines
Diff to previous 1.146 (colored)
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...
Revision 1.146 / (download) - annotate - [select for diffs], Thu Jun 8 13:12:17 2017 UTC (5 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.145: +2 -14
lines
Diff to previous 1.145 (colored)
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...
Revision 1.145 / (download) - annotate - [select for diffs], Thu Jun 8 02:25:43 2017 UTC (5 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.144: +1 -2
lines
Diff to previous 1.144 (colored)
I am an idiot... revert the previous unintended commit.
Revision 1.144 / (download) - annotate - [select for diffs], Thu Jun 8 02:23:51 2017 UTC (5 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.143: +4 -3
lines
Diff to previous 1.143 (colored)
Improve the (new) LINENO section, markup changes (with thanks to wiz@ for assistace) and some better wording in a few placed.
Revision 1.143 / (download) - annotate - [select for diffs], Wed Jun 7 05:08:32 2017 UTC (5 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.142: +36 -6
lines
Diff to previous 1.142 (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.142 / (download) - annotate - [select for diffs], Wed Jun 7 04:44:17 2017 UTC (5 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.141: +18 -3
lines
Diff to previous 1.141 (colored)
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.
Revision 1.140.2.1 / (download) - annotate - [select for diffs], Mon Jun 5 08:10:24 2017 UTC (5 years, 8 months ago) by snj
Branch: netbsd-8
Changes since 1.140: +3 -3
lines
Diff to previous 1.140 (colored)
Pull up following revision(s) (requested by kre in ticket #5): bin/sh/cd.c: revision 1.48 bin/sh/eval.c: revision 1.141 bin/sh/exec.c: revision 1.48 bin/sh/exec.h: revision 1.25 bin/sh/mail.c: revisions 1.17, 1.18 bin/sh/sh.1: revision 1.147 Make cd (really) do cd -P, and not just claim that is what it is doing while doing a half-hearted, broken, partial, version of cd -L instead. The latter (as the manual says) is not supported, what's more, it is an abomination, and should never be supported (anywhere.) Fix the doc so that the pretense that we notice when a path given crosses a symlink (and turns on printing of the destination directory) is claimed no more (that used to be true until late Dec 2016, but was changed). Now the print happens if -o cdprint is set, or if an entry from CDPATH that is not "" or "." is used (or if the "cd dest repl" cd cmd variant is used.) Fix CDPATH processing: avoid the magic '%' processing that is used for PATH and MAILPATH from corrupting CDPATH. The % magic (both variants) remains undocumented. Also, don't double the '/' if an entry in PATH or CDPATH ends in '/' (as in CDPATH=":/usr/src/"). A "cd usr.bin" used to do chdir("/usr/src//usr.bin"). No more. This is almost invisible, and relatively harmless, either way.... Also fix a bug where if a plausible destination directory in CDPATH was located, but the chdir() failed (eg: permission denied) and then a later "." or "" CDPATH entry succeeded, "print" mode was turned on. That is: cd /tmp; mkdir bin mkdir -p P/bin; chmod 0 P/bin CDPATH=/tmp/P: cd bin would cd to /tmp/bin (correctly) but print it (incorrectly). Also when in "cd dest replace" mode, if the result of the replacement generates '-' as the path named, as in: cd $PWD - then simply change to '-' (or attempt to, with CDPATH search), rather than having this being equivalent to "cd -") Because of these changes, the pwd command (and $PWD) essentially always acts as pwd -P, even when called as pwd -L (which is still the default.) That is, even more than it did before. Also fixed a (kind of minor) mem management error (CDPATH related) "whosoever shall padvance must stunalloc before repeating" (and the same for MAILPATH). -- If we are going to keep the MAILPATH % hack, then at least do something rational. Since it isn't documented, what "rational" is is up for discussion, but what it did before was not it (it was nonsense...).
Revision 1.141 / (download) - annotate - [select for diffs], Sun Jun 4 20:27:14 2017 UTC (5 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.140: +3 -3
lines
Diff to previous 1.140 (colored)
Make cd (really) do cd -P, and not just claim that is what it is doing while doing a half-hearted, broken, partial, version of cd -L instead. The latter (as the manual says) is not supported, what's more, it is an abomination, and should never be supported (anywhere.) Fix the doc so that the pretense that we notice when a path given crosses a symlink (and turns on printing of the destination directory) is claimed no more (that used to be true until late Dec 2016, but was changed). Now the print happens if -o cdprint is set, or if an entry from CDPATH that is not "" or "." is used (or if the "cd dest repl" cd cmd variant is used.) Fix CDPATH processing: avoid the magic '%' processing that is used for PATH and MAILPATH from corrupting CDPATH. The % magic (both variants) remains undocumented. Also, don't double the '/' if an entry in PATH or CDPATH ends in '/' (as in CDPATH=":/usr/src/"). A "cd usr.bin" used to do chdir("/usr/src//usr.bin"). No more. This is almost invisible, and relatively harmless, either way.... Also fix a bug where if a plausible destination directory in CDPATH was located, but the chdir() failed (eg: permission denied) and then a later "." or "" CDPATH entry succeeded, "print" mode was turned on. That is: cd /tmp; mkdir bin mkdir -p P/bin; chmod 0 P/bin CDPATH=/tmp/P: cd bin would cd to /tmp/bin (correctly) but print it (incorrectly). Also when in "cd dest replace" mode, if the result of the replacement generates '-' as the path named, as in: cd $PWD - then simply change to '-' (or attempt to, with CDPATH search), rather than having this being equivalent to "cd -") Because of these changes, the pwd command (and $PWD) essentially always acts as pwd -P, even when called as pwd -L (which is still the default.) That is, even more than it did before. Also fixed a (kind of minor) mem management error (CDPATH related) "whosoever shall padvance must stunalloc before repeating" (and the same for MAILPATH).
Revision 1.131.2.2 / (download) - annotate - [select for diffs], Fri May 19 00:22:50 2017 UTC (5 years, 8 months ago) by pgoyette
Branch: prg-localcount2
Changes since 1.131.2.1: +6 -2
lines
Diff to previous 1.131.2.1 (colored) to branchpoint 1.131 (colored) next main 1.132 (colored)
Resolve conflicts from previous merge (all resulting from $NetBSD keywork expansion)
Revision 1.140 / (download) - annotate - [select for diffs], Sat May 13 03:26:03 2017 UTC (5 years, 8 months ago) by kre
Branch: MAIN
CVS Tags: prg-localcount2-base3,
netbsd-8-base
Branch point for: netbsd-8
Changes since 1.139: +6 -2
lines
Diff to previous 1.139 (colored)
The beginnings of the great shell DEBUG (tracing) upgrade of 2017... First, be aware that the DEBUG spoken of here has nothing whatever to do with MKDEBUG=true type builds of NetBSD. The only way to get a DEBUG shell is to build it yourself manually. That said, for non-DEBUG shells, this change makes only one slight (trivial really) difference, which should affect nothing. Previously some code was defined like ... function(args) { #ifdef DEBUG /* function code goes here */ #endif } and called like ... #ifdef DEBUG function(params); #endif resulting in several empty functions that are never called being defined in non-DEBUG shells. Those are now gone. If you can detect the difference any way other than using "nm" or similar, I'd be very surprised... For DEBUG shells, this introduces a whole new TRACE() setup to use to assist in debugging the shell. I have had this locally (uncommitted) for over a year... it helps. By itself this change is almost useless, nothing really changes, but it provides the framework to allow other TRACE() calls to be updated over time. This is why I had not committed this earlier, my previous version required a flag day, with all the shell's internal tracing being updated a once - which I had done, but that shell version has bit-rotted so badly now it is almost useless... Future updates will add the mechanism to allow the new stuff to actually be used in a productive way, and following that, over time, gradual conversion of all the shell tracing to the updated form (as required, or when I am bored...) The one useful change that we do get now is that the fd that the shell uses for tracing (which was usually 3, but not any more) is now protected from user/script interference, like all the other shell inernal fds. There is no doc (nor will there be) on any of this, if you are not reading the source code it is useless to you, if you are, you know how it works.
Revision 1.131.2.1 / (download) - annotate - [select for diffs], Thu May 11 02:58:28 2017 UTC (5 years, 9 months ago) by pgoyette
Branch: prg-localcount2
Changes since 1.131: +32 -19
lines
Diff to previous 1.131 (colored)
Sync with HEAD
Revision 1.139 / (download) - annotate - [select for diffs], Tue May 9 05:14:03 2017 UTC (5 years, 9 months ago) by kre
Branch: MAIN
CVS Tags: prg-localcount2-base2
Changes since 1.138: +7 -2
lines
Diff to previous 1.138 (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.138 / (download) - annotate - [select for diffs], Tue May 9 04:08:37 2017 UTC (5 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.137: +3 -4
lines
Diff to previous 1.137 (colored)
Remove a now unnecessary (ater the changes in 1.136) clearing of EV_EXIT. (NFC, but should save a byte or two of code space.)
Revision 1.137 / (download) - annotate - [select for diffs], Tue May 9 03:41:18 2017 UTC (5 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.136: +3 -3
lines
Diff to previous 1.136 (colored)
NFC: whitespace (indentation).
Revision 1.136 / (download) - annotate - [select for diffs], Tue May 9 03:38:24 2017 UTC (5 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.135: +8 -7
lines
Diff to previous 1.135 (colored)
Fix some bogus usage of EV_EXIT in evaltree(). Fix (somewhat) inspired by FreeBSD sh (though different, for other reasons) - but the bug discovered while searching for why a (nonsense) attempted test of the forthcoming code to handle "! ! pipeline" properly wasn't working... (it was how I was testing it that was broken, but until I achieved enlightenment, I was bug hunting, and found this...) Most likely the bugs here wouldn't have affected any real code (no bug reports anyway), but ...
Revision 1.135 / (download) - annotate - [select for diffs], Sun May 7 10:37:00 2017 UTC (5 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.134: +4 -2
lines
Diff to previous 1.134 (colored)
POSIX says that the arg to break or continue is to be a positive integer (by which they mean > 0). We were checking for negative numbers, but not for 0. More by chance of the implementation than any specific design (I suspect) "break 0" was being treated the same as "break" or "break 1". Since 3 ways to achieve the same thing is overkill, let's do what posix wants and forbid "break 0" and "continue 0".
Revision 1.134 / (download) - annotate - [select for diffs], Thu May 4 04:37:51 2017 UTC (5 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.133: +16 -8
lines
Diff to previous 1.133 (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.133 / (download) - annotate - [select for diffs], Wed May 3 05:49:54 2017 UTC (5 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.132: +4 -3
lines
Diff to previous 1.132 (colored)
So sayeth posix (of the special builtin "eval"): If there are no arguments, or only null arguments, eval shall return a zero exit status; Make it so. Now: false; eval; echo $? produces 0 instead of 1.
Revision 1.132 / (download) - annotate - [select for diffs], Wed May 3 00:47:29 2017 UTC (5 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.131: +3 -6
lines
Diff to previous 1.131 (colored)
Correct a dsl comment relating to setting $_ - I thought I had done this ages ago, but apparently not...
Revision 1.128.2.2 / (download) - annotate - [select for diffs], Wed Apr 26 02:52:13 2017 UTC (5 years, 9 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.128.2.1: +12 -2
lines
Diff to previous 1.128.2.1 (colored) to branchpoint 1.128 (colored) next main 1.129 (colored)
Sync with HEAD
Revision 1.131 / (download) - annotate - [select for diffs], Sat Apr 22 15:53:17 2017 UTC (5 years, 9 months ago) by kre
Branch: MAIN
CVS Tags: prg-localcount2-base1,
prg-localcount2-base,
pgoyette-localcount-20170426
Branch point for: prg-localcount2
Changes since 1.130: +12 -2
lines
Diff to previous 1.130 (colored)
When -x is set, show assignments to the loop variable in a for loop.
Revision 1.129.2.1 / (download) - annotate - [select for diffs], Fri Apr 21 16:50:42 2017 UTC (5 years, 9 months ago) by bouyer
Branch: bouyer-socketcan
Changes since 1.129: +3 -3
lines
Diff to previous 1.129 (colored) next main 1.130 (colored)
Sync with HEAD
Revision 1.128.2.1 / (download) - annotate - [select for diffs], Mon Mar 20 06:51:32 2017 UTC (5 years, 10 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.128: +4 -3
lines
Diff to previous 1.128 (colored)
Sync with HEAD
Revision 1.130 / (download) - annotate - [select for diffs], Thu Feb 2 19:26:37 2017 UTC (6 years ago) by christos
Branch: MAIN
CVS Tags: pgoyette-localcount-20170320,
bouyer-socketcan-base1
Changes since 1.129: +3 -3
lines
Diff to previous 1.129 (colored)
Who Ride Wit Us?
Revision 1.129 / (download) - annotate - [select for diffs], Tue Jan 10 20:43:08 2017 UTC (6 years ago) by christos
Branch: MAIN
CVS Tags: bouyer-socketcan-base
Branch point for: bouyer-socketcan
Changes since 1.128: +3 -2
lines
Diff to previous 1.128 (colored)
add missing <sys/stat.h>
Revision 1.128 / (download) - annotate - [select for diffs], Wed Jun 1 05:10:41 2016 UTC (6 years, 8 months ago) by kre
Branch: MAIN
CVS Tags: pgoyette-localcount-base,
pgoyette-localcount-20170107,
pgoyette-localcount-20161104,
pgoyette-localcount-20160806,
pgoyette-localcount-20160726,
localcount-20160914
Branch point for: pgoyette-localcount
Changes since 1.127: +34 -12
lines
Diff to previous 1.127 (colored)
PR bin/43639 Redo earlier fix to only prohibit sourcing directories and block special files. char specials (/dev/tty, /dev/null, ... incl /dev/rwd0a) and fifos are OK. Posix actually requires that we find only readable files - that is not yet implemented (doing it sanely, without opening the file twice, is going to take some more modifications to code elsewhere).
Revision 1.127 / (download) - annotate - [select for diffs], Fri May 13 10:32:52 2016 UTC (6 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.126: +8 -3
lines
Diff to previous 1.126 (colored)
More fallout from the fix for PR bin/48875 - this one found just by code reading, rather than any actual real use case failing. With this script f() { echo hello $1 } exec 3>&1 echo $( for i in a b c do echo @$i f >&3 done >/tmp/foo ) echo foo= $(cat /tmp/foo) what should be output is hello hello hello foo= @a @b @c but since the (my) 48875 fix the other day, we've been getting hello @b hello @c hello foo= @a This fixes that. I think (hope) this is the last of these fixes...
Revision 1.126 / (download) - annotate - [select for diffs], Tue May 10 15:14:30 2016 UTC (6 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.125: +3 -3
lines
Diff to previous 1.125 (colored)
PR bin/48875 - minor correction (well, not so minor) - commands in loops must be assumed to have something following, even if the loop itself doesn't, so redirected fd's around func calls need to be saved. Should fix etcupdate
Revision 1.125 / (download) - annotate - [select for diffs], Mon May 9 21:03:10 2016 UTC (6 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.124: +19 -15
lines
Diff to previous 1.124 (colored)
PR bin/48875 - avoid holding (replaced) file descriptors open when running a command in the current shell (so they can be restored for the next command) in cases where it is obvious that there is not going to be a following command to use them. This fixes the problem reported in the PR (though there are still plenty of situations where a FD could be closed but isn't, we do not do full fd flow eveluation to determine whether a fd will be used or not). This is the change that was just committed and then backed out again... OK christos@
Revision 1.124 / (download) - annotate - [select for diffs], Mon May 9 20:55:51 2016 UTC (6 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.123: +15 -19
lines
Diff to previous 1.123 (colored)
Revert previous. These changes are intended to get made (and will be in a minute or two) but not as part of that commit... The log entry certainly does not apply.
Revision 1.123 / (download) - annotate - [select for diffs], Mon May 9 20:50:08 2016 UTC (6 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.122: +19 -20
lines
Diff to previous 1.122 (colored)
Finish the fd reassignment fixes from 1.43 and 1.45 ... if we are moving a fd to an unspecified high fd number, we certainly do not want to hand that high fd off to other processes after an exec, so always set close-on-exec on the result (even if lack of fd's means no fd alteration happens.) This will (eventually) allow some other code that sets close-on-exec to be removed, but for now, doing it twice won't hurt. Also, in a N>&M type redirection, do not set close-on-exec if we don't want it. OK christos@
Revision 1.122 / (download) - annotate - [select for diffs], Tue May 3 13:47:58 2016 UTC (6 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.121: +5 -5
lines
Diff to previous 1.121 (colored)
Fix things so that STATIC can me made static (-DSTATIC=static) and have the shell still compile, link, and run... ok christos@
Revision 1.121 / (download) - annotate - [select for diffs], Tue May 3 03:12:40 2016 UTC (6 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.120: +10 -6
lines
Diff to previous 1.120 (colored)
PR bin/43639 - check that a file being read by the '.' command is a regular file, even when it is given as a full pathname.
Revision 1.120 / (download) - annotate - [select for diffs], Mon May 2 01:46:31 2016 UTC (6 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.119: +8 -22
lines
Diff to previous 1.119 (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.119 / (download) - annotate - [select for diffs], Wed Mar 16 21:20:59 2016 UTC (6 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.118: +3 -3
lines
Diff to previous 1.118 (colored)
Keep redirs for subshells.
Revision 1.118 / (download) - annotate - [select for diffs], Sun Mar 13 15:57:30 2016 UTC (6 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.117: +3 -3
lines
Diff to previous 1.117 (colored)
We want this to work too: $ cat sep1 #!/bin/sh { ./sep2; } 3>out $ cat sep2 #!/bin/sh echo sep2 >&3 $ ./sep1
Revision 1.117 / (download) - annotate - [select for diffs], Sat Mar 12 21:35:13 2016 UTC (6 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.116: +4 -3
lines
Diff to previous 1.116 (colored)
Don't close-on-exec redirections created explicitly for the command being ran; i.e. we want this to work: $ cat succ1 #!/bin/sh ./succ2 6>out $ cat succ2 #!/bin/sh echo succ2 >&6 $ ./succ1 And this to fail: $ cat fail1 #!/bin/sh exec 6> out echo "fail1" >&6 ./fail2 exec 6>&- $ cat fail2 #!obj.amd64/sh echo "fail2" >&6 $ ./fail1 ./fail2: 6: Bad file descriptor XXX: Do we want a -k (keep flag on exec to make redirections not close-on-exec?
Revision 1.116 / (download) - annotate - [select for diffs], Sat Mar 12 14:59:26 2016 UTC (6 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.115: +20 -3
lines
Diff to previous 1.115 (colored)
Improve quoting in the output from sh -x - use less unnecessary quotes ('_' and '.' do not need quoting) and never quote the '=' in an assignment (or it would not be one.) From kre, with some refactoring to be blamed to me.
Revision 1.115 / (download) - annotate - [select for diffs], Mon Feb 29 23:51:36 2016 UTC (6 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.114: +26 -14
lines
Diff to previous 1.114 (colored)
Complete implementation of the noexec option (-n) including disabling noexec, if the shell is interactive, each time that a new command is about to be read. Also correct the -I (ignoreeof) option so that it only applies to interactive shells, as required by posix. (from kre)
Revision 1.114 / (download) - annotate - [select for diffs], Sat Feb 27 18:34:12 2016 UTC (6 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.113: +19 -2
lines
Diff to previous 1.113 (colored)
Improve debugging, from kre (I hooked it to the build).
Revision 1.113 / (download) - annotate - [select for diffs], Wed Feb 24 14:57:12 2016 UTC (6 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.112: +4 -4
lines
Diff to previous 1.112 (colored)
PR/46327: David Mandelberg: Fix exit codes of background jobs (from kre)
Revision 1.112 / (download) - annotate - [select for diffs], Mon Feb 22 20:03:48 2016 UTC (6 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.111: +4 -3
lines
Diff to previous 1.111 (colored)
PR/43255: Make -n apply to the -c string so sh -n -c 'commands' works as it should. Also, other places where the shell parses strings of commands are also now controlled by -n (traps, eval, ...) (from kre)
Revision 1.111 / (download) - annotate - [select for diffs], Mon Jan 4 03:00:24 2016 UTC (7 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.110: +6 -6
lines
Diff to previous 1.110 (colored)
Don't leak redirected rescriptors to exec'ed processes. This is what ksh does, but bash does not. For example: $ cat test1 #!/bin/sh exec 6> out echo "test" >&6 sh ./test2 exec 6>&- $ cat test2 echo "test2" >&6 $ ./test1 ./test2: 6: Bad file descriptor This fixes by side effect the problem of the rc system leaking file descriptors 7 and 8 to all starting daemons: $ fstat -p 1359 USER CMD PID FD MOUNT INUM MODE SZ|DV R/W root powerd 1359 wd / 2 drwxr-xr-x 512 r root powerd 1359 0 / 63029 crw-rw-rw- null rw root powerd 1359 1 / 63029 crw-rw-rw- null rw root powerd 1359 2 / 63029 crw-rw-rw- null rw root powerd 1359 3* kqueue pending 0 root powerd 1359 4 / 64463 crw-r----- power r root powerd 1359 7 flags 0x80034<ISTTY,MPSAFE,LOCKSWORK,CLEAN> root powerd 1359 8 flags 0x80034<ISTTY,MPSAFE,LOCKSWORK,CLEAN> root powerd 1359 9* pipe 0xfffffe815d7bfdc0 -> 0x0 w Note fd=7,8 pointing to the revoked pty from the parent rc process.
Revision 1.110 / (download) - annotate - [select for diffs], Fri Jan 2 19:56:20 2015 UTC (8 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.109: +3 -3
lines
Diff to previous 1.109 (colored)
Define an undocumented -F option to only use fork instead of vfork for debugging purposes.
Revision 1.104.2.3 / (download) - annotate - [select for diffs], Tue Aug 19 23:45:11 2014 UTC (8 years, 5 months ago) by tls
Branch: tls-maxphys
Changes since 1.104.2.2: +132 -20
lines
Diff to previous 1.104.2.2 (colored) to branchpoint 1.104 (colored) next main 1.105 (colored)
Rebase to HEAD as of a few days ago.
Revision 1.108.2.1 / (download) - annotate - [select for diffs], Sun Aug 10 06:41:18 2014 UTC (8 years, 6 months ago) by tls
Branch: tls-earlyentropy
Changes since 1.108: +130 -19
lines
Diff to previous 1.108 (colored) next main 1.109 (colored)
Rebase.
Revision 1.109 / (download) - annotate - [select for diffs], Sat May 31 14:42:18 2014 UTC (8 years, 8 months ago) by christos
Branch: MAIN
CVS Tags: tls-maxphys-base,
tls-earlyentropy-base,
netbsd-7-nhusb-base-20170116,
netbsd-7-nhusb-base,
netbsd-7-nhusb,
netbsd-7-base,
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,
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,
netbsd-7
Changes since 1.108: +130 -19
lines
Diff to previous 1.108 (colored)
PR/48843: Jarmo Jaakkola: dot commands mess up scope nesting tracking Evaluation of commands goes completely haywire if a file containing a break/continue/return command outside its "intended" scope is sourced using a dot command inside its "intended" scope. The main symptom is not exiting from the sourced file when supposed to, leading to evaluation of commands that were not supposed to be evaluated. A secondary symptom is that these extra commands are not evaluated correctly, as some of them are skipped. Some examples are listed in the How-To-Repeat section. According to the POSIX standard, this is how it should work: dot: The shell shall execute commands from the file in the current environment. break: The break utility shall exit from the smallest enclosing for, while, or until loop, [...] continue: The continue utility shall return to the top of the smallest enclosing for, while, or until loop, [...] return: The return utility shall cause the shell to stop executing the current function or dot script. If the shell is not currently executing a function or dot script, the results are unspecified. It is clear that return should return from a sourced file, which it does not do. Whether break and continue should work from the sourced file might be debatable. Because the dot command says "in the current environment", I'd say yes. In any case, it should not fail in weird ways like it does now! The problems occur with return (a) and break/continue (b) because: 1) dotcmd() does not record the function nesting level prior to sourcing the file nor does it touch the loopnest variable, leading to either 2 a) returncmd() being unable to detect that it should not set evalskip to SKIPFUNC but SKIPFILE, or b) breakcmd() setting evalskip to SKIPCONT or SKIPBREAK, leading to 3) cmdloop() not detecting that it should skip the rest of the file, due to only checking for SKIPFILE. The result is that cmdloop() keeps executing lines from the file whilst evalskip is set, which is the main symptom. Because evalskip is checked in multiple places in eval.c, the secondary symptom appears. >How-To-Repeat: Run the following script: printf "break\necho break1; echo break2" >break printf "continue\necho continue1; echo continue2" >continue printf "return\necho return1; echo return2" >return while true; do . ./break; done for i in 1 2; do . ./continue; done func() { . ./return } func No output should be produced, but instead this is the result: break1 continue1 continue1 return1 The main symptom is evident from the unexpected output and the secondary one from the fact that there are no lines with '2' in them. >Fix: Here is patch to src/bin/sh to fix the above problems. It keeps track of the function nesting level at the beginning of a dot command to enable the return command to work properly. I also changed the undefined-by-standard functionality of the return command when it's not in a dot command or function from (indirectly) exiting the shell to being silently ignored. This was done because the previous way has at least one bug: the shell exits without asking for confirmation when there are stopped jobs. Because I read the standard to mean that break and continue should have an effect outside the sourced file, that's how I implemented it. For what it's worth, this also seems to be what bash does. Also laziness, because this way required no changes to loopnesting tracking. If this is not wanted, it might make sense to move the nesting tracking to the inputfile stack. The patch also does some clean-up to reduce the amount of global variables by moving the dotcmd() and the find_dot_file() functions from main.c to eval.c and making in_function() a proper function.
Revision 1.102.2.4 / (download) - annotate - [select for diffs], Thu May 22 11:26:23 2014 UTC (8 years, 8 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.102.2.3: +7 -6
lines
Diff to previous 1.102.2.3 (colored) to branchpoint 1.102 (colored) next main 1.103 (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.108 / (download) - annotate - [select for diffs], Sun Jan 26 22:38:20 2014 UTC (9 years ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base9,
riastradh-xf86-video-intel-2-7-1-pre-2-21-15,
riastradh-drm2-base3
Branch point for: tls-earlyentropy
Changes since 1.107: +6 -4
lines
Diff to previous 1.107 (colored)
explain why forks fail
Revision 1.107 / (download) - annotate - [select for diffs], Thu Jun 27 23:22:04 2013 UTC (9 years, 7 months ago) by yamt
Branch: MAIN
CVS Tags: riastradh-drm2-base2,
riastradh-drm2-base1,
riastradh-drm2-base,
riastradh-drm2
Changes since 1.106: +2 -3
lines
Diff to previous 1.106 (colored)
fix descriptor leaks. PR/47805 this fix was taken from FreeBSD SVN rev 199953 (Jilles Tjoelker) ------------------------------------------------------------------------ r199953 | jilles | 2009-11-30 07:33:59 +0900 (Mon, 30 Nov 2009) | 16 lines Fix some cases where file descriptors from redirections leak to programs. - Redirecting fds that were not open before kept two copies of the redirected file. sh -c '{ :; } 7>/dev/null; fstat -p $$; true' (both fd 7 and 10 remained open) - File descriptors used to restore things after redirection were not set close-on-exec, instead they were explicitly closed before executing a program normally and before executing a shell procedure. The latter must remain but the former is replaced by close-on-exec. sh -c 'exec 7</; { exec fstat -p $$; } 7>/dev/null; true' (fd 10 remained open) The examples above are simpler than the testsuite because I do not want to use fstat or procstat in the testsuite.
Revision 1.104.2.2 / (download) - annotate - [select for diffs], Sun Jun 23 06:26:13 2013 UTC (9 years, 7 months ago) by tls
Branch: tls-maxphys
Changes since 1.104.2.1: +3 -3
lines
Diff to previous 1.104.2.1 (colored) to branchpoint 1.104 (colored)
resync from head
Revision 1.106 / (download) - annotate - [select for diffs], Sat Mar 2 22:02:32 2013 UTC (9 years, 11 months ago) by christos
Branch: MAIN
CVS Tags: khorben-n900,
agc-symver-base,
agc-symver
Changes since 1.105: +3 -3
lines
Diff to previous 1.105 (colored)
PR/47608: Robert Elz: ``var=value func-call'' does not export var in the function (+FIX)
Revision 1.104.2.1 / (download) - annotate - [select for diffs], Mon Feb 25 00:23:52 2013 UTC (9 years, 11 months ago) by tls
Branch: tls-maxphys
Changes since 1.104: +3 -2
lines
Diff to previous 1.104 (colored)
resync with head
Revision 1.102.2.3 / (download) - annotate - [select for diffs], Wed Jan 23 00:04:05 2013 UTC (10 years ago) by yamt
Branch: yamt-pagecache
CVS Tags: yamt-pagecache-tag8
Changes since 1.102.2.2: +3 -2
lines
Diff to previous 1.102.2.2 (colored) to branchpoint 1.102 (colored)
sync with head
Revision 1.105 / (download) - annotate - [select for diffs], Wed Jan 2 22:28:42 2013 UTC (10 years, 1 month ago) by dsl
Branch: MAIN
CVS Tags: yamt-pagecache-base8
Changes since 1.104: +3 -2
lines
Diff to previous 1.104 (colored)
include limits.h for CHAR_MIN
Revision 1.102.2.2 / (download) - annotate - [select for diffs], Tue Oct 30 18:46:08 2012 UTC (10 years, 3 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.102.2.1: +5 -5
lines
Diff to previous 1.102.2.1 (colored) to branchpoint 1.102 (colored)
sync with head
Revision 1.104 / (download) - annotate - [select for diffs], Thu Jun 14 18:56:54 2012 UTC (10 years, 7 months ago) by joerg
Branch: MAIN
CVS Tags: yamt-pagecache-base7,
yamt-pagecache-base6
Branch point for: tls-maxphys
Changes since 1.103: +5 -5
lines
Diff to previous 1.103 (colored)
Make sure temp_path is always initialised, even if mklocal fails. Make sure to restore localvars, even if possibly leaking memory. Discussed with christos@
Revision 1.102.2.1 / (download) - annotate - [select for diffs], Tue Apr 17 00:01:38 2012 UTC (10 years, 9 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.102: +5 -3
lines
Diff to previous 1.102 (colored)
sync with head
Revision 1.103 / (download) - annotate - [select for diffs], Mon Nov 14 18:24:45 2011 UTC (11 years, 2 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base5,
yamt-pagecache-base4,
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,
netbsd-6,
matt-nb6-plus-nbase,
matt-nb6-plus-base,
matt-nb6-plus
Changes since 1.102: +5 -3
lines
Diff to previous 1.102 (colored)
PR/45613: Aleksey Cheusov: /bin/sh: 'set -e' + 'if eval false' problem Fixed from: http://www.freebsd.org/cgi/query-pr.cgi?pr=134881&cat=
Revision 1.102 / (download) - annotate - [select for diffs], Wed Aug 31 16:24:54 2011 UTC (11 years, 5 months ago) by plunky
Branch: MAIN
CVS Tags: yamt-pagecache-base3,
yamt-pagecache-base2,
yamt-pagecache-base
Branch point for: yamt-pagecache
Changes since 1.101: +3 -3
lines
Diff to previous 1.101 (colored)
NULL does not need a cast
Revision 1.100.2.1 / (download) - annotate - [select for diffs], Sat Mar 5 15:08:31 2011 UTC (11 years, 11 months ago) by bouyer
Branch: bouyer-quota2
Changes since 1.100: +6 -6
lines
Diff to previous 1.100 (colored) next main 1.101 (colored)
Sync with HEAD
Revision 1.101 / (download) - annotate - [select for diffs], Thu Feb 17 15:13:49 2011 UTC (11 years, 11 months ago) by pooka
Branch: MAIN
CVS Tags: cherry-xenmp-base,
cherry-xenmp,
bouyer-quota2-nbase
Changes since 1.100: +6 -6
lines
Diff to previous 1.100 (colored)
Tell copyfd if the caller wants the exact tofd to just fd >= tofd. Fixes "echo foo > /rump/bar" in a rump hijacked shell. reviewed by christos
Revision 1.100 / (download) - annotate - [select for diffs], Thu Jun 3 16:14:13 2010 UTC (12 years, 8 months ago) by christos
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231,
bouyer-quota2-base
Branch point for: bouyer-quota2
Changes since 1.99: +3 -2
lines
Diff to previous 1.99 (colored)
need errno for the debug build.
Revision 1.99 / (download) - annotate - [select for diffs], Thu Jun 3 16:06:48 2010 UTC (12 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.98: +3 -3
lines
Diff to previous 1.98 (colored)
set -e is supposed to work inside eval; skip EV_TESTED.
Revision 1.98 / (download) - annotate - [select for diffs], Wed Oct 7 18:12:11 2009 UTC (13 years, 4 months ago) by christos
Branch: MAIN
CVS Tags: matt-premerge-20091211
Changes since 1.97: +3 -3
lines
Diff to previous 1.97 (colored)
only for when trap if we are going to exit.
Revision 1.97 / (download) - annotate - [select for diffs], Tue Oct 6 20:05:10 2009 UTC (13 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.96: +4 -3
lines
Diff to previous 1.96 (colored)
fix regression exit1: Don't exec the last command in a subshell if it has trap[0] (trap EXIT) set. Fork instead to give the shell a chance to execute the trap when it is done.
Revision 1.96 / (download) - annotate - [select for diffs], Mon Jan 19 19:47:11 2009 UTC (14 years ago) by christos
Branch: MAIN
CVS Tags: jym-xensuspend-nbase,
jym-xensuspend-base,
jym-xensuspend
Changes since 1.95: +1 -1
lines
Diff to previous 1.95 (colored)
Revert previous commit that fixes PR/36079 (shell misses exit trap), because the fix causes $! to point to the wrong process in pipelines, which is worse.
Revision 1.95 / (download) - annotate - [select for diffs], Sun Dec 21 03:15:32 2008 UTC (14 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.94: +3 -3
lines
Diff to previous 1.94 (colored)
PR/36079: M. Levinson: Disable the optimization of not forking for the last command in a subshell, otherwise we miss the exit trap.
Revision 1.94 / (download) - annotate - [select for diffs], Fri Oct 31 14:38:42 2008 UTC (14 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.93: +4 -4
lines
Diff to previous 1.93 (colored)
show better quoting output for sh -x, from Aleksey Cheusov
Revision 1.88.4.1 / (download) - annotate - [select for diffs], Thu Sep 4 08:46:10 2008 UTC (14 years, 5 months ago) by skrll
Branch: wrstuden-fixsa
Changes since 1.88: +10 -6
lines
Diff to previous 1.88 (colored) next main 1.89 (colored)
Sync with netbsd-4.
Revision 1.89.6.1 / (download) - annotate - [select for diffs], Mon Jun 23 04:26:44 2008 UTC (14 years, 7 months ago) by wrstuden
Branch: wrstuden-revivesa
Changes since 1.89: +10 -6
lines
Diff to previous 1.89 (colored) next main 1.90 (colored)
Sync w/ -current. 34 merge conflicts to follow.
Revision 1.88.2.1 / (download) - annotate - [select for diffs], Sun Jun 8 20:08:01 2008 UTC (14 years, 8 months ago) by bouyer
Branch: netbsd-4
CVS Tags: wrstuden-fixsa-newbase,
wrstuden-fixsa-base
Changes since 1.88: +10 -6
lines
Diff to previous 1.88 (colored) next main 1.89 (colored)
Pull up following revision(s) (requested by tron in ticket #1157): bin/sh/eval.c: revision 1.90 Port revision 1.44 of "src/bin/sh/eval.c" from FreeBSD to fix PR bin/38584. Reviewed by Michael van Elst.
Revision 1.89.4.1 / (download) - annotate - [select for diffs], Wed Jun 4 02:02:57 2008 UTC (14 years, 8 months ago) by yamt
Branch: yamt-pf42
Changes since 1.89: +10 -6
lines
Diff to previous 1.89 (colored) next main 1.90 (colored)
sync with head
Revision 1.93 / (download) - annotate - [select for diffs], Mon May 26 14:55:17 2008 UTC (14 years, 8 months ago) by tron
Branch: MAIN
CVS Tags: yamt-pf42-base4,
yamt-pf42-base3,
wrstuden-revivesa-base-3,
wrstuden-revivesa-base-2,
wrstuden-revivesa-base-1,
wrstuden-revivesa-base,
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.92: +6 -11
lines
Diff to previous 1.92 (colored)
Revert revisions 1.91 and 1.92. The POSIX spec about the correct behaviour is contradictory at best. And these changes seem to cause more problems that they are worth.
Revision 1.92 / (download) - annotate - [select for diffs], Sat May 24 22:24:32 2008 UTC (14 years, 8 months ago) by tron
Branch: MAIN
Changes since 1.91: +11 -8
lines
Diff to previous 1.91 (colored)
Fix two more cases of bad handling of "set -e": - false && false - false || false
Revision 1.91 / (download) - annotate - [select for diffs], Sat May 24 19:06:43 2008 UTC (14 years, 8 months ago) by tron
Branch: MAIN
Changes since 1.90: +4 -2
lines
Diff to previous 1.90 (colored)
Fix another problem with "set -e": "! true" should terminate the shell.
Revision 1.90 / (download) - annotate - [select for diffs], Sat May 24 17:12:53 2008 UTC (14 years, 8 months ago) by tron
Branch: MAIN
Changes since 1.89: +10 -6
lines
Diff to previous 1.89 (colored)
Port revision 1.44 of "src/bin/sh/eval.c" from FreeBSD to fix PR bin/38584. Reviewed by Michael van Elst.
Revision 1.88.8.1 / (download) - annotate - [select for diffs], Sun Mar 23 00:11:40 2008 UTC (14 years, 10 months ago) by matt
Branch: matt-armv6
Changes since 1.88: +4 -4
lines
Diff to previous 1.88 (colored) next main 1.89 (colored)
sync with HEAD
Revision 1.89 / (download) - annotate - [select for diffs], Fri Feb 15 17:26:06 2008 UTC (14 years, 11 months ago) by matt
Branch: MAIN
CVS Tags: yamt-pf42-baseX,
yamt-pf42-base2,
yamt-pf42-base,
matt-armv6-nbase,
keiichi-mipv6-base,
keiichi-mipv6,
hpcarm-cleanup-nbase,
hpcarm-cleanup-base
Branch point for: yamt-pf42,
wrstuden-revivesa
Changes since 1.88: +4 -4
lines
Diff to previous 1.88 (colored)
Fix inconsistent definitions
Revision 1.88 / (download) - annotate - [select for diffs], Mon Oct 16 00:36:19 2006 UTC (16 years, 3 months ago) by christos
Branch: MAIN
CVS Tags: wrstuden-fixsa-base-1,
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,
matt-mips64-base,
matt-mips64,
matt-armv6-prevmlocking,
matt-armv6-base,
hpcarm-cleanup,
cube-autoconf-base,
cube-autoconf
Branch point for: wrstuden-fixsa,
netbsd-4,
matt-armv6
Changes since 1.87: +10 -16
lines
Diff to previous 1.87 (colored)
sprinkle volatile.
Revision 1.87 / (download) - annotate - [select for diffs], Sat May 13 19:47:22 2006 UTC (16 years, 9 months ago) by christos
Branch: MAIN
CVS Tags: abandoned-netbsd-4-base,
abandoned-netbsd-4
Changes since 1.86: +4 -3
lines
Diff to previous 1.86 (colored)
Coverity CID 3384: Don't close -1.
Revision 1.86 / (download) - annotate - [select for diffs], Tue Apr 18 14:44:05 2006 UTC (16 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.85: +3 -3
lines
Diff to previous 1.85 (colored)
PR/33281: Martin J. Laubach: Prevent core-dump on "echo abc | { }". bash prints and error and ksh prints nothing. We go the ksh way.
Revision 1.85 / (download) - annotate - [select for diffs], Fri Mar 17 17:20:47 2006 UTC (16 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.84: +3 -3
lines
Diff to previous 1.84 (colored)
Coverity CID 2479: Clarify confusion about uninitialized variable in the presence of setjmp/vfork.
Revision 1.84 / (download) - annotate - [select for diffs], Thu Jun 23 23:05:29 2005 UTC (17 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.83: +3 -3
lines
Diff to previous 1.83 (colored)
Revert part of the previous commit. We cannot fix the problem by not waiting. The problem is that the subshell code is not doing redirections properly.
Revision 1.83 / (download) - annotate - [select for diffs], Wed Jun 22 23:32:45 2005 UTC (17 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.82: +5 -5
lines
Diff to previous 1.82 (colored)
Don't wait for a background job in a subshell when we are set to EV_EXIT. While I am here, call forkshell() explicitly FORK_FOO flags instead of depending in FORK_FG == 0 and FORK_BG == 1.
Revision 1.81.2.1 / (download) - annotate - [select for diffs], Mon Jun 13 22:03:51 2005 UTC (17 years, 8 months ago) by tron
Branch: netbsd-3
CVS Tags: 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
Changes since 1.81: +3 -3
lines
Diff to previous 1.81 (colored) next main 1.82 (colored)
Pull up revision 1.82 (requested by lukem in ticket #397): Mark temp_path volatile so that it won't get clobbered after longjmp. (Also appeases gcc -Wuninitialized.)
Revision 1.82 / (download) - annotate - [select for diffs], Wed Jun 1 15:38:32 2005 UTC (17 years, 8 months ago) by lukem
Branch: MAIN
Changes since 1.81: +3 -3
lines
Diff to previous 1.81 (colored)
Mark temp_path volatile so that it won't get clobbered after longjmp. (Also appeases gcc -Wuninitialized.)
Revision 1.81 / (download) - annotate - [select for diffs], Wed Mar 2 20:57:31 2005 UTC (17 years, 11 months ago) by dsl
Branch: MAIN
CVS Tags: netbsd-3-base
Branch point for: netbsd-3
Changes since 1.80: +3 -3
lines
Diff to previous 1.80 (colored)
Fix printing of invalid commandname after certain types of errors on builtins. Fixes bug bin/29410 in head. All of /bin/sh needs pulling up into 2.0
Revision 1.80 / (download) - annotate - [select for diffs], Sat Oct 30 19:29:27 2004 UTC (18 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.79: +4 -3
lines
Diff to previous 1.79 (colored)
Pass WARNS=3
Revision 1.79 / (download) - annotate - [select for diffs], Wed Jun 30 09:32:38 2004 UTC (18 years, 7 months ago) by mycroft
Branch: MAIN
Changes since 1.78: +4 -4
lines
Diff to previous 1.78 (colored)
Make "set -e" once again provide the behavior documented in the man page, which was unnecessarily changed in revision 1.50 while fixing other bugs. That is, exit the shell if the last command in a || or && compound statement is not short-circuited, and exits with a false status. I.e., the following will cause the shell to exit: set -e false || false While this is not the prescribed behavior in SUSv3, it is what our man page documents, and it is what all of the following implementations do: NetBSD /bin/ksh (pdksh) bash zsh Solaris 9 /bin/sh Solaris 9 /usr/xpg4/bin/sh Solaris 9 /usr/bin/ksh Tru64 /bin/sh HP/UX 11 /bin/sh The "standard" seems to be wrong in this instance.
Revision 1.78 / (download) - annotate - [select for diffs], Sat Jun 26 22:09:49 2004 UTC (18 years, 7 months ago) by dsl
Branch: MAIN
Changes since 1.77: +5 -3
lines
Diff to previous 1.77 (colored)
Correctly apply IFS to unquoted text in ${x-text}. Fixes PR/26058 and the 'for i in ${x-a b c}; do ...' and ${x-'a b' c}. I can't find a PR for the latter problem. Regression test goind in shortly.
Revision 1.77 / (download) - annotate - [select for diffs], Sat Jun 26 14:09:58 2004 UTC (18 years, 7 months ago) by dsl
Branch: MAIN
Changes since 1.76: +3 -3
lines
Diff to previous 1.76 (colored)
No functional changes (intended). Rename some variables, add some comments, and restructure a little. In preparation for fixing "set ${x-a b c}" and friends.
Revision 1.76 / (download) - annotate - [select for diffs], Fri Apr 30 06:27:59 2004 UTC (18 years, 9 months ago) by dsl
Branch: MAIN
Changes since 1.75: +31 -5
lines
Diff to previous 1.75 (colored)
Ensure that fd 0, 1 and 2 are not used for the local end of pipelines. Fixes PR bin/25395
Revision 1.75 / (download) - annotate - [select for diffs], Fri Nov 14 10:27:10 2003 UTC (19 years, 3 months ago) by dsl
Branch: MAIN
CVS Tags: 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.74: +3 -3
lines
Diff to previous 1.74 (colored)
Add '\n' to "fork failed" trace messages.
Revision 1.74 / (download) - annotate - [select for diffs], Thu Aug 7 09:05:30 2003 UTC (19 years, 6 months ago) by agc
Branch: MAIN
Changes since 1.73: +3 -7
lines
Diff to previous 1.73 (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.73 / (download) - annotate - [select for diffs], Sun Jul 13 08:31:13 2003 UTC (19 years, 7 months ago) by itojun
Branch: MAIN
Changes since 1.72: +9 -9
lines
Diff to previous 1.72 (colored)
use bounded string op
Revision 1.72 / (download) - annotate - [select for diffs], Thu Jan 23 14:58:07 2003 UTC (20 years ago) by agc
Branch: MAIN
Changes since 1.71: +3 -3
lines
Diff to previous 1.71 (colored)
Make this build on platforms where size_t != int, i.e. sparc, arm, ppc, ...
Revision 1.71 / (download) - annotate - [select for diffs], Thu Jan 23 03:33:16 2003 UTC (20 years ago) by rafal
Branch: MAIN
Changes since 1.70: +3 -3
lines
Diff to previous 1.70 (colored)
Make this build again.
Revision 1.70 / (download) - annotate - [select for diffs], Wed Jan 22 20:36:03 2003 UTC (20 years ago) by dsl
Branch: MAIN
Changes since 1.69: +142 -60
lines
Diff to previous 1.69 (colored)
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)
Revision 1.69 / (download) - annotate - [select for diffs], Mon Nov 25 21:55:58 2002 UTC (20 years, 2 months ago) by agc
Branch: MAIN
CVS Tags: fvdl_fs64_base
Changes since 1.68: +3 -2
lines
Diff to previous 1.68 (colored)
Include <stdio.h> to get the prototype for sprintf(3) - macppc needs this.
Revision 1.68 / (download) - annotate - [select for diffs], Sun Nov 24 22:35:39 2002 UTC (20 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.67: +165 -123
lines
Diff to previous 1.67 (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.67 / (download) - annotate - [select for diffs], Wed Oct 23 19:46:34 2002 UTC (20 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.66: +4 -4
lines
Diff to previous 1.66 (colored)
From David Laight > The wrong process is aborting when variable assignment fails > in the vfork path. So the following command fails to execute > the second echo (shown here with the correct output). > > $ (readonly r; r= /bin/echo a; echo b) > r: is read only > b > > fix: defer the mklocal() to the child shell.
Revision 1.66 / (download) - annotate - [select for diffs], Wed Oct 23 13:25:24 2002 UTC (20 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.65: +4 -4
lines
Diff to previous 1.65 (colored)
Fix interrupt problam from David Laight $ /fred # non existant command $ ^C # stops working He says: Ok the extra INTOFF is the one in exverror(). In almost all cases this doesn't matter because the longjmp()s all end up in main() and the FORCEINTON call sorts it out for the next command. (There are a significant number of INTON/OFF mismatches through the error paths...) In any case the above failure can be 'fixed' by changing 2 (I think they are both needed) INTON calls to FORCEINTON within evalcommand. The following patch seems to work: We should really look in the code and fix the INTON->INTOFF pairs.
Revision 1.65 / (download) - annotate - [select for diffs], Sat Sep 28 01:25:01 2002 UTC (20 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.64: +52 -63
lines
Diff to previous 1.64 (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.64 / (download) - annotate - [select for diffs], Fri Sep 27 22:56:24 2002 UTC (20 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.63: +66 -52
lines
Diff to previous 1.63 (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.63 / (download) - annotate - [select for diffs], Fri Sep 27 21:32:25 2002 UTC (20 years, 4 months ago) by mycroft
Branch: MAIN
Changes since 1.62: +8 -7
lines
Diff to previous 1.62 (colored)
Clean up INTOFF/INTON usage a little -- none of fork{shell,parent,child}() screw with them now, only their callers.
Revision 1.62 / (download) - annotate - [select for diffs], Fri Sep 27 20:24:36 2002 UTC (20 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.61: +5 -2
lines
Diff to previous 1.61 (colored)
Put back charles' fixes from -r1.60
Revision 1.61 / (download) - annotate - [select for diffs], Fri Sep 27 18:56:50 2002 UTC (20 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.60: +81 -16
lines
Diff to previous 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.60 / (download) - annotate - [select for diffs], Fri Sep 27 17:37:12 2002 UTC (20 years, 4 months ago) by mycroft
Branch: MAIN
Changes since 1.59: +6 -7
lines
Diff to previous 1.59 (colored)
In evalpipe(), move the INTOFF after the waitforjob(), to prevent possible race conditions -- now we always synchronously wait for the job to finish. In evalcommand(), add the same INTOFF/INTON locking as evalpipe(), to prevent leaving internal state inconsistent, and also to insure that we synchronously wait for the job.
Revision 1.59 / (download) - annotate - [select for diffs], Wed May 15 16:33:35 2002 UTC (20 years, 9 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.58: +3 -2
lines
Diff to previous 1.58 (colored)
implement noclobber. From Ben Harris, with minor tweaks from me. Two unimplemented comments to go. Go Ben!
Revision 1.58.2.1 / (download) - annotate - [select for diffs], Wed Mar 27 20:37:33 2002 UTC (20 years, 10 months ago) by elric
Branch: ELRICshvfork
Changes since 1.58: +84 -13
lines
Diff to previous 1.58 (colored) next main 1.59 (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.56.4.1 / (download) - annotate - [select for diffs], Sat Feb 23 17:08:17 2002 UTC (20 years, 11 months ago) by he
Branch: netbsd-1-5
CVS Tags: netbsd-1-5-PATCH003
Changes since 1.56: +3 -3
lines
Diff to previous 1.56 (colored) next main 1.57 (colored)
Pull up revision 1.58 (requested by christos): When ``-e'' is in effect, do not exit if the failing command is part of an && or || list, or preceded by the ``!'' reserved word. Fixes PR#11542.
Revision 1.58 / (download) - annotate - [select for diffs], Thu Feb 14 21:51:41 2002 UTC (20 years, 11 months ago) by christos
Branch: MAIN
CVS Tags: ELRICshvfork-base
Branch point for: ELRICshvfork
Changes since 1.57: +3 -3
lines
Diff to previous 1.57 (colored)
PR/11542: Back-out previous change that caused set -e for x in a; do BAR="foo" false && echo true echo mumble done not to echo mumble...
Revision 1.57 / (download) - annotate - [select for diffs], Sun Feb 4 19:52:06 2001 UTC (22 years ago) by christos
Branch: MAIN
Changes since 1.56: +3 -3
lines
Diff to previous 1.56 (colored)
remove redundant declarations and nexted externs.
Revision 1.56 / (download) - annotate - [select for diffs], Mon May 22 10:18:46 2000 UTC (22 years, 8 months ago) by elric
Branch: MAIN
CVS Tags: netbsd-1-5-base,
netbsd-1-5-RELEASE,
netbsd-1-5-PATCH002,
netbsd-1-5-PATCH001,
netbsd-1-5-BETA2,
netbsd-1-5-BETA,
netbsd-1-5-ALPHA2,
minoura-xpg4dl-base,
minoura-xpg4dl
Branch point for: netbsd-1-5
Changes since 1.55: +13 -84
lines
Diff to previous 1.55 (colored)
Back out previous vfork changes.
Revision 1.55 / (download) - annotate - [select for diffs], Wed May 17 07:37:12 2000 UTC (22 years, 8 months ago) by elric
Branch: MAIN
Changes since 1.54: +12 -5
lines
Diff to previous 1.54 (colored)
When vforking ensure that the environment passed to exec is built before vforking as a set of local variables which can be popped by the parent. Addresses bin/10124.
Revision 1.54 / (download) - annotate - [select for diffs], Mon May 15 03:42:48 2000 UTC (22 years, 9 months ago) by elric
Branch: MAIN
Changes since 1.53: +5 -3
lines
Diff to previous 1.53 (colored)
INTON and FORCEINTON modify global variables, and so should not be executed while we are vforked.
Revision 1.53 / (download) - annotate - [select for diffs], Sat May 13 21:11:45 2000 UTC (22 years, 9 months ago) by elric
Branch: MAIN
Changes since 1.52: +5 -2
lines
Diff to previous 1.52 (colored)
Added includes for waitpid, sys/types.h and sys/wait.h.
Revision 1.52 / (download) - annotate - [select for diffs], Sat May 13 20:50:14 2000 UTC (22 years, 9 months ago) by elric
Branch: MAIN
Changes since 1.51: +68 -9
lines
Diff to previous 1.51 (colored)
Now we use vfork(2) instead of fork(2) when we can.
Revision 1.51 / (download) - annotate - [select for diffs], Wed Feb 9 20:26:53 2000 UTC (23 years ago) by christos
Branch: MAIN
Changes since 1.50: +3 -3
lines
Diff to previous 1.50 (colored)
Fix problem where commands that caused exitstatus != 0 inside loops did not cause the shell to exit when -e was set.
Revision 1.50 / (download) - annotate - [select for diffs], Thu Jan 27 23:39:38 2000 UTC (23 years ago) by christos
Branch: MAIN
Changes since 1.49: +25 -18
lines
Diff to previous 1.49 (colored)
Fix bin/9184, bin/9194, bin/9265, bin/9266 Exitcode and negation problems (From Martin Husemann)
Revision 1.47.2.1 / (download) - annotate - [select for diffs], Mon Dec 27 18:27:12 1999 UTC (23 years, 1 month ago) by wrstuden
Branch: wrstuden-devbsize
Changes since 1.47: +2 -2
lines
Diff to previous 1.47 (colored) next main 1.48 (colored)
Pull up to last week's -current.
Revision 1.49 / (download) - annotate - [select for diffs], Wed Oct 13 00:59:10 1999 UTC (23 years, 4 months ago) by mrg
Branch: MAIN
CVS Tags: wrstuden-devbsize-base,
wrstuden-devbsize-19991221,
comdex-fall-1999-base,
comdex-fall-1999
Changes since 1.48: +0 -1
lines
Diff to previous 1.48 (colored)
back out previous; it causes /etc/rc to break on my alpha and other lossage as reported in PR#8614
Revision 1.48 / (download) - annotate - [select for diffs], Sun Oct 10 21:22:24 1999 UTC (23 years, 4 months ago) by pk
Branch: MAIN
Changes since 1.47: +3 -2
lines
Diff to previous 1.47 (colored)
Backtrack `exitstatus' to make the shell really ignore the status of `tested commands' as in this example: set -e true; false && echo "not reached"
Revision 1.47 / (download) - annotate - [select for diffs], Fri Jul 9 03:05:49 1999 UTC (23 years, 7 months ago) by christos
Branch: MAIN
Branch point for: wrstuden-devbsize
Changes since 1.46: +7 -6
lines
Diff to previous 1.46 (colored)
compile with WARNS = 2
Revision 1.45.2.1 / (download) - annotate - [select for diffs], Thu Jul 1 15:20:58 1999 UTC (23 years, 7 months ago) by perry
Branch: netbsd-1-4
CVS Tags: netbsd-1-4-PATCH003,
netbsd-1-4-PATCH002,
netbsd-1-4-PATCH001
Changes since 1.45: +12 -3
lines
Diff to previous 1.45 (colored) next main 1.46 (colored)
pullup 1.45->1.46 (christos)
Revision 1.46 / (download) - annotate - [select for diffs], Sat Jun 26 16:31:47 1999 UTC (23 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.45: +12 -3
lines
Diff to previous 1.45 (colored)
PR/7814: Matthias Scheler: shell does not fork for builtins in backquotes, leading to unexpected behaviour. Disable the no-fork optimization for now. We need to revisit this and keep enough state around to recover from such changes.
Revision 1.45 / (download) - annotate - [select for diffs], Thu Feb 4 16:17:39 1999 UTC (24 years ago) by christos
Branch: MAIN
CVS Tags: netbsd-1-4-base,
netbsd-1-4-RELEASE
Branch point for: netbsd-1-4
Changes since 1.44: +3 -2
lines
Diff to previous 1.44 (colored)
PR/4966: Joel Reicher: Implement <> redirections which are documented in the man page.
Revision 1.44 / (download) - annotate - [select for diffs], Tue Jul 28 11:41:53 1998 UTC (24 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.43: +4 -9
lines
Diff to previous 1.43 (colored)
Be more retentive about use of NOTREACHED and noreturn.
Revision 1.43 / (download) - annotate - [select for diffs], Tue Jul 28 05:31:27 1998 UTC (24 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.42: +5 -3
lines
Diff to previous 1.42 (colored)
Delint.
Revision 1.39.2.1 / (download) - annotate - [select for diffs], Fri May 8 06:01:03 1998 UTC (24 years, 9 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.39: +3 -3
lines
Diff to previous 1.39 (colored) next main 1.40 (colored)
Sync with trunk, per request of christos.
Revision 1.42 / (download) - annotate - [select for diffs], Thu Feb 5 08:34:49 1998 UTC (25 years ago) by christos
Branch: MAIN
Changes since 1.41: +3 -3
lines
Diff to previous 1.41 (colored)
Re-enabled EXP_RECORD
Revision 1.41 / (download) - annotate - [select for diffs], Wed Feb 4 06:25:55 1998 UTC (25 years ago) by mikel
Branch: MAIN
Changes since 1.40: +3 -3
lines
Diff to previous 1.40 (colored)
back out last change until christos fixes EXP_RECORD; PR 4932
Revision 1.40 / (download) - annotate - [select for diffs], Sat Jan 31 12:45:06 1998 UTC (25 years ago) by christos
Branch: MAIN
Changes since 1.39: +3 -3
lines
Diff to previous 1.39 (colored)
PR/4851: Benjamin Lorenz: In the "for <var> in <args>" construct <args> was not marked as a region to be handled by ifsbreakup. Add EXP_RECORD to indicate that the argument string needs to be recorded.
Revision 1.39 / (download) - annotate - [select for diffs], Tue Aug 26 20:09:59 1997 UTC (25 years, 5 months ago) by thorpej
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.38: +3 -3
lines
Diff to previous 1.38 (colored)
Avoid a segv in bltinlookup() reported by Ronald Khoo <ronald@demon.net> in PR #3929, fix submitted by hiroy@NETCOM.COM (Hiroyuki Ito).
Revision 1.38 / (download) - annotate - [select for diffs], Sun Jul 20 21:27:35 1997 UTC (25 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.37: +3 -3
lines
Diff to previous 1.37 (colored)
PR/3888: Chris Demetriou: type command-with-slash prints $PATH[0]/command-with-slash...
Revision 1.37 / (download) - annotate - [select for diffs], Tue Jul 15 17:49:15 1997 UTC (25 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.36: +3 -2
lines
Diff to previous 1.36 (colored)
PR/3866: bayer@informatik.uni-leipzig.de: core dump using xon script. cmdenviron is pointing to varlist.list; varlist gets reset everytime you enter evalcommand, but cmdenviron does not. The wonders of global variables...
Revision 1.36 / (download) - annotate - [select for diffs], Fri Jul 4 21:01:56 1997 UTC (25 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.35: +3 -2
lines
Diff to previous 1.35 (colored)
Fix compiler warnings.
Revision 1.35 / (download) - annotate - [select for diffs], Fri Mar 14 01:42:19 1997 UTC (25 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.34: +5 -5
lines
Diff to previous 1.34 (colored)
NO_HISTORY->SMALL
Revision 1.29.4.2 / (download) - annotate - [select for diffs], Sun Jan 26 04:57:16 1997 UTC (26 years ago) by rat
Branch: netbsd-1-2
CVS Tags: netbsd-1-2-PATCH001
Changes since 1.29.4.1: +36 -25
lines
Diff to previous 1.29.4.1 (colored) to branchpoint 1.29 (colored) next main 1.30 (colored)
Update /bin/sh from trunk per request of Christos Zoulas. Fixes many bugs.
Revision 1.34 / (download) - annotate - [select for diffs], Sat Jan 11 02:04:29 1997 UTC (26 years, 1 month ago) by tls
Branch: MAIN
Changes since 1.33: +3 -3
lines
Diff to previous 1.33 (colored)
kill 'register'
Revision 1.33 / (download) - annotate - [select for diffs], Sat Nov 9 01:04:07 1996 UTC (26 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.32: +2 -3
lines
Diff to previous 1.32 (colored)
remove a debugging printf that was left from the last POSIX error code fixes.
Revision 1.32 / (download) - annotate - [select for diffs], Wed Nov 6 01:17:10 1996 UTC (26 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.31: +3 -2
lines
Diff to previous 1.31 (colored)
Fix miscellaneous getopts problems: - the 3 argument version of getopts would not reset properly - OPTARG did not get cleared after a non argument option was found - OPTIND was not set properly after a non argument option.
Revision 1.31 / (download) - annotate - [select for diffs], Wed Oct 16 14:31:57 1996 UTC (26 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.30: +35 -24
lines
Diff to previous 1.30 (colored)
PR/287: Exit with 127/126 when command is not found/permission denied. PR/2808: don't bomb out on "set -e; false && true"
Revision 1.29.4.1 / (download) - annotate - [select for diffs], Mon Jun 10 19:36:36 1996 UTC (26 years, 8 months ago) by jtc
Branch: netbsd-1-2
CVS Tags: netbsd-1-2-RELEASE,
netbsd-1-2-BETA
Changes since 1.29: +4 -10
lines
Diff to previous 1.29 (colored)
pulled up from version 1.30 at christos' request
Revision 1.30 / (download) - annotate - [select for diffs], Mon Jun 3 12:21:17 1996 UTC (26 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.29: +4 -10
lines
Diff to previous 1.29 (colored)
Fix PR/2504: return with no args returns 0 instead of the return value of the previous command in functions
Revision 1.29 / (download) - annotate - [select for diffs], Wed Mar 6 14:49:29 1996 UTC (26 years, 11 months ago) by pk
Branch: MAIN
CVS Tags: netbsd-1-2-base
Branch point for: netbsd-1-2
Changes since 1.28: +4 -2
lines
Diff to previous 1.28 (colored)
Return zero status if `else' clause is empty.
Revision 1.28 / (download) - annotate - [select for diffs], Tue Mar 5 21:03:52 1996 UTC (26 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.27: +3 -7
lines
Diff to previous 1.27 (colored)
- parser.c: Fix prompting in old style backquote expansion. Fixes PR/2139 and many user complaints why the shell hangs in echo "`" - eval.c: Fix exitstatus invalid resetting in `if' statements were: if (exit 3); then echo foo $? else echo bar $? fi printed 'bar 0' instead of bar 3
Revision 1.27 / (download) - annotate - [select for diffs], Mon Sep 11 17:05:41 1995 UTC (27 years, 5 months ago) by christos
Branch: MAIN
CVS Tags: netbsd-1-1-base,
netbsd-1-1-RELEASE,
netbsd-1-1-PATCH001,
netbsd-1-1
Changes since 1.26: +9 -9
lines
Diff to previous 1.26 (colored)
Fix return builtin to work like it does in ksh: When not in a function, it skips the rest of the current input file. Instances of `return' outside function definitions were previously ignored. What does joe posix have to say about this? [fixes PR/1444]
Revision 1.26 / (download) - annotate - [select for diffs], Fri Jun 9 01:53:44 1995 UTC (27 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.25: +16 -4
lines
Diff to previous 1.25 (colored)
Changed so that 'PATH=newpath command' works, instead of looking at the old path. Synced input.c with vangogh.
Revision 1.25 / (download) - annotate - [select for diffs], Fri May 19 15:08:55 1995 UTC (27 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.24: +5 -5
lines
Diff to previous 1.24 (colored)
Changed so that syntax errors (EXERROR) set the exit status to 2, and commands that are not found set the exit status to 1 like all other bourne shells. [It used to be 0 and 2 respectively]
Revision 1.24 / (download) - annotate - [select for diffs], Mon May 15 03:29:54 1995 UTC (27 years, 9 months ago) by cgd
Branch: MAIN
Changes since 1.23: +3 -2
lines
Diff to previous 1.23 (colored)
re-add an #endif that was (apprently) clobbered.
Revision 1.23 / (download) - annotate - [select for diffs], Mon May 15 02:47:38 1995 UTC (27 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.22: +14 -6
lines
Diff to previous 1.22 (colored)
Fixed new bug the previous fix introduced: false foo=bar echo $? would print 1 Also fixed the long standing bug: false echo `echo $?` would print 0 The exitstatus needs rethinking and rewriting. The trial and error method is not very efficient
Revision 1.22 / (download) - annotate - [select for diffs], Sun May 14 04:19:18 1995 UTC (27 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.21: +19 -18
lines
Diff to previous 1.21 (colored)
Fixed bug caused by previous x=`false` not preserving the exit status fix. The if statement exit status broke...
Revision 1.21 / (download) - annotate - [select for diffs], Thu May 11 21:28:56 1995 UTC (27 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.20: +27 -30
lines
Diff to previous 1.20 (colored)
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0 bug.
Revision 1.20 / (download) - annotate - [select for diffs], Fri Mar 31 21:58:09 1995 UTC (27 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.19: +8 -11
lines
Diff to previous 1.19 (colored)
1. Don't core dump on 'fc -l' (From Gerard J van der Grinten) 2. PATH=xxx ls, does the PATH assignment first and then tries to find ls in xxx 3. VAR=xxx exec ls, does the variable assignment.
Revision 1.19 / (download) - annotate - [select for diffs], Tue Mar 21 09:08:54 1995 UTC (27 years, 10 months ago) by cgd
Branch: MAIN
Changes since 1.18: +7 -2
lines
Diff to previous 1.18 (colored)
convert to new RCS id conventions.
Revision 1.18 / (download) - annotate - [select for diffs], Fri Dec 23 13:24:39 1994 UTC (28 years, 1 month ago) by cgd
Branch: MAIN
Changes since 1.17: +4 -4
lines
Diff to previous 1.17 (colored)
be more careful with casts.
Revision 1.17 / (download) - annotate - [select for diffs], Mon Dec 5 19:07:37 1994 UTC (28 years, 2 months ago) by cgd
Branch: MAIN
Changes since 1.16: +3 -2
lines
Diff to previous 1.16 (colored)
clean up further. more patches from Jim Jegers
Revision 1.16 / (download) - annotate - [select for diffs], Sun Dec 4 07:12:10 1994 UTC (28 years, 2 months ago) by cgd
Branch: MAIN
Changes since 1.15: +40 -10
lines
Diff to previous 1.15 (colored)
from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch some of the worst style errors.
Revision 1.14.2.1 / (download) - annotate - [select for diffs], Wed Aug 24 05:49:23 1994 UTC (28 years, 5 months ago) by mycroft
Branch: netbsd-1-0
CVS Tags: 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
Changes since 1.14: +4 -3
lines
Diff to previous 1.14 (colored) next main 1.15 (colored)
update from trunk
Revision 1.15 / (download) - annotate - [select for diffs], Wed Aug 24 05:48:26 1994 UTC (28 years, 5 months ago) by mycroft
Branch: MAIN
Changes since 1.14: +4 -3
lines
Diff to previous 1.14 (colored)
Fix a core dump and another parse error related to null commands.
Revision 1.14 / (download) - annotate - [select for diffs], Tue Jun 14 05:49:19 1994 UTC (28 years, 8 months ago) by jtc
Branch: MAIN
CVS Tags: netbsd-1-0-base
Branch point for: netbsd-1-0
Changes since 1.13: +15 -6
lines
Diff to previous 1.13 (colored)
From Christos: 1. Fix `-' quoting in [ ] expressions. 2. Fix expansion of variables in redirections
Revision 1.13 / (download) - annotate - [select for diffs], Sun Jun 12 02:31:28 1994 UTC (28 years, 8 months ago) by jtc
Branch: MAIN
Changes since 1.12: +2 -2
lines
Diff to previous 1.12 (colored)
Set the status variable ($?) to 0 after a successful variable assignment.
Revision 1.12 / (download) - annotate - [select for diffs], Sat Jun 11 16:11:49 1994 UTC (28 years, 8 months ago) by mycroft
Branch: MAIN
Changes since 1.11: +2 -1
lines
Diff to previous 1.11 (colored)
Add RCS ids.
Revision 1.11 / (download) - annotate - [select for diffs], Sat May 21 01:42:30 1994 UTC (28 years, 8 months ago) by cgd
Branch: MAIN
Changes since 1.10: +2 -0
lines
Diff to previous 1.10 (colored)
a few more things to omit when NO_HISTORY defined. from noel@cs.oberlin.edu
Revision 1.10 / (download) - annotate - [select for diffs], Sat May 14 22:20:14 1994 UTC (28 years, 9 months ago) by cgd
Branch: MAIN
Changes since 1.9: +4 -0
lines
Diff to previous 1.9 (colored)
add back in support for building w/o obj dir. also, add NO_HISTORY define, which (if you invoke mkbuiltins properly) gets you a sh w/o history of command line editing (for floppy sh).
Revision 1.9 / (download) - annotate - [select for diffs], Thu May 12 17:03:34 1994 UTC (28 years, 9 months ago) by jtc
Branch: MAIN
Changes since 1.8: +1 -0
lines
Diff to previous 1.8 (colored)
Include appropriate header files to bring function prototypes into scope.
Revision 1.8 / (download) - annotate - [select for diffs], Wed May 11 17:42:58 1994 UTC (28 years, 9 months ago) by jtc
Branch: MAIN
Changes since 1.7: +5 -0
lines
Diff to previous 1.7 (colored)
reintegrate NetBSD's false builtin
Revision 1.7 / (download) - annotate - [select for diffs], Wed May 11 17:09:52 1994 UTC (28 years, 9 months ago) by jtc
Branch: MAIN
Changes since 1.6: +28 -22
lines
Diff to previous 1.6 (colored)
sync with 4.4lite
Revision 1.1.1.2 / (download) - annotate - [select for diffs] (vendor branch), Wed May 11 17:02:11 1994 UTC (28 years, 9 months ago) by jtc
Branch: WFJ-920714,
CSRG
CVS Tags: lite-1
Changes since 1.1.1.1: +28 -15
lines
Diff to previous 1.1.1.1 (colored)
44lite code
Revision 1.6 / (download) - annotate - [select for diffs], Thu Sep 9 01:05:19 1993 UTC (29 years, 5 months ago) by cgd
Branch: MAIN
Changes since 1.5: +5 -2
lines
Diff to previous 1.5 (colored)
fix from Jim Wilson <wilson@cygnus.com> for nothing-between-backquotes core
Revision 1.5 / (download) - annotate - [select for diffs], Sun Aug 1 18:58:18 1993 UTC (29 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.4: +2 -2
lines
Diff to previous 1.4 (colored)
Add RCS identifiers.
Revision 1.4 / (download) - annotate - [select for diffs], Wed Jul 7 01:11:57 1993 UTC (29 years, 7 months ago) by jtc
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.3: +4 -1
lines
Diff to previous 1.3 (colored)
IEEE 1003.2 (D11.2.2.3) requires that the system's true and false be accessed instead of searching $PATH. The best way to satisfy this requirement is to make them builtins. True was allready builtin, this patch adds false.
Revision 1.3 / (download) - annotate - [select for diffs], Tue Mar 23 00:27:50 1993 UTC (29 years, 10 months 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)
changed "Id" to "Header" for rcsids
Revision 1.2 / (download) - annotate - [select for diffs], Mon Mar 22 08:04:00 1993 UTC (29 years, 10 months ago) by cgd
Branch: MAIN
Changes since 1.1: +1 -0
lines
Diff to previous 1.1 (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 (29 years, 10 months 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)
initial import of 386bsd-0.1 sources
Revision 1.1 / (download) - annotate - [select for diffs], Sun Mar 21 09:45:37 1993 UTC (29 years, 10 months ago) by cgd
Branch: MAIN
Initial revision