| #
d73cf48c |
| 12-Jul-2024 |
kre <kre@NetBSD.org> |
Improve safety in var imports from the environment.
Add a new var flag VUNSAFE - set on all vars imported from the environment.
Add setvareqsafe() (which is to setvareq() as setvarsafe() is to setv
Improve safety in var imports from the environment.
Add a new var flag VUNSAFE - set on all vars imported from the environment.
Add setvareqsafe() (which is to setvareq() as setvarsafe() is to setvar()) and use that instead of setvareq() when processing the environment, so errors don't cause the shell to abort. Use VUNSAFE in that call.
Add flags arguments to all var callback functions which are used when setting variables, and pass the flags given to the setvar*() functions to those functions, so they can act differently in different situations (if desired). Most of them just ignore the flags.
When unsetting a variable, call setvar() to clear things (and call the callback function) both when the variable had a value which needs to be freed, and when unsetting a variable which wasn't unset previously, so the VUNSET flag can be seen by that callback func.
When setting HISTSIZE, use the flags passed to determine whether to ignore bad values (if VUNSAFE) or treat them as an error. This replaces the earlier temporary hack to always ignore bad data there (histedit.c 1.68).
Miscellaneous associated minor changes.
These changes should largely be invisible in normal use.
show more ...
|
| #
c7c0722a |
| 22-Jun-2018 |
kre <kre@NetBSD.org> |
Deal with ref after free found by ASAN when a function redefines itself, or some other function which is still active. This was a long known bug (fixed ages ago in the FreeBSD sh) which hadn't been f
Deal with ref after free found by ASAN when a function redefines itself, or some other function which is still active. This was a long known bug (fixed ages ago in the FreeBSD sh) which hadn't been fixed as in practice, the situation that causes the problem simply doesn't arise .. ASAN found it in the sh dotcmd tests which do have this odd "feature" in the way they are written (but where it never caused a problem, as the tests are so simple that no mem is ever allocated between when the old version of the function was deleted, and when it finished executing, so its code all remained intact, despite having been freed.)
The fix is taken from the FreeBSD sh.
XXX -- pullup-8 (after a while to ensure no other problems arise).
show more ...
|
| #
727a69dc |
| 07-Jun-2017 |
kre <kre@NetBSD.org> |
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,
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.
show more ...
|
| #
1676135e |
| 04-Jun-2017 |
kre <kre@NetBSD.org> |
Make cd (really) do cd -P, and not just claim that is what it is doing while doing a half-hearted, broken, partial, version of cd -L instead. The latter (as the manual says) is not supported, what's
Make cd (really) do cd -P, and not just claim that is what it is doing while doing a half-hearted, broken, partial, version of cd -L instead. The latter (as the manual says) is not supported, what's more, it is an abomination, and should never be supported (anywhere.)
Fix the doc so that the pretense that we notice when a path given crosses a symlink (and turns on printing of the destination directory) is claimed no more (that used to be true until late Dec 2016, but was changed). Now the print happens if -o cdprint is set, or if an entry from CDPATH that is not "" or "." is used (or if the "cd dest repl" cd cmd variant is used.)
Fix CDPATH processing: avoid the magic '%' processing that is used for PATH and MAILPATH from corrupting CDPATH. The % magic (both variants) remains undocumented.
Also, don't double the '/' if an entry in PATH or CDPATH ends in '/' (as in CDPATH=":/usr/src/"). A "cd usr.bin" used to do chdir("/usr/src//usr.bin"). No more. This is almost invisible, and relatively harmless, either way....
Also fix a bug where if a plausible destination directory in CDPATH was located, but the chdir() failed (eg: permission denied) and then a later "." or "" CDPATH entry succeeded, "print" mode was turned on. That is: cd /tmp; mkdir bin mkdir -p P/bin; chmod 0 P/bin CDPATH=/tmp/P: cd bin would cd to /tmp/bin (correctly) but print it (incorrectly).
Also when in "cd dest replace" mode, if the result of the replacement generates '-' as the path named, as in: cd $PWD - then simply change to '-' (or attempt to, with CDPATH search), rather than having this being equivalent to "cd -")
Because of these changes, the pwd command (and $PWD) essentially always acts as pwd -P, even when called as pwd -L (which is still the default.) That is, even more than it did before.
Also fixed a (kind of minor) mem management error (CDPATH related) "whosoever shall padvance must stunalloc before repeating" (and the same for MAILPATH).
show more ...
|
| #
404b1d02 |
| 03-May-2016 |
kre <kre@NetBSD.org> |
Fix things so that STATIC can me made static (-DSTATIC=static) and have the shell still compile, link, and run...
ok christos@
|
| #
66dd2755 |
| 15-Mar-2012 |
joerg <joerg@NetBSD.org> |
Add __printflike attribution to use vprintf and friends with an argument as format string.
|
| #
4fc4fe2e |
| 18-Jun-2011 |
christos <christos@NetBSD.org> |
PR/45069: Henning Petersen: Use prototypes from builtins.h .
|
| #
b5b29542 |
| 07-Aug-2003 |
agc <agc@NetBSD.org> |
Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
|
| #
e314f958 |
| 22-Jan-2003 |
dsl <dsl@NetBSD.org> |
Support command -p, -v and -V as posix Stop temporary PATH assigments messing up hash table Fix sh -c -e "echo $0 $*" -a x (as posix) (agreed by christos)
|
| #
c02b3bbd |
| 24-Nov-2002 |
christos <christos@NetBSD.org> |
Fixes from David Laight: - ansification - format of output of jobs command (etc) - job identiers %+, %- etc - $? and $(...) - correct quoting of output of set, export -p and readonly -p - differentia
Fixes from David Laight: - ansification - format of output of jobs command (etc) - job identiers %+, %- etc - $? and $(...) - correct quoting of output of set, export -p and readonly -p - differentiation between nornal and 'posix special' builtins - correct behaviour (posix) for errors on builtins and special builtins - builtin printf and kill - set -o debug (if compiled with DEBUG) - cd src obj (as ksh - too useful to do without) - unset -e name, remove non-readonly variable from export list. (so I could unset -e PS1 before running the test shell...)
show more ...
|
| #
edcb4544 |
| 27-Sep-2002 |
christos <christos@NetBSD.org> |
VFork()ing shell: From elric@netbsd.org: Plus my changes: - walking process group fix in foregrounding a job. - reset of process group in parent shell if interrupted before the wait. - move INTON
VFork()ing shell: From elric@netbsd.org: Plus my changes: - walking process group fix in foregrounding a job. - reset of process group in parent shell if interrupted before the wait. - move INTON lower in the dowait so that the job structure is consistent. - error check all setpgid(), tcsetpgrp() calls. - eliminate unneeded strpgid() call. - check that we don't belong in the process group before we try to set it.
show more ...
|
| #
e6bccfe4 |
| 22-May-2000 |
elric <elric@NetBSD.org> |
Back out previous vfork changes.
|
| #
756a2ca1 |
| 13-May-2000 |
elric <elric@NetBSD.org> |
Now we use vfork(2) instead of fork(2) when we can.
|
| #
3d424690 |
| 09-Jul-1999 |
christos <christos@NetBSD.org> |
compile with WARNS = 2
|
| #
ee9e50ea |
| 28-Jul-1998 |
mycroft <mycroft@NetBSD.org> |
Be more retentive about use of NOTREACHED and noreturn.
|
| #
c996803c |
| 20-Jul-1997 |
christos <christos@NetBSD.org> |
PR/3888: Chris Demetriou: type command-with-slash prints $PATH[0]/command-with-slash...
|
| #
680690d3 |
| 06-Feb-1997 |
christos <christos@NetBSD.org> |
add type builtin.
|
| #
2a9c11dd |
| 16-Oct-1996 |
christos <christos@NetBSD.org> |
PR/287: Shell does not exit with 126/127 when permission denied/ command not found. Add extra exception type and generalize error handling routines to take that exception type. Use a global variab
PR/287: Shell does not exit with 126/127 when permission denied/ command not found. Add extra exception type and generalize error handling routines to take that exception type. Use a global variable exerrno to keep the last exec error.
show more ...
|
| #
9a738ef2 |
| 25-Jun-1996 |
christos <christos@NetBSD.org> |
const poisoning.
|
| #
a45947b2 |
| 09-Jun-1995 |
christos <christos@NetBSD.org> |
Changed so that 'PATH=newpath command' works, instead of looking at the old path. Synced input.c with vangogh.
|
| #
07bae7ed |
| 11-May-1995 |
christos <christos@NetBSD.org> |
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0 bug.
|
| #
49f0ad86 |
| 21-Mar-1995 |
cgd <cgd@NetBSD.org> |
convert to new RCS id conventions.
|
| #
cafd1f7e |
| 11-Jun-1994 |
mycroft <mycroft@NetBSD.org> |
Add RCS ids.
|
| #
37ed7877 |
| 11-May-1994 |
jtc <jtc@NetBSD.org> |
sync with 4.4lite
|
| #
8542364e |
| 01-Aug-1993 |
mycroft <mycroft@NetBSD.org> |
Add RCS identifiers.
|