Age | Commit message (Collapse) | Author |
|
terminate the shell when running under -e.
See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=269067 and
Bug reported including fix by Leah Neukirchen, Thanks!
ok millert@
|
|
Mixing up function and void pointers isn't defined by POSIX or the
C standard. POSIX only specifies that casting the result of dlsym(3) to
an appropriate function pointer works.
Avoid all this by using a typedef.
from Michael Forney, ok tb@
|
|
the environment at shell initialization time. During startup, ksh calls
'eval typeset -i TMOUT="${TMOUT:-0}"'. which allows command injection via
arithmetic expansion, e.g., by setting TMOUT to 'x[`/bin/echo Hi >&2`]'.
Problem noted by Andras Farkas and tj, inspired by a similar issue in
AT&T's ksh. Tested in snaps for two weeks.
"go for it" deraadt
|
|
from chohag
|
|
|
|
Using alloc.c for the history array brings no value and prevents
easy handling of memory shortage. Switch to plain reallocarray and
keep running if HISTSIZE is too big.
The allocation is still done upfront with no sanity checking, it would
probably be nicer to allocate space as needed.
Issue reported by thomas@habets.se who suggested a different approach.
|
|
Spotted by maya@netbsd
ok deraadt@
|
|
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.
|
|
ok millert nicm tb, etc
|
|
|
|
Reference the First Edition (1989) of Bolsky/Korn which is about ksh88,
the shell the OpenBSD ksh(1) descends from (via pdksh).
The Second Edition (1995) of the book is about ksh93 which we don't provide.
Pointed out by Andras Farkas on bugs@.
|
|
|
|
Previously they were only recognized in [[ ... ]] expressions. This
changes sh/ksh to be consistent with test(1) as well as shells like
bash and dash. OK jca@ jmc@
|
|
omission reported by Rudolf Sykora <rsykora at disroot dot org> on misc@;
tweak and OK jmc@
|
|
Slightly more useful for some, same defaults as bash.
No objection deraadt@ phessler@, ok tb@ kn@ benno@
|
|
never do substitution (neither parameter, nor command, nor arithmetic,
nor tilde substitution) on the values of any variables encountered
inside the expression, but do recursively perform arithmetical
evaluation of subexpressions as required. This makes behaviour
more consistent, without hindering any behaviour promised in the
manual page.
A quirk originally reported by Andy Chu <andychup at gmail dot com>
was that in the past, when encountering an array index, the shell
would not only do evaluation, but also substitution on the array
index, even though substitution would not be done on the expression
in general.
tobias@ contributed to initial efforts of understanding the quirk.
patch tested in a bulk build by naddy@
"please commit" deraadt@
|
|
|
|
1. Another off-by-one: if a mail file name ends in an (escaped)
percent sign, do not forget to check whether the next byte is the
percent sign introducing the message (MAILPATH='filename\%%msg').
2. If the message is empty, use the default message rather than
printing a blank line (MAILPATH='filename%').
3. If the file name is empty, don't bother with mballoc(): the
subsequent stat(2) can never succeed. (MAILPATH='%msg').
Found while reviewing the previous commit by tedu@.
OK tedu@.
|
|
ok deraadt schwarze tb
|
|
|
|
ok deraadt@
|
|
in "for name in [word ...]; do list; done" can be empty.
In sh(1), clarify what happens in that case.
In ksh(1), clarify how it can happen that the list is never executed.
OK jmc@ tb@
|
|
While the code intended to support both -s NAME and -s SIGNAME, the
tests performed were wrong. Replace convoluted code with less cryptic
conditionals. ok anton@
|
|
ok guenther@ deraadt@
|
|
|
|
interrupted.
Lots of back and forth with anton@
OK jca@, tb@, anton@
|
|
grep and compare the use in all programs..
|
|
privileged and remove it when dropping privileges (set +p), setting a
flag to make sure we don't do it again.
ok deraadt millert
|
|
Previously, these would only be exported if they were present
in the environment when the shell started. OK deraadt@ anton@ kn@
|
|
(and this is allowed by POSIX). OK deraadt@ kn@
|
|
a missing NULL check added by jca@ which fixes the segfault in the installer.
ok jca@ tb@
|
|
install.sub's ${*:+$*} substitution in addel().
ok jca
|
|
variables; such as positional arguments. Since global() returns a pointer to
static storage for read-only variables, the memory pointed to needs to be copied
to prevent any subsequent call to global() to override the previously accessed
variable.
Bug reported by Andreas Kusalananda Kähäri on bugs@
ok benno@ jca@ tb@
|
|
So that ksh still looks for new mail every $MAILCHECK seconds,
even if the system clock is rolled backward.
ok anton@
|
|
Suggested by anton@
|
|
key by default. The shell will query the terminfo database to
find the escape sequence to clear the screen. OK deraadt@
|
|
jump around.
suggested and ok jmc@, ok jcm@
|
|
a buildin command, that just calls into c_whence().
This makes type look like the buildin in other shells and makes
things like system("'type' 'git'"); work.
With lots of suggestions and feedback from anton@, kn@ and jca@.
ok kn@ jca@
|
|
Revision 1.28 (2008) fixed stack abuse by allocating a new one and
effectively clearing it. This broke pipelines such as
$ time for i in . ; do : ; done
/bin/ksh: : is read only
Prompted by tb, OK millert, tb, jca
|
|
Keeps $SECONDS advancing uniformly and independent of wall clock jumps.
ok jca@
|
|
No binary change on amd64 and there should be no differences on any
other 64 bit architecture either (because long = int64_t).
ok cheloha, tb
|
|
Initial diff by me, later improved by schwarze@; also ok jmc@
|
|
|
|
wrong function and fix the rest for consistency.
Diff from Michael W. Bombardieri with some cosmetic cleanup applied.
ok benno@ tb@
|
|
mode, to avoid potential confusion pointed out by andreas dot kahari
at icm dot uu dot se on misc@.
Patch minimally tweaked based on a comment from jmc@.
OK anton@ jca@ jmc@ on the previous version without the tweak.
|
|
also took the time to provide an excellent explanation on why the code isn't
useful on tech@.
ok jca@
|
|
This helps tools like scan-build, and follows the example of warningf()
and errorf(). ok anton@
|
|
it's rarely subject to change. While here, unifdef RLIMIT_VMEM.
ok jca@
|
|
emacs.c:1041:2: warning: Value stored to 'cp' is never read
|
|
str_val returns null, not NULL, if the variable isn't set. The
erroneous check means that we later tried to open("").
ok millert@ tb@ anton@ benno@
|