#
1.72 |
|
16-Feb-2021 |
kre |
PR bin/55979
Correctly handle (ie: ignore completely) \0 chars (nuls) in the shell command input stream (script, dot file, or stdin).
Previously nul chars were ignored correctly in the line in which they occurred, but would cause trailing chars of that line to reappear as the start of the following line. If there was just one \0 skipped, this would generally result in an extra \n in the sh input, which in most cases has no effect. With multiple \0's in a single line, more of the end of that line was duplicated into the following one. This usually manifested as a weird "command not found" error.
Note that any \0 chars in the sh input make the script non-conforming, so fixing this is not crucial (no \0's should really ever be seen) but it was an obvious bug in the code, which was attempting to ignore nul chars (as do many other shells), so let it be fixed.
XXX pullup -9
|
Revision tags: netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
|
#
1.71 |
|
09-Feb-2019 |
kre |
KNF - white space changes, indent using tabs not spaces. NFC.
|
#
1.70 |
|
09-Feb-2019 |
kre |
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 tags: pgoyette-compat-20190127 pgoyette-compat-20190118
|
#
1.69 |
|
16-Jan-2019 |
kre |
Redo 1.65 in a simpler way. This is the bit rot avoidance code that is #if 0'd and (still) has never been compiled (most likely never will be.)
While here, in the same uncompiled code, deal with line number counting. Whether this is correct depends upon how this code is used, and as it never is (and never has been since line numbers first started being counted), this is somewhat speculative, but it seems likely to be the correct way to handle things.
NFC (this code is still all #if 0).
|
#
1.68 |
|
15-Jan-2019 |
kre |
Don't use quoteflag when deciding if the word after an alias should be looked up as a potential following alias - if the first expands to a string that ends with a space (any space, quoted or not) then the next word is to be treated as an alias candidate. (POSIX was to specify only unquoted spaces, but is now going to leave that unspecified, and the "any space" version turns out to be more useful.
And besides, the quoteflag test didn't work properly, and would have been very messy to fix ... if in a word (as if we have a quoted space) it means that the word has been quoted, which meant that quoted spaces were correctly detected, but it outside a word, it just means that the previous word was quoted, so it would sometimes reject alias lookup on the next word in cases where it is unquestioned it should be done.
|
#
1.67 |
|
09-Jan-2019 |
kre |
Correct an (old) typo in a comment. NFC - it is just a comment.
|
#
1.66 |
|
09-Jan-2019 |
kre |
Fix the code taken from FreeBSD 2 revisions back, which fixed aliases, to actually do what it was supposed to do, and not just come close by accident. (How broken this was, while still seeming to work perfectly most of the time was truly amazing!)
This corrects the behaviour of an alias defined with a blank char as the last of its value, to correctly do an alias lookup on the word that follows the alias.
|
#
1.65 |
|
09-Jan-2019 |
kre |
Update some dead (#if 0'd) code that is never called to cope with the changes made in the previous revision, in an attempt to avoid bit rot.
Untested (uncompiled) - though it should work.
NFC: this change doesn't get compiled, let alone used.
|
Revision tags: pgoyette-compat-1226
|
#
1.64 |
|
03-Dec-2018 |
kre |
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 tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
|
#
1.63 |
|
19-Aug-2018 |
kre |
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 tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.62 |
|
19-Aug-2017 |
kre |
branches: 1.62.2; 1.62.4;
NFC - DEBUG mode change only - add some sanity to a debug printf format string
|
#
1.61 |
|
05-Aug-2017 |
kre |
PR bin/52458
Avoid mangling history when editing is enabled, and the prompt contains a \n
Also, allow empty input lines into history when they are being appended to a previous (partial) command (but not when they would just make an empty entry).
For all the gory details, see the PR.
Note nothing here actually makes prompts containing \n work correctly when editing is enabled, that's a libedit issue, which will be addressed some other time.
|
Revision tags: perseant-stdc-iso10646-base
|
#
1.60 |
|
05-Jul-2017 |
kre |
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.)
|
#
1.59 |
|
30-Jun-2017 |
kre |
Implement PS1, PS2 and PS4 expansions (variable expansions, arithmetic expansions, and if enabled by the promptcmds option, command substitutions.)
|
#
1.58 |
|
07-Jun-2017 |
kre |
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.
|
#
1.57 |
|
07-Jun-2017 |
kre |
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 tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2
|
#
1.56 |
|
03-May-2017 |
kre |
branches: 1.56.2;
Another fix from FreeBSD. I'm not sure how to trigger the problem fixed (there might be no way) - but it "feels right"!
When popping an (exhausted) input string off the input stack, allow for the possibility that the previous string might also just happened to have run out of steam as well, so keep poppin' along until we run out of pop, or find something to consume.
|
#
1.55 |
|
03-May-2017 |
kre |
Deal with \newline line continuations more correctly. They can occur anywhere (*anywhere*) not only where it happens to be convenient to the parser...
This fix from FreeBSD (thanks again folks).
To make this work, pushstring()'s signature needed to change to allow a const char * as its string arg, which meant sprinkling some const other places for a brighter appearance (and handling fallout).
All this because I wanted to see what number would come from
echo $\ {\ L\ I\ N\ E\ N\ O\ }
and was surprised at the result! That works now...
The bug would also affect stuff like
true &\ & false
and all kinds of other uses where the \newline occurred in the "wrong" place.
An ATF test for sh syntax is coming... (sometime.)
|
#
1.54 |
|
03-May-2017 |
kre |
Fix idiot typos in previous (this is not the advertised :next commit") Same typo - two different places. Ugh!
|
#
1.53 |
|
03-May-2017 |
kre |
NFC: Change prototype of pushstring() to give a real type for the 3rd arg (struct alias *) rather than using void * and then casting it when used. For callers, the arg either is a struct alias *, or is NULL, so nothing to adjust there.
NB: This change untested by itself, it was going to be a part of the next change (coming in a few minutes) but is logically unrelated, so ...
|
Revision tags: prg-localcount2-base1
|
#
1.52 |
|
29-Apr-2017 |
kre |
Keep track of which file descriptors the shell is using for its own purposes, and move them elsewhere whenever a user redirection happens to pick the same number. With this we can move the shell file descriptors back to lower values (be slightly kinder to the kernel) since we can no longer clash. (Also get rid of a little old unneeded code.)
This also completes the fdflags command, which no longer permits access to (by way or either obtaining, or changing) the shell's internal fds.
|
Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.51 |
|
01-Jun-2016 |
kre |
branches: 1.51.6;
PR bin/51207 Only check for ELF bnaries in regular files.
|
#
1.50 |
|
07-May-2016 |
kre |
PR bin/51119 - don't leak FDs in unusual error cases. OK christos@
|
#
1.49 |
|
02-May-2016 |
christos |
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@)
|
#
1.48 |
|
27-Mar-2016 |
christos |
General KNF and source code cleanups, avoid scattering the magic string " \t\n" all over the place, slightly improved syntax error messages, restructured some of the code for clarity, don't allow IFS to be imported through the environment, and remove the (never) conditionally compiled ATTY option. Apart from one or two syntax error messages, and ignoring IFS if present in the environment, this is intended to have no user visible changes. (from kre@)
|
#
1.47 |
|
04-Jan-2016 |
christos |
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 tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
|
#
1.46 |
|
30-Oct-2013 |
mrg |
#ifdef a variable decl/setting with it's use.
|
Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.45 |
|
28-Mar-2012 |
christos |
branches: 1.45.2; include <limits.h> for CHAR_MIN/CHAR_MAX
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase
|
#
1.44 |
|
17-Feb-2011 |
pooka |
branches: 1.44.4; 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 tags: bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.43 |
|
30-Aug-2010 |
christos |
branches: 1.43.2; dprintf is claimed by posix.
|
Revision tags: matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
|
#
1.42 |
|
10-Mar-2009 |
roy |
el_gets now sets el_len to -1 on error so we can distinguish between a NULL string and an error. This fixes sh from exiting with libedit now allowing EINTR to return. We may need to expand this to an errno check in the future.
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
|
#
1.41 |
|
16-Oct-2008 |
dholland |
branches: 1.41.4; Use "extern" properly for referencing globals defined in other modules. Now builds cleanly with -warn-common.
|
Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
|
#
1.40 |
|
15-Feb-2007 |
rillig |
Since interpreting ELF binaries as shell scripts is not very useful, and since the current error message is less than helpful, improve it.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 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-3-1-1-RELEASE netbsd-3-0-3-RELEASE wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-4-base netbsd-3-0-1-RELEASE 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-2-0-3-RELEASE 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-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-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-base
|
#
1.39 |
|
07-Aug-2003 |
agc |
Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
|
#
1.38 |
|
15-May-2003 |
dsl |
Don't close any script files if vfork is set. If a fork() is done later in order to feed a 'here' document into a pipe then it is possible that one end of the pipe might get closed.
|
Revision tags: fvdl_fs64_base
|
#
1.37 |
|
24-Nov-2002 |
christos |
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...)
|
#
1.36 |
|
27-Sep-2002 |
christos |
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 tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base ELRICshvfork-base
|
#
1.35 |
|
04-Feb-2001 |
christos |
branches: 1.35.2; remove redundant declarations and nexted externs.
|
Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
|
#
1.34 |
|
22-May-2000 |
elric |
Back out previous vfork changes.
|
#
1.33 |
|
13-May-2000 |
elric |
Now we use vfork(2) instead of fork(2) when we can.
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.32 |
|
09-Jul-1999 |
christos |
compile with WARNS = 2
|
Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
|
#
1.31 |
|
20-May-1998 |
christos |
Simplify interface for general use.
|
#
1.30 |
|
20-May-1998 |
christos |
fix bug where if moving in history during a multi-line event, the append to history event would end up in the last event where the history was moved to instead of the multi-line event; reported by Mycroft
|
#
1.29 |
|
29-Mar-1998 |
mrg |
- change "extern" variables into int's - remove extern'd variables not actually referenced - don't use char as an array index
|
Revision tags: netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.28 |
|
14-Oct-1997 |
christos |
branches: 1.28.2; PR/4257: Jaromir Dolecek: Update for libedit interface change.
|
#
1.27 |
|
04-Jul-1997 |
christos |
Fix compiler warnings.
|
#
1.26 |
|
11-Apr-1997 |
christos |
Rename pread to preadfd
|
#
1.25 |
|
14-Mar-1997 |
christos |
NO_HISTORY->SMALL
|
#
1.24 |
|
13-Mar-1997 |
christos |
Fix problems with -DNO_HISTORY
|
#
1.23 |
|
13-Mar-1997 |
mycroft |
Set input files to close-on-exec mode.
|
#
1.22 |
|
11-Jan-1997 |
tls |
kill 'register'
|
#
1.21 |
|
02-Nov-1996 |
christos |
Fix problems that gcc -Wall found (from Todd Miller, OpenBSD)
|
#
1.20 |
|
16-Oct-1996 |
christos |
PR/2808: Remove trailing whitespace (from FreeBSD)
|
Revision tags: netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
|
#
1.19 |
|
19-Oct-1995 |
christos |
branches: 1.19.4; - fix PR1620, -DNO_HISTORY did not work. - restore parsing state after parsing old style command substitution. The ';' in '`echo z;`' broke the following: for i in 1; do cat > /dev/tty << __EOF__ `echo z;` __EOF__ done
cVS: Enter Log. Lines beginning with `CVS: ' are removed automatically
|
Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
|
#
1.18 |
|
06-Oct-1995 |
christos |
fixed previous booboo that broke command line editing input.
|
#
1.17 |
|
26-Sep-1995 |
christos |
- Fix -v flag, so that it works properly when the shell reads from scripts. - Bad style to fix my own PR, but I'd like to commit the parallel make changes soon, and this is a necessary prerequisite.
|
#
1.16 |
|
09-Jun-1995 |
christos |
Changed so that 'PATH=newpath command' works, instead of looking at the old path. Synced input.c with vangogh.
|
#
1.15 |
|
07-Jun-1995 |
cgd |
needs string.h
|
#
1.14 |
|
11-May-1995 |
christos |
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0 bug.
|
#
1.13 |
|
21-Mar-1995 |
cgd |
convert to new RCS id conventions.
|
#
1.12 |
|
23-Dec-1994 |
cgd |
pull prototypes into scope for string functions.
|
#
1.11 |
|
04-Dec-1994 |
cgd |
from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch some of the worst style errors.
|
Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
|
#
1.10 |
|
11-Jun-1994 |
mycroft |
Add RCS ids.
|
#
1.9 |
|
08-Jun-1994 |
jtc |
Fix from Christos for when NO_HISTORY is defined
|
#
1.8 |
|
21-May-1994 |
cgd |
a few more things to omit when NO_HISTORY defined. from noel@cs.oberlin.edu
|
#
1.7 |
|
14-May-1994 |
cgd |
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).
|
#
1.6 |
|
12-May-1994 |
jtc |
Include appropriate header files to bring function prototypes into scope.
|
#
1.5 |
|
11-May-1994 |
jtc |
sync with 4.4lite
|
#
1.4 |
|
01-Aug-1993 |
mycroft |
Add RCS identifiers.
|
Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
|
#
1.3 |
|
23-Mar-1993 |
cgd |
changed "Id" to "Header" for rcsids
|
#
1.2 |
|
22-Mar-1993 |
cgd |
added rcs ids to all files
|
#
1.1 |
|
21-Mar-1993 |
cgd |
branches: 1.1.1; Initial revision
|
#
1.71 |
|
09-Feb-2019 |
kre |
KNF - white space changes, indent using tabs not spaces. NFC.
|
#
1.70 |
|
09-Feb-2019 |
kre |
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 tags: pgoyette-compat-20190127 pgoyette-compat-20190118
|
#
1.69 |
|
16-Jan-2019 |
kre |
Redo 1.65 in a simpler way. This is the bit rot avoidance code that is #if 0'd and (still) has never been compiled (most likely never will be.)
While here, in the same uncompiled code, deal with line number counting. Whether this is correct depends upon how this code is used, and as it never is (and never has been since line numbers first started being counted), this is somewhat speculative, but it seems likely to be the correct way to handle things.
NFC (this code is still all #if 0).
|
#
1.68 |
|
15-Jan-2019 |
kre |
Don't use quoteflag when deciding if the word after an alias should be looked up as a potential following alias - if the first expands to a string that ends with a space (any space, quoted or not) then the next word is to be treated as an alias candidate. (POSIX was to specify only unquoted spaces, but is now going to leave that unspecified, and the "any space" version turns out to be more useful.
And besides, the quoteflag test didn't work properly, and would have been very messy to fix ... if in a word (as if we have a quoted space) it means that the word has been quoted, which meant that quoted spaces were correctly detected, but it outside a word, it just means that the previous word was quoted, so it would sometimes reject alias lookup on the next word in cases where it is unquestioned it should be done.
|
#
1.67 |
|
09-Jan-2019 |
kre |
Correct an (old) typo in a comment. NFC - it is just a comment.
|
#
1.66 |
|
09-Jan-2019 |
kre |
Fix the code taken from FreeBSD 2 revisions back, which fixed aliases, to actually do what it was supposed to do, and not just come close by accident. (How broken this was, while still seeming to work perfectly most of the time was truly amazing!)
This corrects the behaviour of an alias defined with a blank char as the last of its value, to correctly do an alias lookup on the word that follows the alias.
|
#
1.65 |
|
09-Jan-2019 |
kre |
Update some dead (#if 0'd) code that is never called to cope with the changes made in the previous revision, in an attempt to avoid bit rot.
Untested (uncompiled) - though it should work.
NFC: this change doesn't get compiled, let alone used.
|
Revision tags: pgoyette-compat-1226
|
#
1.64 |
|
03-Dec-2018 |
kre |
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 tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
|
#
1.63 |
|
19-Aug-2018 |
kre |
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 tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.62 |
|
19-Aug-2017 |
kre |
branches: 1.62.2;
NFC - DEBUG mode change only - add some sanity to a debug printf format string
|
#
1.61 |
|
05-Aug-2017 |
kre |
PR bin/52458
Avoid mangling history when editing is enabled, and the prompt contains a \n
Also, allow empty input lines into history when they are being appended to a previous (partial) command (but not when they would just make an empty entry).
For all the gory details, see the PR.
Note nothing here actually makes prompts containing \n work correctly when editing is enabled, that's a libedit issue, which will be addressed some other time.
|
Revision tags: perseant-stdc-iso10646-base
|
#
1.60 |
|
05-Jul-2017 |
kre |
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.)
|
#
1.59 |
|
30-Jun-2017 |
kre |
Implement PS1, PS2 and PS4 expansions (variable expansions, arithmetic expansions, and if enabled by the promptcmds option, command substitutions.)
|
#
1.58 |
|
07-Jun-2017 |
kre |
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.
|
#
1.57 |
|
07-Jun-2017 |
kre |
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 tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2
|
#
1.56 |
|
03-May-2017 |
kre |
branches: 1.56.2;
Another fix from FreeBSD. I'm not sure how to trigger the problem fixed (there might be no way) - but it "feels right"!
When popping an (exhausted) input string off the input stack, allow for the possibility that the previous string might also just happened to have run out of steam as well, so keep poppin' along until we run out of pop, or find something to consume.
|
#
1.55 |
|
03-May-2017 |
kre |
Deal with \newline line continuations more correctly. They can occur anywhere (*anywhere*) not only where it happens to be convenient to the parser...
This fix from FreeBSD (thanks again folks).
To make this work, pushstring()'s signature needed to change to allow a const char * as its string arg, which meant sprinkling some const other places for a brighter appearance (and handling fallout).
All this because I wanted to see what number would come from
echo $\ {\ L\ I\ N\ E\ N\ O\ }
and was surprised at the result! That works now...
The bug would also affect stuff like
true &\ & false
and all kinds of other uses where the \newline occurred in the "wrong" place.
An ATF test for sh syntax is coming... (sometime.)
|
#
1.54 |
|
03-May-2017 |
kre |
Fix idiot typos in previous (this is not the advertised :next commit") Same typo - two different places. Ugh!
|
#
1.53 |
|
03-May-2017 |
kre |
NFC: Change prototype of pushstring() to give a real type for the 3rd arg (struct alias *) rather than using void * and then casting it when used. For callers, the arg either is a struct alias *, or is NULL, so nothing to adjust there.
NB: This change untested by itself, it was going to be a part of the next change (coming in a few minutes) but is logically unrelated, so ...
|
Revision tags: prg-localcount2-base1
|
#
1.52 |
|
29-Apr-2017 |
kre |
Keep track of which file descriptors the shell is using for its own purposes, and move them elsewhere whenever a user redirection happens to pick the same number. With this we can move the shell file descriptors back to lower values (be slightly kinder to the kernel) since we can no longer clash. (Also get rid of a little old unneeded code.)
This also completes the fdflags command, which no longer permits access to (by way or either obtaining, or changing) the shell's internal fds.
|
Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.51 |
|
01-Jun-2016 |
kre |
branches: 1.51.6;
PR bin/51207 Only check for ELF bnaries in regular files.
|
#
1.50 |
|
07-May-2016 |
kre |
PR bin/51119 - don't leak FDs in unusual error cases. OK christos@
|
#
1.49 |
|
02-May-2016 |
christos |
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@)
|
#
1.48 |
|
27-Mar-2016 |
christos |
General KNF and source code cleanups, avoid scattering the magic string " \t\n" all over the place, slightly improved syntax error messages, restructured some of the code for clarity, don't allow IFS to be imported through the environment, and remove the (never) conditionally compiled ATTY option. Apart from one or two syntax error messages, and ignoring IFS if present in the environment, this is intended to have no user visible changes. (from kre@)
|
#
1.47 |
|
04-Jan-2016 |
christos |
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 tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
|
#
1.46 |
|
30-Oct-2013 |
mrg |
#ifdef a variable decl/setting with it's use.
|
Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.45 |
|
28-Mar-2012 |
christos |
branches: 1.45.2; include <limits.h> for CHAR_MIN/CHAR_MAX
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase
|
#
1.44 |
|
17-Feb-2011 |
pooka |
branches: 1.44.4; 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 tags: bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.43 |
|
30-Aug-2010 |
christos |
branches: 1.43.2; dprintf is claimed by posix.
|
Revision tags: matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
|
#
1.42 |
|
10-Mar-2009 |
roy |
el_gets now sets el_len to -1 on error so we can distinguish between a NULL string and an error. This fixes sh from exiting with libedit now allowing EINTR to return. We may need to expand this to an errno check in the future.
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
|
#
1.41 |
|
16-Oct-2008 |
dholland |
branches: 1.41.4; Use "extern" properly for referencing globals defined in other modules. Now builds cleanly with -warn-common.
|
Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
|
#
1.40 |
|
15-Feb-2007 |
rillig |
Since interpreting ELF binaries as shell scripts is not very useful, and since the current error message is less than helpful, improve it.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 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-3-1-1-RELEASE netbsd-3-0-3-RELEASE wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-4-base netbsd-3-0-1-RELEASE 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-2-0-3-RELEASE 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-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-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-base
|
#
1.39 |
|
07-Aug-2003 |
agc |
Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
|
#
1.38 |
|
15-May-2003 |
dsl |
Don't close any script files if vfork is set. If a fork() is done later in order to feed a 'here' document into a pipe then it is possible that one end of the pipe might get closed.
|
Revision tags: fvdl_fs64_base
|
#
1.37 |
|
24-Nov-2002 |
christos |
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...)
|
#
1.36 |
|
27-Sep-2002 |
christos |
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 tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base ELRICshvfork-base
|
#
1.35 |
|
04-Feb-2001 |
christos |
branches: 1.35.2; remove redundant declarations and nexted externs.
|
Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
|
#
1.34 |
|
22-May-2000 |
elric |
Back out previous vfork changes.
|
#
1.33 |
|
13-May-2000 |
elric |
Now we use vfork(2) instead of fork(2) when we can.
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.32 |
|
09-Jul-1999 |
christos |
compile with WARNS = 2
|
Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
|
#
1.31 |
|
20-May-1998 |
christos |
Simplify interface for general use.
|
#
1.30 |
|
20-May-1998 |
christos |
fix bug where if moving in history during a multi-line event, the append to history event would end up in the last event where the history was moved to instead of the multi-line event; reported by Mycroft
|
#
1.29 |
|
29-Mar-1998 |
mrg |
- change "extern" variables into int's - remove extern'd variables not actually referenced - don't use char as an array index
|
Revision tags: netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.28 |
|
14-Oct-1997 |
christos |
branches: 1.28.2; PR/4257: Jaromir Dolecek: Update for libedit interface change.
|
#
1.27 |
|
04-Jul-1997 |
christos |
Fix compiler warnings.
|
#
1.26 |
|
11-Apr-1997 |
christos |
Rename pread to preadfd
|
#
1.25 |
|
14-Mar-1997 |
christos |
NO_HISTORY->SMALL
|
#
1.24 |
|
13-Mar-1997 |
christos |
Fix problems with -DNO_HISTORY
|
#
1.23 |
|
13-Mar-1997 |
mycroft |
Set input files to close-on-exec mode.
|
#
1.22 |
|
11-Jan-1997 |
tls |
kill 'register'
|
#
1.21 |
|
02-Nov-1996 |
christos |
Fix problems that gcc -Wall found (from Todd Miller, OpenBSD)
|
#
1.20 |
|
16-Oct-1996 |
christos |
PR/2808: Remove trailing whitespace (from FreeBSD)
|
Revision tags: netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
|
#
1.19 |
|
19-Oct-1995 |
christos |
branches: 1.19.4; - fix PR1620, -DNO_HISTORY did not work. - restore parsing state after parsing old style command substitution. The ';' in '`echo z;`' broke the following: for i in 1; do cat > /dev/tty << __EOF__ `echo z;` __EOF__ done
cVS: Enter Log. Lines beginning with `CVS: ' are removed automatically
|
Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
|
#
1.18 |
|
06-Oct-1995 |
christos |
fixed previous booboo that broke command line editing input.
|
#
1.17 |
|
26-Sep-1995 |
christos |
- Fix -v flag, so that it works properly when the shell reads from scripts. - Bad style to fix my own PR, but I'd like to commit the parallel make changes soon, and this is a necessary prerequisite.
|
#
1.16 |
|
09-Jun-1995 |
christos |
Changed so that 'PATH=newpath command' works, instead of looking at the old path. Synced input.c with vangogh.
|
#
1.15 |
|
07-Jun-1995 |
cgd |
needs string.h
|
#
1.14 |
|
11-May-1995 |
christos |
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0 bug.
|
#
1.13 |
|
21-Mar-1995 |
cgd |
convert to new RCS id conventions.
|
#
1.12 |
|
23-Dec-1994 |
cgd |
pull prototypes into scope for string functions.
|
#
1.11 |
|
04-Dec-1994 |
cgd |
from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch some of the worst style errors.
|
Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
|
#
1.10 |
|
11-Jun-1994 |
mycroft |
Add RCS ids.
|
#
1.9 |
|
08-Jun-1994 |
jtc |
Fix from Christos for when NO_HISTORY is defined
|
#
1.8 |
|
21-May-1994 |
cgd |
a few more things to omit when NO_HISTORY defined. from noel@cs.oberlin.edu
|
#
1.7 |
|
14-May-1994 |
cgd |
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).
|
#
1.6 |
|
12-May-1994 |
jtc |
Include appropriate header files to bring function prototypes into scope.
|
#
1.5 |
|
11-May-1994 |
jtc |
sync with 4.4lite
|
#
1.4 |
|
01-Aug-1993 |
mycroft |
Add RCS identifiers.
|
Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
|
#
1.3 |
|
23-Mar-1993 |
cgd |
changed "Id" to "Header" for rcsids
|
#
1.2 |
|
22-Mar-1993 |
cgd |
added rcs ids to all files
|
#
1.1 |
|
21-Mar-1993 |
cgd |
branches: 1.1.1; Initial revision
|
#
1.62 |
|
19-Aug-2017 |
kre |
NFC - DEBUG mode change only - add some sanity to a debug printf format string
|
#
1.61 |
|
05-Aug-2017 |
kre |
PR bin/52458
Avoid mangling history when editing is enabled, and the prompt contains a \n
Also, allow empty input lines into history when they are being appended to a previous (partial) command (but not when they would just make an empty entry).
For all the gory details, see the PR.
Note nothing here actually makes prompts containing \n work correctly when editing is enabled, that's a libedit issue, which will be addressed some other time.
|
Revision tags: perseant-stdc-iso10646-base
|
#
1.60 |
|
05-Jul-2017 |
kre |
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.)
|
#
1.59 |
|
30-Jun-2017 |
kre |
Implement PS1, PS2 and PS4 expansions (variable expansions, arithmetic expansions, and if enabled by the promptcmds option, command substitutions.)
|
#
1.58 |
|
07-Jun-2017 |
kre |
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.
|
#
1.57 |
|
07-Jun-2017 |
kre |
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 tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2
|
#
1.56 |
|
03-May-2017 |
kre |
branches: 1.56.2;
Another fix from FreeBSD. I'm not sure how to trigger the problem fixed (there might be no way) - but it "feels right"!
When popping an (exhausted) input string off the input stack, allow for the possibility that the previous string might also just happened to have run out of steam as well, so keep poppin' along until we run out of pop, or find something to consume.
|
#
1.55 |
|
03-May-2017 |
kre |
Deal with \newline line continuations more correctly. They can occur anywhere (*anywhere*) not only where it happens to be convenient to the parser...
This fix from FreeBSD (thanks again folks).
To make this work, pushstring()'s signature needed to change to allow a const char * as its string arg, which meant sprinkling some const other places for a brighter appearance (and handling fallout).
All this because I wanted to see what number would come from
echo $\ {\ L\ I\ N\ E\ N\ O\ }
and was surprised at the result! That works now...
The bug would also affect stuff like
true &\ & false
and all kinds of other uses where the \newline occurred in the "wrong" place.
An ATF test for sh syntax is coming... (sometime.)
|
#
1.54 |
|
03-May-2017 |
kre |
Fix idiot typos in previous (this is not the advertised :next commit") Same typo - two different places. Ugh!
|
#
1.53 |
|
03-May-2017 |
kre |
NFC: Change prototype of pushstring() to give a real type for the 3rd arg (struct alias *) rather than using void * and then casting it when used. For callers, the arg either is a struct alias *, or is NULL, so nothing to adjust there.
NB: This change untested by itself, it was going to be a part of the next change (coming in a few minutes) but is logically unrelated, so ...
|
Revision tags: prg-localcount2-base1
|
#
1.52 |
|
29-Apr-2017 |
kre |
Keep track of which file descriptors the shell is using for its own purposes, and move them elsewhere whenever a user redirection happens to pick the same number. With this we can move the shell file descriptors back to lower values (be slightly kinder to the kernel) since we can no longer clash. (Also get rid of a little old unneeded code.)
This also completes the fdflags command, which no longer permits access to (by way or either obtaining, or changing) the shell's internal fds.
|
Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.51 |
|
01-Jun-2016 |
kre |
branches: 1.51.6;
PR bin/51207 Only check for ELF bnaries in regular files.
|
#
1.50 |
|
07-May-2016 |
kre |
PR bin/51119 - don't leak FDs in unusual error cases. OK christos@
|
#
1.49 |
|
02-May-2016 |
christos |
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@)
|
#
1.48 |
|
27-Mar-2016 |
christos |
General KNF and source code cleanups, avoid scattering the magic string " \t\n" all over the place, slightly improved syntax error messages, restructured some of the code for clarity, don't allow IFS to be imported through the environment, and remove the (never) conditionally compiled ATTY option. Apart from one or two syntax error messages, and ignoring IFS if present in the environment, this is intended to have no user visible changes. (from kre@)
|
#
1.47 |
|
04-Jan-2016 |
christos |
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 tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
|
#
1.46 |
|
30-Oct-2013 |
mrg |
#ifdef a variable decl/setting with it's use.
|
Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.45 |
|
28-Mar-2012 |
christos |
branches: 1.45.2; include <limits.h> for CHAR_MIN/CHAR_MAX
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase
|
#
1.44 |
|
17-Feb-2011 |
pooka |
branches: 1.44.4; 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 tags: bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.43 |
|
30-Aug-2010 |
christos |
branches: 1.43.2; dprintf is claimed by posix.
|
Revision tags: matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
|
#
1.42 |
|
10-Mar-2009 |
roy |
el_gets now sets el_len to -1 on error so we can distinguish between a NULL string and an error. This fixes sh from exiting with libedit now allowing EINTR to return. We may need to expand this to an errno check in the future.
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
|
#
1.41 |
|
16-Oct-2008 |
dholland |
branches: 1.41.4; Use "extern" properly for referencing globals defined in other modules. Now builds cleanly with -warn-common.
|
Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
|
#
1.40 |
|
15-Feb-2007 |
rillig |
Since interpreting ELF binaries as shell scripts is not very useful, and since the current error message is less than helpful, improve it.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 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-3-1-1-RELEASE netbsd-3-0-3-RELEASE wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-4-base netbsd-3-0-1-RELEASE 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-2-0-3-RELEASE 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-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-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-base
|
#
1.39 |
|
07-Aug-2003 |
agc |
Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
|
#
1.38 |
|
15-May-2003 |
dsl |
Don't close any script files if vfork is set. If a fork() is done later in order to feed a 'here' document into a pipe then it is possible that one end of the pipe might get closed.
|
Revision tags: fvdl_fs64_base
|
#
1.37 |
|
24-Nov-2002 |
christos |
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...)
|
#
1.36 |
|
27-Sep-2002 |
christos |
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 tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base ELRICshvfork-base
|
#
1.35 |
|
04-Feb-2001 |
christos |
branches: 1.35.2; remove redundant declarations and nexted externs.
|
Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
|
#
1.34 |
|
22-May-2000 |
elric |
Back out previous vfork changes.
|
#
1.33 |
|
13-May-2000 |
elric |
Now we use vfork(2) instead of fork(2) when we can.
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.32 |
|
09-Jul-1999 |
christos |
compile with WARNS = 2
|
Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
|
#
1.31 |
|
20-May-1998 |
christos |
Simplify interface for general use.
|
#
1.30 |
|
20-May-1998 |
christos |
fix bug where if moving in history during a multi-line event, the append to history event would end up in the last event where the history was moved to instead of the multi-line event; reported by Mycroft
|
#
1.29 |
|
29-Mar-1998 |
mrg |
- change "extern" variables into int's - remove extern'd variables not actually referenced - don't use char as an array index
|
Revision tags: netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.28 |
|
14-Oct-1997 |
christos |
branches: 1.28.2; PR/4257: Jaromir Dolecek: Update for libedit interface change.
|
#
1.27 |
|
04-Jul-1997 |
christos |
Fix compiler warnings.
|
#
1.26 |
|
11-Apr-1997 |
christos |
Rename pread to preadfd
|
#
1.25 |
|
14-Mar-1997 |
christos |
NO_HISTORY->SMALL
|
#
1.24 |
|
13-Mar-1997 |
christos |
Fix problems with -DNO_HISTORY
|
#
1.23 |
|
13-Mar-1997 |
mycroft |
Set input files to close-on-exec mode.
|
#
1.22 |
|
11-Jan-1997 |
tls |
kill 'register'
|
#
1.21 |
|
02-Nov-1996 |
christos |
Fix problems that gcc -Wall found (from Todd Miller, OpenBSD)
|
#
1.20 |
|
16-Oct-1996 |
christos |
PR/2808: Remove trailing whitespace (from FreeBSD)
|
Revision tags: netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
|
#
1.19 |
|
19-Oct-1995 |
christos |
branches: 1.19.4; - fix PR1620, -DNO_HISTORY did not work. - restore parsing state after parsing old style command substitution. The ';' in '`echo z;`' broke the following: for i in 1; do cat > /dev/tty << __EOF__ `echo z;` __EOF__ done
cVS: Enter Log. Lines beginning with `CVS: ' are removed automatically
|
Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
|
#
1.18 |
|
06-Oct-1995 |
christos |
fixed previous booboo that broke command line editing input.
|
#
1.17 |
|
26-Sep-1995 |
christos |
- Fix -v flag, so that it works properly when the shell reads from scripts. - Bad style to fix my own PR, but I'd like to commit the parallel make changes soon, and this is a necessary prerequisite.
|
#
1.16 |
|
09-Jun-1995 |
christos |
Changed so that 'PATH=newpath command' works, instead of looking at the old path. Synced input.c with vangogh.
|
#
1.15 |
|
07-Jun-1995 |
cgd |
needs string.h
|
#
1.14 |
|
11-May-1995 |
christos |
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0 bug.
|
#
1.13 |
|
21-Mar-1995 |
cgd |
convert to new RCS id conventions.
|
#
1.12 |
|
23-Dec-1994 |
cgd |
pull prototypes into scope for string functions.
|
#
1.11 |
|
04-Dec-1994 |
cgd |
from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch some of the worst style errors.
|
Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
|
#
1.10 |
|
11-Jun-1994 |
mycroft |
Add RCS ids.
|
#
1.9 |
|
08-Jun-1994 |
jtc |
Fix from Christos for when NO_HISTORY is defined
|
#
1.8 |
|
21-May-1994 |
cgd |
a few more things to omit when NO_HISTORY defined. from noel@cs.oberlin.edu
|
#
1.7 |
|
14-May-1994 |
cgd |
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).
|
#
1.6 |
|
12-May-1994 |
jtc |
Include appropriate header files to bring function prototypes into scope.
|
#
1.5 |
|
11-May-1994 |
jtc |
sync with 4.4lite
|
#
1.4 |
|
01-Aug-1993 |
mycroft |
Add RCS identifiers.
|
Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
|
#
1.3 |
|
23-Mar-1993 |
cgd |
changed "Id" to "Header" for rcsids
|
#
1.2 |
|
22-Mar-1993 |
cgd |
added rcs ids to all files
|
#
1.1 |
|
21-Mar-1993 |
cgd |
branches: 1.1.1; Initial revision
|
#
1.61 |
|
05-Aug-2017 |
kre |
PR bin/52458
Avoid mangling history when editing is enabled, and the prompt contains a \n
Also, allow empty input lines into history when they are being appended to a previous (partial) command (but not when they would just make an empty entry).
For all the gory details, see the PR.
Note nothing here actually makes prompts containing \n work correctly when editing is enabled, that's a libedit issue, which will be addressed some other time.
|
Revision tags: perseant-stdc-iso10646-base
|
#
1.60 |
|
05-Jul-2017 |
kre |
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.)
|
#
1.59 |
|
30-Jun-2017 |
kre |
Implement PS1, PS2 and PS4 expansions (variable expansions, arithmetic expansions, and if enabled by the promptcmds option, command substitutions.)
|
#
1.58 |
|
07-Jun-2017 |
kre |
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.
|
#
1.57 |
|
07-Jun-2017 |
kre |
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 tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2
|
#
1.56 |
|
03-May-2017 |
kre |
branches: 1.56.2;
Another fix from FreeBSD. I'm not sure how to trigger the problem fixed (there might be no way) - but it "feels right"!
When popping an (exhausted) input string off the input stack, allow for the possibility that the previous string might also just happened to have run out of steam as well, so keep poppin' along until we run out of pop, or find something to consume.
|
#
1.55 |
|
03-May-2017 |
kre |
Deal with \newline line continuations more correctly. They can occur anywhere (*anywhere*) not only where it happens to be convenient to the parser...
This fix from FreeBSD (thanks again folks).
To make this work, pushstring()'s signature needed to change to allow a const char * as its string arg, which meant sprinkling some const other places for a brighter appearance (and handling fallout).
All this because I wanted to see what number would come from
echo $\ {\ L\ I\ N\ E\ N\ O\ }
and was surprised at the result! That works now...
The bug would also affect stuff like
true &\ & false
and all kinds of other uses where the \newline occurred in the "wrong" place.
An ATF test for sh syntax is coming... (sometime.)
|
#
1.54 |
|
03-May-2017 |
kre |
Fix idiot typos in previous (this is not the advertised :next commit") Same typo - two different places. Ugh!
|
#
1.53 |
|
03-May-2017 |
kre |
NFC: Change prototype of pushstring() to give a real type for the 3rd arg (struct alias *) rather than using void * and then casting it when used. For callers, the arg either is a struct alias *, or is NULL, so nothing to adjust there.
NB: This change untested by itself, it was going to be a part of the next change (coming in a few minutes) but is logically unrelated, so ...
|
Revision tags: prg-localcount2-base1
|
#
1.52 |
|
29-Apr-2017 |
kre |
Keep track of which file descriptors the shell is using for its own purposes, and move them elsewhere whenever a user redirection happens to pick the same number. With this we can move the shell file descriptors back to lower values (be slightly kinder to the kernel) since we can no longer clash. (Also get rid of a little old unneeded code.)
This also completes the fdflags command, which no longer permits access to (by way or either obtaining, or changing) the shell's internal fds.
|
Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.51 |
|
01-Jun-2016 |
kre |
branches: 1.51.6;
PR bin/51207 Only check for ELF bnaries in regular files.
|
#
1.50 |
|
07-May-2016 |
kre |
PR bin/51119 - don't leak FDs in unusual error cases. OK christos@
|
#
1.49 |
|
02-May-2016 |
christos |
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@)
|
#
1.48 |
|
27-Mar-2016 |
christos |
General KNF and source code cleanups, avoid scattering the magic string " \t\n" all over the place, slightly improved syntax error messages, restructured some of the code for clarity, don't allow IFS to be imported through the environment, and remove the (never) conditionally compiled ATTY option. Apart from one or two syntax error messages, and ignoring IFS if present in the environment, this is intended to have no user visible changes. (from kre@)
|
#
1.47 |
|
04-Jan-2016 |
christos |
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 tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
|
#
1.46 |
|
30-Oct-2013 |
mrg |
#ifdef a variable decl/setting with it's use.
|
Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.45 |
|
28-Mar-2012 |
christos |
branches: 1.45.2; include <limits.h> for CHAR_MIN/CHAR_MAX
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase
|
#
1.44 |
|
17-Feb-2011 |
pooka |
branches: 1.44.4; 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 tags: bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.43 |
|
30-Aug-2010 |
christos |
branches: 1.43.2; dprintf is claimed by posix.
|
Revision tags: matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
|
#
1.42 |
|
10-Mar-2009 |
roy |
el_gets now sets el_len to -1 on error so we can distinguish between a NULL string and an error. This fixes sh from exiting with libedit now allowing EINTR to return. We may need to expand this to an errno check in the future.
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
|
#
1.41 |
|
16-Oct-2008 |
dholland |
branches: 1.41.4; Use "extern" properly for referencing globals defined in other modules. Now builds cleanly with -warn-common.
|
Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
|
#
1.40 |
|
15-Feb-2007 |
rillig |
Since interpreting ELF binaries as shell scripts is not very useful, and since the current error message is less than helpful, improve it.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 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-3-1-1-RELEASE netbsd-3-0-3-RELEASE wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-4-base netbsd-3-0-1-RELEASE 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-2-0-3-RELEASE 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-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-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-base
|
#
1.39 |
|
07-Aug-2003 |
agc |
Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
|
#
1.38 |
|
15-May-2003 |
dsl |
Don't close any script files if vfork is set. If a fork() is done later in order to feed a 'here' document into a pipe then it is possible that one end of the pipe might get closed.
|
Revision tags: fvdl_fs64_base
|
#
1.37 |
|
24-Nov-2002 |
christos |
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...)
|
#
1.36 |
|
27-Sep-2002 |
christos |
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 tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base ELRICshvfork-base
|
#
1.35 |
|
04-Feb-2001 |
christos |
branches: 1.35.2; remove redundant declarations and nexted externs.
|
Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
|
#
1.34 |
|
22-May-2000 |
elric |
Back out previous vfork changes.
|
#
1.33 |
|
13-May-2000 |
elric |
Now we use vfork(2) instead of fork(2) when we can.
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.32 |
|
09-Jul-1999 |
christos |
compile with WARNS = 2
|
Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
|
#
1.31 |
|
20-May-1998 |
christos |
Simplify interface for general use.
|
#
1.30 |
|
20-May-1998 |
christos |
fix bug where if moving in history during a multi-line event, the append to history event would end up in the last event where the history was moved to instead of the multi-line event; reported by Mycroft
|
#
1.29 |
|
29-Mar-1998 |
mrg |
- change "extern" variables into int's - remove extern'd variables not actually referenced - don't use char as an array index
|
Revision tags: netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.28 |
|
14-Oct-1997 |
christos |
branches: 1.28.2; PR/4257: Jaromir Dolecek: Update for libedit interface change.
|
#
1.27 |
|
04-Jul-1997 |
christos |
Fix compiler warnings.
|
#
1.26 |
|
11-Apr-1997 |
christos |
Rename pread to preadfd
|
#
1.25 |
|
14-Mar-1997 |
christos |
NO_HISTORY->SMALL
|
#
1.24 |
|
13-Mar-1997 |
christos |
Fix problems with -DNO_HISTORY
|
#
1.23 |
|
13-Mar-1997 |
mycroft |
Set input files to close-on-exec mode.
|
#
1.22 |
|
11-Jan-1997 |
tls |
kill 'register'
|
#
1.21 |
|
02-Nov-1996 |
christos |
Fix problems that gcc -Wall found (from Todd Miller, OpenBSD)
|
#
1.20 |
|
16-Oct-1996 |
christos |
PR/2808: Remove trailing whitespace (from FreeBSD)
|
Revision tags: netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
|
#
1.19 |
|
19-Oct-1995 |
christos |
branches: 1.19.4; - fix PR1620, -DNO_HISTORY did not work. - restore parsing state after parsing old style command substitution. The ';' in '`echo z;`' broke the following: for i in 1; do cat > /dev/tty << __EOF__ `echo z;` __EOF__ done
cVS: Enter Log. Lines beginning with `CVS: ' are removed automatically
|
Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
|
#
1.18 |
|
06-Oct-1995 |
christos |
fixed previous booboo that broke command line editing input.
|
#
1.17 |
|
26-Sep-1995 |
christos |
- Fix -v flag, so that it works properly when the shell reads from scripts. - Bad style to fix my own PR, but I'd like to commit the parallel make changes soon, and this is a necessary prerequisite.
|
#
1.16 |
|
09-Jun-1995 |
christos |
Changed so that 'PATH=newpath command' works, instead of looking at the old path. Synced input.c with vangogh.
|
#
1.15 |
|
07-Jun-1995 |
cgd |
needs string.h
|
#
1.14 |
|
11-May-1995 |
christos |
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0 bug.
|
#
1.13 |
|
21-Mar-1995 |
cgd |
convert to new RCS id conventions.
|
#
1.12 |
|
23-Dec-1994 |
cgd |
pull prototypes into scope for string functions.
|
#
1.11 |
|
04-Dec-1994 |
cgd |
from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch some of the worst style errors.
|
Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
|
#
1.10 |
|
11-Jun-1994 |
mycroft |
Add RCS ids.
|
#
1.9 |
|
08-Jun-1994 |
jtc |
Fix from Christos for when NO_HISTORY is defined
|
#
1.8 |
|
21-May-1994 |
cgd |
a few more things to omit when NO_HISTORY defined. from noel@cs.oberlin.edu
|
#
1.7 |
|
14-May-1994 |
cgd |
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).
|
#
1.6 |
|
12-May-1994 |
jtc |
Include appropriate header files to bring function prototypes into scope.
|
#
1.5 |
|
11-May-1994 |
jtc |
sync with 4.4lite
|
#
1.4 |
|
01-Aug-1993 |
mycroft |
Add RCS identifiers.
|
Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
|
#
1.3 |
|
23-Mar-1993 |
cgd |
changed "Id" to "Header" for rcsids
|
#
1.2 |
|
22-Mar-1993 |
cgd |
added rcs ids to all files
|
#
1.1 |
|
21-Mar-1993 |
cgd |
branches: 1.1.1; Initial revision
|
#
1.60 |
|
05-Jul-2017 |
kre |
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.)
|
#
1.59 |
|
30-Jun-2017 |
kre |
Implement PS1, PS2 and PS4 expansions (variable expansions, arithmetic expansions, and if enabled by the promptcmds option, command substitutions.)
|
#
1.58 |
|
07-Jun-2017 |
kre |
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.
|
#
1.57 |
|
07-Jun-2017 |
kre |
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 tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2
|
#
1.56 |
|
03-May-2017 |
kre |
Another fix from FreeBSD. I'm not sure how to trigger the problem fixed (there might be no way) - but it "feels right"!
When popping an (exhausted) input string off the input stack, allow for the possibility that the previous string might also just happened to have run out of steam as well, so keep poppin' along until we run out of pop, or find something to consume.
|
#
1.55 |
|
03-May-2017 |
kre |
Deal with \newline line continuations more correctly. They can occur anywhere (*anywhere*) not only where it happens to be convenient to the parser...
This fix from FreeBSD (thanks again folks).
To make this work, pushstring()'s signature needed to change to allow a const char * as its string arg, which meant sprinkling some const other places for a brighter appearance (and handling fallout).
All this because I wanted to see what number would come from
echo $\ {\ L\ I\ N\ E\ N\ O\ }
and was surprised at the result! That works now...
The bug would also affect stuff like
true &\ & false
and all kinds of other uses where the \newline occurred in the "wrong" place.
An ATF test for sh syntax is coming... (sometime.)
|
#
1.54 |
|
03-May-2017 |
kre |
Fix idiot typos in previous (this is not the advertised :next commit") Same typo - two different places. Ugh!
|
#
1.53 |
|
03-May-2017 |
kre |
NFC: Change prototype of pushstring() to give a real type for the 3rd arg (struct alias *) rather than using void * and then casting it when used. For callers, the arg either is a struct alias *, or is NULL, so nothing to adjust there.
NB: This change untested by itself, it was going to be a part of the next change (coming in a few minutes) but is logically unrelated, so ...
|
Revision tags: prg-localcount2-base1
|
#
1.52 |
|
29-Apr-2017 |
kre |
Keep track of which file descriptors the shell is using for its own purposes, and move them elsewhere whenever a user redirection happens to pick the same number. With this we can move the shell file descriptors back to lower values (be slightly kinder to the kernel) since we can no longer clash. (Also get rid of a little old unneeded code.)
This also completes the fdflags command, which no longer permits access to (by way or either obtaining, or changing) the shell's internal fds.
|
Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.51 |
|
01-Jun-2016 |
kre |
branches: 1.51.6;
PR bin/51207 Only check for ELF bnaries in regular files.
|
#
1.50 |
|
07-May-2016 |
kre |
PR bin/51119 - don't leak FDs in unusual error cases. OK christos@
|
#
1.49 |
|
02-May-2016 |
christos |
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@)
|
#
1.48 |
|
27-Mar-2016 |
christos |
General KNF and source code cleanups, avoid scattering the magic string " \t\n" all over the place, slightly improved syntax error messages, restructured some of the code for clarity, don't allow IFS to be imported through the environment, and remove the (never) conditionally compiled ATTY option. Apart from one or two syntax error messages, and ignoring IFS if present in the environment, this is intended to have no user visible changes. (from kre@)
|
#
1.47 |
|
04-Jan-2016 |
christos |
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 tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
|
#
1.46 |
|
30-Oct-2013 |
mrg |
#ifdef a variable decl/setting with it's use.
|
Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.45 |
|
28-Mar-2012 |
christos |
branches: 1.45.2; include <limits.h> for CHAR_MIN/CHAR_MAX
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase
|
#
1.44 |
|
17-Feb-2011 |
pooka |
branches: 1.44.4; 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 tags: bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.43 |
|
30-Aug-2010 |
christos |
branches: 1.43.2; dprintf is claimed by posix.
|
Revision tags: matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
|
#
1.42 |
|
10-Mar-2009 |
roy |
el_gets now sets el_len to -1 on error so we can distinguish between a NULL string and an error. This fixes sh from exiting with libedit now allowing EINTR to return. We may need to expand this to an errno check in the future.
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
|
#
1.41 |
|
16-Oct-2008 |
dholland |
branches: 1.41.4; Use "extern" properly for referencing globals defined in other modules. Now builds cleanly with -warn-common.
|
Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
|
#
1.40 |
|
15-Feb-2007 |
rillig |
Since interpreting ELF binaries as shell scripts is not very useful, and since the current error message is less than helpful, improve it.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 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-3-1-1-RELEASE netbsd-3-0-3-RELEASE wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-4-base netbsd-3-0-1-RELEASE 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-2-0-3-RELEASE 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-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-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-base
|
#
1.39 |
|
07-Aug-2003 |
agc |
Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
|
#
1.38 |
|
15-May-2003 |
dsl |
Don't close any script files if vfork is set. If a fork() is done later in order to feed a 'here' document into a pipe then it is possible that one end of the pipe might get closed.
|
Revision tags: fvdl_fs64_base
|
#
1.37 |
|
24-Nov-2002 |
christos |
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...)
|
#
1.36 |
|
27-Sep-2002 |
christos |
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 tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base ELRICshvfork-base
|
#
1.35 |
|
04-Feb-2001 |
christos |
branches: 1.35.2; remove redundant declarations and nexted externs.
|
Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
|
#
1.34 |
|
22-May-2000 |
elric |
Back out previous vfork changes.
|
#
1.33 |
|
13-May-2000 |
elric |
Now we use vfork(2) instead of fork(2) when we can.
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.32 |
|
09-Jul-1999 |
christos |
compile with WARNS = 2
|
Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
|
#
1.31 |
|
20-May-1998 |
christos |
Simplify interface for general use.
|
#
1.30 |
|
20-May-1998 |
christos |
fix bug where if moving in history during a multi-line event, the append to history event would end up in the last event where the history was moved to instead of the multi-line event; reported by Mycroft
|
#
1.29 |
|
29-Mar-1998 |
mrg |
- change "extern" variables into int's - remove extern'd variables not actually referenced - don't use char as an array index
|
Revision tags: netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.28 |
|
14-Oct-1997 |
christos |
branches: 1.28.2; PR/4257: Jaromir Dolecek: Update for libedit interface change.
|
#
1.27 |
|
04-Jul-1997 |
christos |
Fix compiler warnings.
|
#
1.26 |
|
11-Apr-1997 |
christos |
Rename pread to preadfd
|
#
1.25 |
|
14-Mar-1997 |
christos |
NO_HISTORY->SMALL
|
#
1.24 |
|
13-Mar-1997 |
christos |
Fix problems with -DNO_HISTORY
|
#
1.23 |
|
13-Mar-1997 |
mycroft |
Set input files to close-on-exec mode.
|
#
1.22 |
|
11-Jan-1997 |
tls |
kill 'register'
|
#
1.21 |
|
02-Nov-1996 |
christos |
Fix problems that gcc -Wall found (from Todd Miller, OpenBSD)
|
#
1.20 |
|
16-Oct-1996 |
christos |
PR/2808: Remove trailing whitespace (from FreeBSD)
|
Revision tags: netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
|
#
1.19 |
|
19-Oct-1995 |
christos |
branches: 1.19.4; - fix PR1620, -DNO_HISTORY did not work. - restore parsing state after parsing old style command substitution. The ';' in '`echo z;`' broke the following: for i in 1; do cat > /dev/tty << __EOF__ `echo z;` __EOF__ done
cVS: Enter Log. Lines beginning with `CVS: ' are removed automatically
|
Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
|
#
1.18 |
|
06-Oct-1995 |
christos |
fixed previous booboo that broke command line editing input.
|
#
1.17 |
|
26-Sep-1995 |
christos |
- Fix -v flag, so that it works properly when the shell reads from scripts. - Bad style to fix my own PR, but I'd like to commit the parallel make changes soon, and this is a necessary prerequisite.
|
#
1.16 |
|
09-Jun-1995 |
christos |
Changed so that 'PATH=newpath command' works, instead of looking at the old path. Synced input.c with vangogh.
|
#
1.15 |
|
07-Jun-1995 |
cgd |
needs string.h
|
#
1.14 |
|
11-May-1995 |
christos |
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0 bug.
|
#
1.13 |
|
21-Mar-1995 |
cgd |
convert to new RCS id conventions.
|
#
1.12 |
|
23-Dec-1994 |
cgd |
pull prototypes into scope for string functions.
|
#
1.11 |
|
04-Dec-1994 |
cgd |
from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch some of the worst style errors.
|
Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
|
#
1.10 |
|
11-Jun-1994 |
mycroft |
Add RCS ids.
|
#
1.9 |
|
08-Jun-1994 |
jtc |
Fix from Christos for when NO_HISTORY is defined
|
#
1.8 |
|
21-May-1994 |
cgd |
a few more things to omit when NO_HISTORY defined. from noel@cs.oberlin.edu
|
#
1.7 |
|
14-May-1994 |
cgd |
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).
|
#
1.6 |
|
12-May-1994 |
jtc |
Include appropriate header files to bring function prototypes into scope.
|
#
1.5 |
|
11-May-1994 |
jtc |
sync with 4.4lite
|
#
1.4 |
|
01-Aug-1993 |
mycroft |
Add RCS identifiers.
|
Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
|
#
1.3 |
|
23-Mar-1993 |
cgd |
changed "Id" to "Header" for rcsids
|
#
1.2 |
|
22-Mar-1993 |
cgd |
added rcs ids to all files
|
#
1.1 |
|
21-Mar-1993 |
cgd |
branches: 1.1.1; Initial revision
|
#
1.59 |
|
30-Jun-2017 |
kre |
Implement PS1, PS2 and PS4 expansions (variable expansions, arithmetic expansions, and if enabled by the promptcmds option, command substitutions.)
|
#
1.58 |
|
07-Jun-2017 |
kre |
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.
|
#
1.57 |
|
07-Jun-2017 |
kre |
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 tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2
|
#
1.56 |
|
03-May-2017 |
kre |
Another fix from FreeBSD. I'm not sure how to trigger the problem fixed (there might be no way) - but it "feels right"!
When popping an (exhausted) input string off the input stack, allow for the possibility that the previous string might also just happened to have run out of steam as well, so keep poppin' along until we run out of pop, or find something to consume.
|
#
1.55 |
|
03-May-2017 |
kre |
Deal with \newline line continuations more correctly. They can occur anywhere (*anywhere*) not only where it happens to be convenient to the parser...
This fix from FreeBSD (thanks again folks).
To make this work, pushstring()'s signature needed to change to allow a const char * as its string arg, which meant sprinkling some const other places for a brighter appearance (and handling fallout).
All this because I wanted to see what number would come from
echo $\ {\ L\ I\ N\ E\ N\ O\ }
and was surprised at the result! That works now...
The bug would also affect stuff like
true &\ & false
and all kinds of other uses where the \newline occurred in the "wrong" place.
An ATF test for sh syntax is coming... (sometime.)
|
#
1.54 |
|
03-May-2017 |
kre |
Fix idiot typos in previous (this is not the advertised :next commit") Same typo - two different places. Ugh!
|
#
1.53 |
|
03-May-2017 |
kre |
NFC: Change prototype of pushstring() to give a real type for the 3rd arg (struct alias *) rather than using void * and then casting it when used. For callers, the arg either is a struct alias *, or is NULL, so nothing to adjust there.
NB: This change untested by itself, it was going to be a part of the next change (coming in a few minutes) but is logically unrelated, so ...
|
Revision tags: prg-localcount2-base1
|
#
1.52 |
|
29-Apr-2017 |
kre |
Keep track of which file descriptors the shell is using for its own purposes, and move them elsewhere whenever a user redirection happens to pick the same number. With this we can move the shell file descriptors back to lower values (be slightly kinder to the kernel) since we can no longer clash. (Also get rid of a little old unneeded code.)
This also completes the fdflags command, which no longer permits access to (by way or either obtaining, or changing) the shell's internal fds.
|
Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.51 |
|
01-Jun-2016 |
kre |
branches: 1.51.6;
PR bin/51207 Only check for ELF bnaries in regular files.
|
#
1.50 |
|
07-May-2016 |
kre |
PR bin/51119 - don't leak FDs in unusual error cases. OK christos@
|
#
1.49 |
|
02-May-2016 |
christos |
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@)
|
#
1.48 |
|
27-Mar-2016 |
christos |
General KNF and source code cleanups, avoid scattering the magic string " \t\n" all over the place, slightly improved syntax error messages, restructured some of the code for clarity, don't allow IFS to be imported through the environment, and remove the (never) conditionally compiled ATTY option. Apart from one or two syntax error messages, and ignoring IFS if present in the environment, this is intended to have no user visible changes. (from kre@)
|
#
1.47 |
|
04-Jan-2016 |
christos |
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 tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
|
#
1.46 |
|
30-Oct-2013 |
mrg |
#ifdef a variable decl/setting with it's use.
|
Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.45 |
|
28-Mar-2012 |
christos |
branches: 1.45.2; include <limits.h> for CHAR_MIN/CHAR_MAX
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase
|
#
1.44 |
|
17-Feb-2011 |
pooka |
branches: 1.44.4; 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 tags: bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.43 |
|
30-Aug-2010 |
christos |
branches: 1.43.2; dprintf is claimed by posix.
|
Revision tags: matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
|
#
1.42 |
|
10-Mar-2009 |
roy |
el_gets now sets el_len to -1 on error so we can distinguish between a NULL string and an error. This fixes sh from exiting with libedit now allowing EINTR to return. We may need to expand this to an errno check in the future.
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
|
#
1.41 |
|
16-Oct-2008 |
dholland |
branches: 1.41.4; Use "extern" properly for referencing globals defined in other modules. Now builds cleanly with -warn-common.
|
Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
|
#
1.40 |
|
15-Feb-2007 |
rillig |
Since interpreting ELF binaries as shell scripts is not very useful, and since the current error message is less than helpful, improve it.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 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-3-1-1-RELEASE netbsd-3-0-3-RELEASE wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-4-base netbsd-3-0-1-RELEASE 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-2-0-3-RELEASE 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-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-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-base
|
#
1.39 |
|
07-Aug-2003 |
agc |
Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
|
#
1.38 |
|
15-May-2003 |
dsl |
Don't close any script files if vfork is set. If a fork() is done later in order to feed a 'here' document into a pipe then it is possible that one end of the pipe might get closed.
|
Revision tags: fvdl_fs64_base
|
#
1.37 |
|
24-Nov-2002 |
christos |
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...)
|
#
1.36 |
|
27-Sep-2002 |
christos |
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 tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base ELRICshvfork-base
|
#
1.35 |
|
04-Feb-2001 |
christos |
branches: 1.35.2; remove redundant declarations and nexted externs.
|
Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
|
#
1.34 |
|
22-May-2000 |
elric |
Back out previous vfork changes.
|
#
1.33 |
|
13-May-2000 |
elric |
Now we use vfork(2) instead of fork(2) when we can.
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.32 |
|
09-Jul-1999 |
christos |
compile with WARNS = 2
|
Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
|
#
1.31 |
|
20-May-1998 |
christos |
Simplify interface for general use.
|
#
1.30 |
|
20-May-1998 |
christos |
fix bug where if moving in history during a multi-line event, the append to history event would end up in the last event where the history was moved to instead of the multi-line event; reported by Mycroft
|
#
1.29 |
|
29-Mar-1998 |
mrg |
- change "extern" variables into int's - remove extern'd variables not actually referenced - don't use char as an array index
|
Revision tags: netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.28 |
|
14-Oct-1997 |
christos |
branches: 1.28.2; PR/4257: Jaromir Dolecek: Update for libedit interface change.
|
#
1.27 |
|
04-Jul-1997 |
christos |
Fix compiler warnings.
|
#
1.26 |
|
11-Apr-1997 |
christos |
Rename pread to preadfd
|
#
1.25 |
|
14-Mar-1997 |
christos |
NO_HISTORY->SMALL
|
#
1.24 |
|
13-Mar-1997 |
christos |
Fix problems with -DNO_HISTORY
|
#
1.23 |
|
13-Mar-1997 |
mycroft |
Set input files to close-on-exec mode.
|
#
1.22 |
|
11-Jan-1997 |
tls |
kill 'register'
|
#
1.21 |
|
02-Nov-1996 |
christos |
Fix problems that gcc -Wall found (from Todd Miller, OpenBSD)
|
#
1.20 |
|
16-Oct-1996 |
christos |
PR/2808: Remove trailing whitespace (from FreeBSD)
|
Revision tags: netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
|
#
1.19 |
|
19-Oct-1995 |
christos |
branches: 1.19.4; - fix PR1620, -DNO_HISTORY did not work. - restore parsing state after parsing old style command substitution. The ';' in '`echo z;`' broke the following: for i in 1; do cat > /dev/tty << __EOF__ `echo z;` __EOF__ done
cVS: Enter Log. Lines beginning with `CVS: ' are removed automatically
|
Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
|
#
1.18 |
|
06-Oct-1995 |
christos |
fixed previous booboo that broke command line editing input.
|
#
1.17 |
|
26-Sep-1995 |
christos |
- Fix -v flag, so that it works properly when the shell reads from scripts. - Bad style to fix my own PR, but I'd like to commit the parallel make changes soon, and this is a necessary prerequisite.
|
#
1.16 |
|
09-Jun-1995 |
christos |
Changed so that 'PATH=newpath command' works, instead of looking at the old path. Synced input.c with vangogh.
|
#
1.15 |
|
07-Jun-1995 |
cgd |
needs string.h
|
#
1.14 |
|
11-May-1995 |
christos |
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0 bug.
|
#
1.13 |
|
21-Mar-1995 |
cgd |
convert to new RCS id conventions.
|
#
1.12 |
|
23-Dec-1994 |
cgd |
pull prototypes into scope for string functions.
|
#
1.11 |
|
04-Dec-1994 |
cgd |
from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch some of the worst style errors.
|
Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
|
#
1.10 |
|
11-Jun-1994 |
mycroft |
Add RCS ids.
|
#
1.9 |
|
08-Jun-1994 |
jtc |
Fix from Christos for when NO_HISTORY is defined
|
#
1.8 |
|
21-May-1994 |
cgd |
a few more things to omit when NO_HISTORY defined. from noel@cs.oberlin.edu
|
#
1.7 |
|
14-May-1994 |
cgd |
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).
|
#
1.6 |
|
12-May-1994 |
jtc |
Include appropriate header files to bring function prototypes into scope.
|
#
1.5 |
|
11-May-1994 |
jtc |
sync with 4.4lite
|
#
1.4 |
|
01-Aug-1993 |
mycroft |
Add RCS identifiers.
|
Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
|
#
1.3 |
|
23-Mar-1993 |
cgd |
changed "Id" to "Header" for rcsids
|
#
1.2 |
|
22-Mar-1993 |
cgd |
added rcs ids to all files
|
#
1.1 |
|
21-Mar-1993 |
cgd |
branches: 1.1.1; Initial revision
|
#
1.58 |
|
07-Jun-2017 |
kre |
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.
|
#
1.57 |
|
07-Jun-2017 |
kre |
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 tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2
|
#
1.56 |
|
03-May-2017 |
kre |
Another fix from FreeBSD. I'm not sure how to trigger the problem fixed (there might be no way) - but it "feels right"!
When popping an (exhausted) input string off the input stack, allow for the possibility that the previous string might also just happened to have run out of steam as well, so keep poppin' along until we run out of pop, or find something to consume.
|
#
1.55 |
|
03-May-2017 |
kre |
Deal with \newline line continuations more correctly. They can occur anywhere (*anywhere*) not only where it happens to be convenient to the parser...
This fix from FreeBSD (thanks again folks).
To make this work, pushstring()'s signature needed to change to allow a const char * as its string arg, which meant sprinkling some const other places for a brighter appearance (and handling fallout).
All this because I wanted to see what number would come from
echo $\ {\ L\ I\ N\ E\ N\ O\ }
and was surprised at the result! That works now...
The bug would also affect stuff like
true &\ & false
and all kinds of other uses where the \newline occurred in the "wrong" place.
An ATF test for sh syntax is coming... (sometime.)
|
#
1.54 |
|
03-May-2017 |
kre |
Fix idiot typos in previous (this is not the advertised :next commit") Same typo - two different places. Ugh!
|
#
1.53 |
|
03-May-2017 |
kre |
NFC: Change prototype of pushstring() to give a real type for the 3rd arg (struct alias *) rather than using void * and then casting it when used. For callers, the arg either is a struct alias *, or is NULL, so nothing to adjust there.
NB: This change untested by itself, it was going to be a part of the next change (coming in a few minutes) but is logically unrelated, so ...
|
Revision tags: prg-localcount2-base1
|
#
1.52 |
|
29-Apr-2017 |
kre |
Keep track of which file descriptors the shell is using for its own purposes, and move them elsewhere whenever a user redirection happens to pick the same number. With this we can move the shell file descriptors back to lower values (be slightly kinder to the kernel) since we can no longer clash. (Also get rid of a little old unneeded code.)
This also completes the fdflags command, which no longer permits access to (by way or either obtaining, or changing) the shell's internal fds.
|
Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.51 |
|
01-Jun-2016 |
kre |
branches: 1.51.6;
PR bin/51207 Only check for ELF bnaries in regular files.
|
#
1.50 |
|
07-May-2016 |
kre |
PR bin/51119 - don't leak FDs in unusual error cases. OK christos@
|
#
1.49 |
|
02-May-2016 |
christos |
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@)
|
#
1.48 |
|
27-Mar-2016 |
christos |
General KNF and source code cleanups, avoid scattering the magic string " \t\n" all over the place, slightly improved syntax error messages, restructured some of the code for clarity, don't allow IFS to be imported through the environment, and remove the (never) conditionally compiled ATTY option. Apart from one or two syntax error messages, and ignoring IFS if present in the environment, this is intended to have no user visible changes. (from kre@)
|
#
1.47 |
|
04-Jan-2016 |
christos |
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 tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
|
#
1.46 |
|
30-Oct-2013 |
mrg |
#ifdef a variable decl/setting with it's use.
|
Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.45 |
|
28-Mar-2012 |
christos |
branches: 1.45.2; include <limits.h> for CHAR_MIN/CHAR_MAX
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase
|
#
1.44 |
|
17-Feb-2011 |
pooka |
branches: 1.44.4; 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 tags: bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.43 |
|
30-Aug-2010 |
christos |
branches: 1.43.2; dprintf is claimed by posix.
|
Revision tags: matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
|
#
1.42 |
|
10-Mar-2009 |
roy |
el_gets now sets el_len to -1 on error so we can distinguish between a NULL string and an error. This fixes sh from exiting with libedit now allowing EINTR to return. We may need to expand this to an errno check in the future.
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
|
#
1.41 |
|
16-Oct-2008 |
dholland |
branches: 1.41.4; Use "extern" properly for referencing globals defined in other modules. Now builds cleanly with -warn-common.
|
Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
|
#
1.40 |
|
15-Feb-2007 |
rillig |
Since interpreting ELF binaries as shell scripts is not very useful, and since the current error message is less than helpful, improve it.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 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-3-1-1-RELEASE netbsd-3-0-3-RELEASE wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-4-base netbsd-3-0-1-RELEASE 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-2-0-3-RELEASE 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-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-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-base
|
#
1.39 |
|
07-Aug-2003 |
agc |
Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
|
#
1.38 |
|
15-May-2003 |
dsl |
Don't close any script files if vfork is set. If a fork() is done later in order to feed a 'here' document into a pipe then it is possible that one end of the pipe might get closed.
|
Revision tags: fvdl_fs64_base
|
#
1.37 |
|
24-Nov-2002 |
christos |
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...)
|
#
1.36 |
|
27-Sep-2002 |
christos |
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 tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base ELRICshvfork-base
|
#
1.35 |
|
04-Feb-2001 |
christos |
branches: 1.35.2; remove redundant declarations and nexted externs.
|
Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
|
#
1.34 |
|
22-May-2000 |
elric |
Back out previous vfork changes.
|
#
1.33 |
|
13-May-2000 |
elric |
Now we use vfork(2) instead of fork(2) when we can.
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.32 |
|
09-Jul-1999 |
christos |
compile with WARNS = 2
|
Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
|
#
1.31 |
|
20-May-1998 |
christos |
Simplify interface for general use.
|
#
1.30 |
|
20-May-1998 |
christos |
fix bug where if moving in history during a multi-line event, the append to history event would end up in the last event where the history was moved to instead of the multi-line event; reported by Mycroft
|
#
1.29 |
|
29-Mar-1998 |
mrg |
- change "extern" variables into int's - remove extern'd variables not actually referenced - don't use char as an array index
|
Revision tags: netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.28 |
|
14-Oct-1997 |
christos |
branches: 1.28.2; PR/4257: Jaromir Dolecek: Update for libedit interface change.
|
#
1.27 |
|
04-Jul-1997 |
christos |
Fix compiler warnings.
|
#
1.26 |
|
11-Apr-1997 |
christos |
Rename pread to preadfd
|
#
1.25 |
|
14-Mar-1997 |
christos |
NO_HISTORY->SMALL
|
#
1.24 |
|
13-Mar-1997 |
christos |
Fix problems with -DNO_HISTORY
|
#
1.23 |
|
13-Mar-1997 |
mycroft |
Set input files to close-on-exec mode.
|
#
1.22 |
|
11-Jan-1997 |
tls |
kill 'register'
|
#
1.21 |
|
02-Nov-1996 |
christos |
Fix problems that gcc -Wall found (from Todd Miller, OpenBSD)
|
#
1.20 |
|
16-Oct-1996 |
christos |
PR/2808: Remove trailing whitespace (from FreeBSD)
|
Revision tags: netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
|
#
1.19 |
|
19-Oct-1995 |
christos |
branches: 1.19.4; - fix PR1620, -DNO_HISTORY did not work. - restore parsing state after parsing old style command substitution. The ';' in '`echo z;`' broke the following: for i in 1; do cat > /dev/tty << __EOF__ `echo z;` __EOF__ done
cVS: Enter Log. Lines beginning with `CVS: ' are removed automatically
|
Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
|
#
1.18 |
|
06-Oct-1995 |
christos |
fixed previous booboo that broke command line editing input.
|
#
1.17 |
|
26-Sep-1995 |
christos |
- Fix -v flag, so that it works properly when the shell reads from scripts. - Bad style to fix my own PR, but I'd like to commit the parallel make changes soon, and this is a necessary prerequisite.
|
#
1.16 |
|
09-Jun-1995 |
christos |
Changed so that 'PATH=newpath command' works, instead of looking at the old path. Synced input.c with vangogh.
|
#
1.15 |
|
07-Jun-1995 |
cgd |
needs string.h
|
#
1.14 |
|
11-May-1995 |
christos |
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0 bug.
|
#
1.13 |
|
21-Mar-1995 |
cgd |
convert to new RCS id conventions.
|
#
1.12 |
|
23-Dec-1994 |
cgd |
pull prototypes into scope for string functions.
|
#
1.11 |
|
04-Dec-1994 |
cgd |
from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch some of the worst style errors.
|
Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
|
#
1.10 |
|
11-Jun-1994 |
mycroft |
Add RCS ids.
|
#
1.9 |
|
08-Jun-1994 |
jtc |
Fix from Christos for when NO_HISTORY is defined
|
#
1.8 |
|
21-May-1994 |
cgd |
a few more things to omit when NO_HISTORY defined. from noel@cs.oberlin.edu
|
#
1.7 |
|
14-May-1994 |
cgd |
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).
|
#
1.6 |
|
12-May-1994 |
jtc |
Include appropriate header files to bring function prototypes into scope.
|
#
1.5 |
|
11-May-1994 |
jtc |
sync with 4.4lite
|
#
1.4 |
|
01-Aug-1993 |
mycroft |
Add RCS identifiers.
|
Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
|
#
1.3 |
|
23-Mar-1993 |
cgd |
changed "Id" to "Header" for rcsids
|
#
1.2 |
|
22-Mar-1993 |
cgd |
added rcs ids to all files
|
#
1.1 |
|
21-Mar-1993 |
cgd |
branches: 1.1.1; Initial revision
|
#
1.56 |
|
03-May-2017 |
kre |
Another fix from FreeBSD. I'm not sure how to trigger the problem fixed (there might be no way) - but it "feels right"!
When popping an (exhausted) input string off the input stack, allow for the possibility that the previous string might also just happened to have run out of steam as well, so keep poppin' along until we run out of pop, or find something to consume.
|
#
1.55 |
|
03-May-2017 |
kre |
Deal with \newline line continuations more correctly. They can occur anywhere (*anywhere*) not only where it happens to be convenient to the parser...
This fix from FreeBSD (thanks again folks).
To make this work, pushstring()'s signature needed to change to allow a const char * as its string arg, which meant sprinkling some const other places for a brighter appearance (and handling fallout).
All this because I wanted to see what number would come from
echo $\ {\ L\ I\ N\ E\ N\ O\ }
and was surprised at the result! That works now...
The bug would also affect stuff like
true &\ & false
and all kinds of other uses where the \newline occurred in the "wrong" place.
An ATF test for sh syntax is coming... (sometime.)
|
#
1.54 |
|
03-May-2017 |
kre |
Fix idiot typos in previous (this is not the advertised :next commit") Same typo - two different places. Ugh!
|
#
1.53 |
|
03-May-2017 |
kre |
NFC: Change prototype of pushstring() to give a real type for the 3rd arg (struct alias *) rather than using void * and then casting it when used. For callers, the arg either is a struct alias *, or is NULL, so nothing to adjust there.
NB: This change untested by itself, it was going to be a part of the next change (coming in a few minutes) but is logically unrelated, so ...
|
Revision tags: prg-localcount2-base1
|
#
1.52 |
|
29-Apr-2017 |
kre |
Keep track of which file descriptors the shell is using for its own purposes, and move them elsewhere whenever a user redirection happens to pick the same number. With this we can move the shell file descriptors back to lower values (be slightly kinder to the kernel) since we can no longer clash. (Also get rid of a little old unneeded code.)
This also completes the fdflags command, which no longer permits access to (by way or either obtaining, or changing) the shell's internal fds.
|
Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.51 |
|
01-Jun-2016 |
kre |
branches: 1.51.6;
PR bin/51207 Only check for ELF bnaries in regular files.
|
#
1.50 |
|
07-May-2016 |
kre |
PR bin/51119 - don't leak FDs in unusual error cases. OK christos@
|
#
1.49 |
|
02-May-2016 |
christos |
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@)
|
#
1.48 |
|
27-Mar-2016 |
christos |
General KNF and source code cleanups, avoid scattering the magic string " \t\n" all over the place, slightly improved syntax error messages, restructured some of the code for clarity, don't allow IFS to be imported through the environment, and remove the (never) conditionally compiled ATTY option. Apart from one or two syntax error messages, and ignoring IFS if present in the environment, this is intended to have no user visible changes. (from kre@)
|
#
1.47 |
|
04-Jan-2016 |
christos |
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 tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
|
#
1.46 |
|
30-Oct-2013 |
mrg |
#ifdef a variable decl/setting with it's use.
|
Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.45 |
|
28-Mar-2012 |
christos |
branches: 1.45.2; include <limits.h> for CHAR_MIN/CHAR_MAX
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase
|
#
1.44 |
|
17-Feb-2011 |
pooka |
branches: 1.44.4; 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 tags: bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.43 |
|
30-Aug-2010 |
christos |
branches: 1.43.2; dprintf is claimed by posix.
|
Revision tags: matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
|
#
1.42 |
|
10-Mar-2009 |
roy |
el_gets now sets el_len to -1 on error so we can distinguish between a NULL string and an error. This fixes sh from exiting with libedit now allowing EINTR to return. We may need to expand this to an errno check in the future.
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
|
#
1.41 |
|
16-Oct-2008 |
dholland |
branches: 1.41.4; Use "extern" properly for referencing globals defined in other modules. Now builds cleanly with -warn-common.
|
Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
|
#
1.40 |
|
15-Feb-2007 |
rillig |
Since interpreting ELF binaries as shell scripts is not very useful, and since the current error message is less than helpful, improve it.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 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-3-1-1-RELEASE netbsd-3-0-3-RELEASE wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-4-base netbsd-3-0-1-RELEASE 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-2-0-3-RELEASE 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-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-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-base
|
#
1.39 |
|
07-Aug-2003 |
agc |
Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
|
#
1.38 |
|
15-May-2003 |
dsl |
Don't close any script files if vfork is set. If a fork() is done later in order to feed a 'here' document into a pipe then it is possible that one end of the pipe might get closed.
|
Revision tags: fvdl_fs64_base
|
#
1.37 |
|
24-Nov-2002 |
christos |
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...)
|
#
1.36 |
|
27-Sep-2002 |
christos |
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 tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base ELRICshvfork-base
|
#
1.35 |
|
04-Feb-2001 |
christos |
branches: 1.35.2; remove redundant declarations and nexted externs.
|
Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
|
#
1.34 |
|
22-May-2000 |
elric |
Back out previous vfork changes.
|
#
1.33 |
|
13-May-2000 |
elric |
Now we use vfork(2) instead of fork(2) when we can.
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.32 |
|
09-Jul-1999 |
christos |
compile with WARNS = 2
|
Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
|
#
1.31 |
|
20-May-1998 |
christos |
Simplify interface for general use.
|
#
1.30 |
|
20-May-1998 |
christos |
fix bug where if moving in history during a multi-line event, the append to history event would end up in the last event where the history was moved to instead of the multi-line event; reported by Mycroft
|
#
1.29 |
|
29-Mar-1998 |
mrg |
- change "extern" variables into int's - remove extern'd variables not actually referenced - don't use char as an array index
|
Revision tags: netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.28 |
|
14-Oct-1997 |
christos |
branches: 1.28.2; PR/4257: Jaromir Dolecek: Update for libedit interface change.
|
#
1.27 |
|
04-Jul-1997 |
christos |
Fix compiler warnings.
|
#
1.26 |
|
11-Apr-1997 |
christos |
Rename pread to preadfd
|
#
1.25 |
|
14-Mar-1997 |
christos |
NO_HISTORY->SMALL
|
#
1.24 |
|
13-Mar-1997 |
christos |
Fix problems with -DNO_HISTORY
|
#
1.23 |
|
13-Mar-1997 |
mycroft |
Set input files to close-on-exec mode.
|
#
1.22 |
|
11-Jan-1997 |
tls |
kill 'register'
|
#
1.21 |
|
02-Nov-1996 |
christos |
Fix problems that gcc -Wall found (from Todd Miller, OpenBSD)
|
#
1.20 |
|
16-Oct-1996 |
christos |
PR/2808: Remove trailing whitespace (from FreeBSD)
|
Revision tags: netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
|
#
1.19 |
|
19-Oct-1995 |
christos |
branches: 1.19.4; - fix PR1620, -DNO_HISTORY did not work. - restore parsing state after parsing old style command substitution. The ';' in '`echo z;`' broke the following: for i in 1; do cat > /dev/tty << __EOF__ `echo z;` __EOF__ done
cVS: Enter Log. Lines beginning with `CVS: ' are removed automatically
|
Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
|
#
1.18 |
|
06-Oct-1995 |
christos |
fixed previous booboo that broke command line editing input.
|
#
1.17 |
|
26-Sep-1995 |
christos |
- Fix -v flag, so that it works properly when the shell reads from scripts. - Bad style to fix my own PR, but I'd like to commit the parallel make changes soon, and this is a necessary prerequisite.
|
#
1.16 |
|
09-Jun-1995 |
christos |
Changed so that 'PATH=newpath command' works, instead of looking at the old path. Synced input.c with vangogh.
|
#
1.15 |
|
07-Jun-1995 |
cgd |
needs string.h
|
#
1.14 |
|
11-May-1995 |
christos |
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0 bug.
|
#
1.13 |
|
21-Mar-1995 |
cgd |
convert to new RCS id conventions.
|
#
1.12 |
|
23-Dec-1994 |
cgd |
pull prototypes into scope for string functions.
|
#
1.11 |
|
04-Dec-1994 |
cgd |
from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch some of the worst style errors.
|
Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
|
#
1.10 |
|
11-Jun-1994 |
mycroft |
Add RCS ids.
|
#
1.9 |
|
08-Jun-1994 |
jtc |
Fix from Christos for when NO_HISTORY is defined
|
#
1.8 |
|
21-May-1994 |
cgd |
a few more things to omit when NO_HISTORY defined. from noel@cs.oberlin.edu
|
#
1.7 |
|
14-May-1994 |
cgd |
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).
|
#
1.6 |
|
12-May-1994 |
jtc |
Include appropriate header files to bring function prototypes into scope.
|
#
1.5 |
|
11-May-1994 |
jtc |
sync with 4.4lite
|
#
1.4 |
|
01-Aug-1993 |
mycroft |
Add RCS identifiers.
|
Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
|
#
1.3 |
|
23-Mar-1993 |
cgd |
changed "Id" to "Header" for rcsids
|
#
1.2 |
|
22-Mar-1993 |
cgd |
added rcs ids to all files
|
#
1.1 |
|
21-Mar-1993 |
cgd |
branches: 1.1.1; Initial revision
|
#
1.52 |
|
29-Apr-2017 |
kre |
Keep track of which file descriptors the shell is using for its own purposes, and move them elsewhere whenever a user redirection happens to pick the same number. With this we can move the shell file descriptors back to lower values (be slightly kinder to the kernel) since we can no longer clash. (Also get rid of a little old unneeded code.)
This also completes the fdflags command, which no longer permits access to (by way or either obtaining, or changing) the shell's internal fds.
|
Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.51 |
|
01-Jun-2016 |
kre |
PR bin/51207 Only check for ELF bnaries in regular files.
|
#
1.50 |
|
07-May-2016 |
kre |
PR bin/51119 - don't leak FDs in unusual error cases. OK christos@
|
#
1.49 |
|
02-May-2016 |
christos |
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@)
|
#
1.48 |
|
27-Mar-2016 |
christos |
General KNF and source code cleanups, avoid scattering the magic string " \t\n" all over the place, slightly improved syntax error messages, restructured some of the code for clarity, don't allow IFS to be imported through the environment, and remove the (never) conditionally compiled ATTY option. Apart from one or two syntax error messages, and ignoring IFS if present in the environment, this is intended to have no user visible changes. (from kre@)
|
#
1.47 |
|
04-Jan-2016 |
christos |
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 tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
|
#
1.46 |
|
30-Oct-2013 |
mrg |
#ifdef a variable decl/setting with it's use.
|
Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.45 |
|
28-Mar-2012 |
christos |
branches: 1.45.2; include <limits.h> for CHAR_MIN/CHAR_MAX
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase
|
#
1.44 |
|
17-Feb-2011 |
pooka |
branches: 1.44.4; 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 tags: bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.43 |
|
30-Aug-2010 |
christos |
branches: 1.43.2; dprintf is claimed by posix.
|
Revision tags: matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
|
#
1.42 |
|
10-Mar-2009 |
roy |
el_gets now sets el_len to -1 on error so we can distinguish between a NULL string and an error. This fixes sh from exiting with libedit now allowing EINTR to return. We may need to expand this to an errno check in the future.
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
|
#
1.41 |
|
16-Oct-2008 |
dholland |
branches: 1.41.4; Use "extern" properly for referencing globals defined in other modules. Now builds cleanly with -warn-common.
|
Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
|
#
1.40 |
|
15-Feb-2007 |
rillig |
Since interpreting ELF binaries as shell scripts is not very useful, and since the current error message is less than helpful, improve it.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 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-3-1-1-RELEASE netbsd-3-0-3-RELEASE wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-4-base netbsd-3-0-1-RELEASE 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-2-0-3-RELEASE 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-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-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-base
|
#
1.39 |
|
07-Aug-2003 |
agc |
Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
|
#
1.38 |
|
15-May-2003 |
dsl |
Don't close any script files if vfork is set. If a fork() is done later in order to feed a 'here' document into a pipe then it is possible that one end of the pipe might get closed.
|
Revision tags: fvdl_fs64_base
|
#
1.37 |
|
24-Nov-2002 |
christos |
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...)
|
#
1.36 |
|
27-Sep-2002 |
christos |
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 tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base ELRICshvfork-base
|
#
1.35 |
|
04-Feb-2001 |
christos |
branches: 1.35.2; remove redundant declarations and nexted externs.
|
Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
|
#
1.34 |
|
22-May-2000 |
elric |
Back out previous vfork changes.
|
#
1.33 |
|
13-May-2000 |
elric |
Now we use vfork(2) instead of fork(2) when we can.
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.32 |
|
09-Jul-1999 |
christos |
compile with WARNS = 2
|
Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
|
#
1.31 |
|
20-May-1998 |
christos |
Simplify interface for general use.
|
#
1.30 |
|
20-May-1998 |
christos |
fix bug where if moving in history during a multi-line event, the append to history event would end up in the last event where the history was moved to instead of the multi-line event; reported by Mycroft
|
#
1.29 |
|
29-Mar-1998 |
mrg |
- change "extern" variables into int's - remove extern'd variables not actually referenced - don't use char as an array index
|
Revision tags: netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.28 |
|
14-Oct-1997 |
christos |
branches: 1.28.2; PR/4257: Jaromir Dolecek: Update for libedit interface change.
|
#
1.27 |
|
04-Jul-1997 |
christos |
Fix compiler warnings.
|
#
1.26 |
|
11-Apr-1997 |
christos |
Rename pread to preadfd
|
#
1.25 |
|
14-Mar-1997 |
christos |
NO_HISTORY->SMALL
|
#
1.24 |
|
13-Mar-1997 |
christos |
Fix problems with -DNO_HISTORY
|
#
1.23 |
|
13-Mar-1997 |
mycroft |
Set input files to close-on-exec mode.
|
#
1.22 |
|
11-Jan-1997 |
tls |
kill 'register'
|
#
1.21 |
|
02-Nov-1996 |
christos |
Fix problems that gcc -Wall found (from Todd Miller, OpenBSD)
|
#
1.20 |
|
16-Oct-1996 |
christos |
PR/2808: Remove trailing whitespace (from FreeBSD)
|
Revision tags: netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
|
#
1.19 |
|
19-Oct-1995 |
christos |
branches: 1.19.4; - fix PR1620, -DNO_HISTORY did not work. - restore parsing state after parsing old style command substitution. The ';' in '`echo z;`' broke the following: for i in 1; do cat > /dev/tty << __EOF__ `echo z;` __EOF__ done
cVS: Enter Log. Lines beginning with `CVS: ' are removed automatically
|
Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
|
#
1.18 |
|
06-Oct-1995 |
christos |
fixed previous booboo that broke command line editing input.
|
#
1.17 |
|
26-Sep-1995 |
christos |
- Fix -v flag, so that it works properly when the shell reads from scripts. - Bad style to fix my own PR, but I'd like to commit the parallel make changes soon, and this is a necessary prerequisite.
|
#
1.16 |
|
09-Jun-1995 |
christos |
Changed so that 'PATH=newpath command' works, instead of looking at the old path. Synced input.c with vangogh.
|
#
1.15 |
|
07-Jun-1995 |
cgd |
needs string.h
|
#
1.14 |
|
11-May-1995 |
christos |
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0 bug.
|
#
1.13 |
|
21-Mar-1995 |
cgd |
convert to new RCS id conventions.
|
#
1.12 |
|
23-Dec-1994 |
cgd |
pull prototypes into scope for string functions.
|
#
1.11 |
|
04-Dec-1994 |
cgd |
from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch some of the worst style errors.
|
Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
|
#
1.10 |
|
11-Jun-1994 |
mycroft |
Add RCS ids.
|
#
1.9 |
|
08-Jun-1994 |
jtc |
Fix from Christos for when NO_HISTORY is defined
|
#
1.8 |
|
21-May-1994 |
cgd |
a few more things to omit when NO_HISTORY defined. from noel@cs.oberlin.edu
|
#
1.7 |
|
14-May-1994 |
cgd |
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).
|
#
1.6 |
|
12-May-1994 |
jtc |
Include appropriate header files to bring function prototypes into scope.
|
#
1.5 |
|
11-May-1994 |
jtc |
sync with 4.4lite
|
#
1.4 |
|
01-Aug-1993 |
mycroft |
Add RCS identifiers.
|
Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
|
#
1.3 |
|
23-Mar-1993 |
cgd |
changed "Id" to "Header" for rcsids
|
#
1.2 |
|
22-Mar-1993 |
cgd |
added rcs ids to all files
|
#
1.1 |
|
21-Mar-1993 |
cgd |
branches: 1.1.1; Initial revision
|
Revision tags: pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.51 |
|
31-May-2016 |
kre |
PR bin/51207 Only check for ELF bnaries in regular files.
|
#
1.50 |
|
07-May-2016 |
kre |
PR bin/51119 - don't leak FDs in unusual error cases. OK christos@
|
#
1.49 |
|
01-May-2016 |
christos |
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@)
|
#
1.48 |
|
27-Mar-2016 |
christos |
General KNF and source code cleanups, avoid scattering the magic string " \t\n" all over the place, slightly improved syntax error messages, restructured some of the code for clarity, don't allow IFS to be imported through the environment, and remove the (never) conditionally compiled ATTY option. Apart from one or two syntax error messages, and ignoring IFS if present in the environment, this is intended to have no user visible changes. (from kre@)
|
#
1.47 |
|
03-Jan-2016 |
christos |
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 tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
|
#
1.46 |
|
30-Oct-2013 |
mrg |
#ifdef a variable decl/setting with it's use.
|
Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.45 |
|
28-Mar-2012 |
christos |
branches: 1.45.2; include <limits.h> for CHAR_MIN/CHAR_MAX
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase
|
#
1.44 |
|
17-Feb-2011 |
pooka |
branches: 1.44.4; 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 tags: bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.43 |
|
30-Aug-2010 |
christos |
branches: 1.43.2; dprintf is claimed by posix.
|
Revision tags: matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
|
#
1.42 |
|
10-Mar-2009 |
roy |
el_gets now sets el_len to -1 on error so we can distinguish between a NULL string and an error. This fixes sh from exiting with libedit now allowing EINTR to return. We may need to expand this to an errno check in the future.
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
|
#
1.41 |
|
16-Oct-2008 |
dholland |
branches: 1.41.4; Use "extern" properly for referencing globals defined in other modules. Now builds cleanly with -warn-common.
|
Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
|
#
1.40 |
|
14-Feb-2007 |
rillig |
Since interpreting ELF binaries as shell scripts is not very useful, and since the current error message is less than helpful, improve it.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 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-3-1-1-RELEASE netbsd-3-0-3-RELEASE wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-4-base netbsd-3-0-1-RELEASE 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-2-0-3-RELEASE 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-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-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-base
|
#
1.39 |
|
07-Aug-2003 |
agc |
Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
|
#
1.38 |
|
15-May-2003 |
dsl |
Don't close any script files if vfork is set. If a fork() is done later in order to feed a 'here' document into a pipe then it is possible that one end of the pipe might get closed.
|
Revision tags: fvdl_fs64_base
|
#
1.37 |
|
24-Nov-2002 |
christos |
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...)
|
#
1.36 |
|
27-Sep-2002 |
christos |
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 tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base ELRICshvfork-base
|
#
1.35 |
|
04-Feb-2001 |
christos |
branches: 1.35.2; remove redundant declarations and nexted externs.
|
Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
|
#
1.34 |
|
22-May-2000 |
elric |
Back out previous vfork changes.
|
#
1.33 |
|
13-May-2000 |
elric |
Now we use vfork(2) instead of fork(2) when we can.
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.32 |
|
08-Jul-1999 |
christos |
compile with WARNS = 2
|
Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
|
#
1.31 |
|
19-May-1998 |
christos |
Simplify interface for general use.
|
#
1.30 |
|
19-May-1998 |
christos |
fix bug where if moving in history during a multi-line event, the append to history event would end up in the last event where the history was moved to instead of the multi-line event; reported by Mycroft
|
#
1.29 |
|
28-Mar-1998 |
mrg |
- change "extern" variables into int's - remove extern'd variables not actually referenced - don't use char as an array index
|
Revision tags: netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.28 |
|
14-Oct-1997 |
christos |
branches: 1.28.2; PR/4257: Jaromir Dolecek: Update for libedit interface change.
|
#
1.27 |
|
04-Jul-1997 |
christos |
Fix compiler warnings.
|
#
1.26 |
|
11-Apr-1997 |
christos |
Rename pread to preadfd
|
#
1.25 |
|
13-Mar-1997 |
christos |
NO_HISTORY->SMALL
|
#
1.24 |
|
13-Mar-1997 |
christos |
Fix problems with -DNO_HISTORY
|
#
1.23 |
|
13-Mar-1997 |
mycroft |
Set input files to close-on-exec mode.
|
#
1.22 |
|
10-Jan-1997 |
tls |
kill 'register'
|
#
1.21 |
|
02-Nov-1996 |
christos |
Fix problems that gcc -Wall found (from Todd Miller, OpenBSD)
|
#
1.20 |
|
16-Oct-1996 |
christos |
PR/2808: Remove trailing whitespace (from FreeBSD)
|
Revision tags: netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
|
#
1.19 |
|
18-Oct-1995 |
christos |
branches: 1.19.4; - fix PR1620, -DNO_HISTORY did not work. - restore parsing state after parsing old style command substitution. The ';' in '`echo z;`' broke the following: for i in 1; do cat > /dev/tty << __EOF__ `echo z;` __EOF__ done
cVS: Enter Log. Lines beginning with `CVS: ' are removed automatically
|
Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
|
#
1.18 |
|
06-Oct-1995 |
christos |
fixed previous booboo that broke command line editing input.
|
#
1.17 |
|
26-Sep-1995 |
christos |
- Fix -v flag, so that it works properly when the shell reads from scripts. - Bad style to fix my own PR, but I'd like to commit the parallel make changes soon, and this is a necessary prerequisite.
|
#
1.16 |
|
08-Jun-1995 |
christos |
Changed so that 'PATH=newpath command' works, instead of looking at the old path. Synced input.c with vangogh.
|
#
1.15 |
|
07-Jun-1995 |
cgd |
needs string.h
|
#
1.14 |
|
11-May-1995 |
christos |
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0 bug.
|
#
1.13 |
|
21-Mar-1995 |
cgd |
convert to new RCS id conventions.
|
#
1.12 |
|
23-Dec-1994 |
cgd |
pull prototypes into scope for string functions.
|
#
1.11 |
|
04-Dec-1994 |
cgd |
from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch some of the worst style errors.
|
Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
|
#
1.10 |
|
11-Jun-1994 |
mycroft |
Add RCS ids.
|
#
1.9 |
|
08-Jun-1994 |
jtc |
Fix from Christos for when NO_HISTORY is defined
|
#
1.8 |
|
20-May-1994 |
cgd |
a few more things to omit when NO_HISTORY defined. from noel@cs.oberlin.edu
|
#
1.7 |
|
14-May-1994 |
cgd |
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).
|
#
1.6 |
|
12-May-1994 |
jtc |
Include appropriate header files to bring function prototypes into scope.
|
#
1.5 |
|
11-May-1994 |
jtc |
sync with 4.4lite
|
#
1.4 |
|
01-Aug-1993 |
mycroft |
Add RCS identifiers.
|
Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
|
#
1.3 |
|
22-Mar-1993 |
cgd |
changed "Id" to "Header" for rcsids
|
#
1.2 |
|
22-Mar-1993 |
cgd |
added rcs ids to all files
|
#
1.1 |
|
21-Mar-1993 |
cgd |
branches: 1.1.1; Initial revision
|
#
1.46 |
|
30-Oct-2013 |
mrg |
#ifdef a variable decl/setting with it's use.
|
#
1.45 |
|
28-Mar-2012 |
christos |
branches: 1.45.2; include <limits.h> for CHAR_MIN/CHAR_MAX
|
#
1.44 |
|
17-Feb-2011 |
pooka |
branches: 1.44.4; 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
|
#
1.43 |
|
30-Aug-2010 |
christos |
branches: 1.43.2; dprintf is claimed by posix.
|
#
1.42 |
|
10-Mar-2009 |
roy |
el_gets now sets el_len to -1 on error so we can distinguish between a NULL string and an error. This fixes sh from exiting with libedit now allowing EINTR to return. We may need to expand this to an errno check in the future.
|
#
1.41 |
|
16-Oct-2008 |
dholland |
branches: 1.41.4; Use "extern" properly for referencing globals defined in other modules. Now builds cleanly with -warn-common.
|
#
1.40 |
|
15-Feb-2007 |
rillig |
Since interpreting ELF binaries as shell scripts is not very useful, and since the current error message is less than helpful, improve it.
|
#
1.39 |
|
07-Aug-2003 |
agc |
Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
|
#
1.38 |
|
15-May-2003 |
dsl |
Don't close any script files if vfork is set. If a fork() is done later in order to feed a 'here' document into a pipe then it is possible that one end of the pipe might get closed.
|
#
1.37 |
|
24-Nov-2002 |
christos |
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...)
|
#
1.36 |
|
27-Sep-2002 |
christos |
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.
|
#
1.35 |
|
04-Feb-2001 |
christos |
branches: 1.35.2; remove redundant declarations and nexted externs.
|
#
1.34 |
|
22-May-2000 |
elric |
Back out previous vfork changes.
|
#
1.33 |
|
13-May-2000 |
elric |
Now we use vfork(2) instead of fork(2) when we can.
|
#
1.32 |
|
08-Jul-1999 |
christos |
compile with WARNS = 2
|
#
1.31 |
|
19-May-1998 |
christos |
Simplify interface for general use.
|
#
1.30 |
|
19-May-1998 |
christos |
fix bug where if moving in history during a multi-line event, the append to history event would end up in the last event where the history was moved to instead of the multi-line event; reported by Mycroft
|
#
1.29 |
|
28-Mar-1998 |
mrg |
- change "extern" variables into int's - remove extern'd variables not actually referenced - don't use char as an array index
|
#
1.28 |
|
14-Oct-1997 |
christos |
branches: 1.28.2; PR/4257: Jaromir Dolecek: Update for libedit interface change.
|
#
1.27 |
|
04-Jul-1997 |
christos |
Fix compiler warnings.
|
#
1.26 |
|
11-Apr-1997 |
christos |
Rename pread to preadfd
|
#
1.25 |
|
13-Mar-1997 |
christos |
NO_HISTORY->SMALL
|
#
1.24 |
|
13-Mar-1997 |
christos |
Fix problems with -DNO_HISTORY
|
#
1.23 |
|
13-Mar-1997 |
mycroft |
Set input files to close-on-exec mode.
|
#
1.22 |
|
10-Jan-1997 |
tls |
kill 'register'
|
#
1.21 |
|
02-Nov-1996 |
christos |
Fix problems that gcc -Wall found (from Todd Miller, OpenBSD)
|
#
1.20 |
|
16-Oct-1996 |
christos |
PR/2808: Remove trailing whitespace (from FreeBSD)
|
#
1.19 |
|
18-Oct-1995 |
christos |
branches: 1.19.4; - fix PR1620, -DNO_HISTORY did not work. - restore parsing state after parsing old style command substitution. The ';' in '`echo z;`' broke the following: for i in 1; do cat > /dev/tty << __EOF__ `echo z;` __EOF__ done
cVS: Enter Log. Lines beginning with `CVS: ' are removed automatically
|
#
1.18 |
|
06-Oct-1995 |
christos |
fixed previous booboo that broke command line editing input.
|
#
1.17 |
|
26-Sep-1995 |
christos |
- Fix -v flag, so that it works properly when the shell reads from scripts. - Bad style to fix my own PR, but I'd like to commit the parallel make changes soon, and this is a necessary prerequisite.
|
#
1.16 |
|
08-Jun-1995 |
christos |
Changed so that 'PATH=newpath command' works, instead of looking at the old path. Synced input.c with vangogh.
|
#
1.15 |
|
06-Jun-1995 |
cgd |
needs string.h
|
#
1.14 |
|
11-May-1995 |
christos |
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0 bug.
|
#
1.13 |
|
21-Mar-1995 |
cgd |
convert to new RCS id conventions.
|
#
1.12 |
|
23-Dec-1994 |
cgd |
pull prototypes into scope for string functions.
|
#
1.11 |
|
04-Dec-1994 |
cgd |
from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch some of the worst style errors.
|
#
1.10 |
|
10-Jun-1994 |
mycroft |
Add RCS ids.
|
#
1.9 |
|
08-Jun-1994 |
jtc |
Fix from Christos for when NO_HISTORY is defined
|
#
1.8 |
|
20-May-1994 |
cgd |
a few more things to omit when NO_HISTORY defined. from noel@cs.oberlin.edu
|
#
1.7 |
|
14-May-1994 |
cgd |
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).
|
#
1.6 |
|
12-May-1994 |
jtc |
Include appropriate header files to bring function prototypes into scope.
|
#
1.5 |
|
11-May-1994 |
jtc |
sync with 4.4lite
|
#
1.4 |
|
01-Aug-1993 |
mycroft |
Add RCS identifiers.
|
#
1.3 |
|
22-Mar-1993 |
cgd |
changed "Id" to "Header" for rcsids
|
#
1.2 |
|
22-Mar-1993 |
cgd |
added rcs ids to all files
|
#
1.1 |
|
21-Mar-1993 |
cgd |
branches: 1.1.1; Initial revision
|
#
1.1.1.2 |
|
11-May-1994 |
jtc |
44lite code
|
#
1.1.1.1 |
|
21-Mar-1993 |
cgd |
initial import of 386bsd-0.1 sources
|
#
1.19.4.1 |
|
25-Jan-1997 |
rat |
Update /bin/sh from trunk per request of Christos Zoulas. Fixes many bugs.
|
#
1.28.2.1 |
|
08-May-1998 |
mycroft |
Sync with trunk, per request of christos.
|
#
1.35.2.1 |
|
27-Mar-2002 |
elric |
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
|
#
1.41.4.1 |
|
13-May-2009 |
jym |
Sync with HEAD.
Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
|
#
1.43.2.1 |
|
05-Mar-2011 |
bouyer |
Sync with HEAD
|
#
1.44.4.2 |
|
22-May-2014 |
yamt |
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")
|
#
1.44.4.1 |
|
16-Apr-2012 |
yamt |
sync with head
|
#
1.45.2.1 |
|
19-Aug-2014 |
tls |
Rebase to HEAD as of a few days ago.
|