summaryrefslogtreecommitdiff
path: root/bin
AgeCommit message (Collapse)Author
2018-08-08unveil dev.db "r" for devname(), /dev "r", and in the non-sysctl caseTheo de Raadt
some kernel memory/symbol files.
2018-08-05use .Fl macro for command line optionsIngo Schwarze
2018-08-05wrong macroIngo Schwarze
2018-07-25Free operand copies after parsing.cheloha
We strdup operands before destructively parsing them to keep w(1) output looking nice and neat, but after parsing we ought to free them. We do need to keep copies for file paths, though, so add additional strdups for operands if and of. While here, use the preferred err(1, NULL) for an allocation failure. Also while here, don't assign `oper' to a copy of itself because it looks strange. "sure." deraadt
2018-07-23Don't cast malloc(3) size to u_int.cheloha
Large buffer sizes on 64-bit platforms cause the sum to wrap, leading read(2) to fail later. We check prior to this point that all buffer sizes are <= SSIZE_MAX. SSIZE_MAX * 2 < SIZE_MAX on all platforms, so the addition here will not overflow and cause a similar issue. Discovered by tobias@ a while back. ok deraadt millert tobias
2018-07-23Point to glob in section 7 for the actual list of special characters insteadkn
the C API in section 3. OK millert jmc nicm, "the right idea" deraadt
2018-07-11Do for most running out of memory err() what was done for most runningKenneth R Westerback
out of memory log_warn(). i.e. ("%s", __func__) instead of manual function names and redundant verbiage about which wrapper detected the out of memory condition. ok henning@
2018-07-09ensure tape name and tape commands are not too long. passing too longTheo de Raadt
commands to the other side could cause problems. ok guenther tb
2018-07-09Second attempt of the recently backed out variable expansion fix. This time withanton
a missing NULL check added by jca@ which fixes the segfault in the installer. ok jca@ tb@
2018-07-08Back out previous. naddy and rpe found that it breaks the installer withTheo Buehler
install.sub's ${*:+$*} substitution in addel(). ok jca
2018-07-08Fix a bug related to variable expansion referencing multiple read-onlyanton
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@
2018-06-25Count $MAILCHECK with the monotonic clock.cheloha
So that ksh still looks for new mail every $MAILCHECK seconds, even if the system clock is rolled backward. ok anton@
2018-06-19Revert previous, there were some unintended beviour changes.Martijn van Duren
2018-06-18Use shl_out->fd instead of STDOUT_FILENO in the call the setupterm().Todd C. Miller
Suggested by anton@
2018-06-18Remove the parse_char_class and let regcomp determine if our bracketsMartijn van Duren
are balanced. OK millert@ and tb@
2018-06-18Add clear-screen emacs editing command, currently not bound to aTodd C. Miller
key by default. The shell will query the terminfo database to find the escape sequence to clear the screen. OK deraadt@
2018-06-15Remove references to BACKWARDS.Martijn van Duren
OK tb@
2018-06-15Make sure we always return more than a single '!' in get_shell_command.Martijn van Duren
This is similar to what vi/ex does and removes the final BACKWARDS flag. Behaviour requested by and OK tb@
2018-06-15Remove the non-BACKWARDS option for GET_THIRD_ADDR. No change to currentMartijn van Duren
behaviour. OK tb@
2018-06-12handle the seperation of kvm_getenvv() and kvm_getargv() more cleanlyTheo de Raadt
ok kettenis, plus a fix from tb
2018-06-04Remove the extra pager code when compiled without the BACKWARDS flag.Martijn van Duren
Most terminals have scrollback options, or can be achieved via tmux, so it's not needed. OK millert@
2018-06-04Definitively choose the existing semantics for the scroll and null command.Martijn van Duren
POSIX states: "An empty command list shall be equivalent to the p command", so changing the behaviour of a null-command in any other case is a violation of POSIX. OK millert@
2018-05-30point readers to the correct place instead of having themSebastian Benoit
jump around. suggested and ok jmc@, ok jcm@
2018-05-24Fail earlier if we don't have a current filename. This simlifies theMartijn van Duren
code and removes a few BACKWARDS flags. OK otto@
2018-05-18remove the alias type='whence -v' and replace it withSebastian Benoit
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@
2018-04-26Make ed's 'l' command end lines with a '$' and make sure that literalMartijn van Duren
'$' characters are escaped, so that we are POSIX compliant. The omission of trailing '$' was originally hidden behind a BACKWARDS flag. This flag was most likely introduced to be compatible with 4.4BSD. Thanks to naddy@ for pointing me to the 4.4BSD ed implementation. I tried to trace the origin and enabling of the BACKWARDS flag, since both FreeBSD and NetBSD have the flag, but only FreeBSD doesn't have it enabled. Both projects had an alm@ working on ed during 1993-1995 during which he added this flag to both projects and only enabled it on NetBSD, but I wasn't able to reach him on any known address. Thanks to Ed Schouten (ed@freebsd), and Michael W. Lucas of the ed Mastery book for helping me trying to locate Andrew Moore. Problem originally prodded by garzon.lucero@gmail.com and later independently re-requested by n.reusse@hxgn.net. OK tb@, guenther@, and mwl@mwl.io
2018-04-25The time-setting codepath can use pledge "settime" which was added forTheo de Raadt
ntpd, but apparently date was never revisited. "wpath" is for wtmp logging. "rpath" for the case where -z argument isn't in the standard timezone dir. discussed with tb and guenther
2018-04-24Keep the time pipeline's stack in tactkn
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
2018-04-13Count $SECONDS with CLOCK_MONOTONIC.cheloha
Keeps $SECONDS advancing uniformly and independent of wall clock jumps. ok jca@
2018-04-09Support 64 bit integers on 32 bit architectures.Tobias Stoeckmann
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
2018-04-07snprintf+writev -> dprintfcheloha
Much simpler. Dropping writev makes the output from summary() non-atomic, so output lines triggered by SIGINFO can intermingle with output lines triggered by SIGINT or atexit(3). This behavior is difficult to trigger, even deliberately. The buffer in dprintf is large enough so that lines produced by summary() are not garbled if this occurs, though, so this is unlikely to break any scripts. Discussed at length with deraadt@, who helpfully noted that "not all problems have perfect solutions." ok millert@
2018-04-02Support integers of arbitrary length.Tobias Stoeckmann
Previously it was possible to overflow integers while parsing. With this diff, we support any kind of POSIX-compatible integers for comparisons. with input by and ok schwarze, ok tb
2018-03-31Clarify that -P only *attempts* overwriting, which may not succeed;Ingo Schwarze
requested by deraadt@ after repeated questions on bugs@ and tech@, e.g. from Gregoire Jadi and Craig Skinner.
2018-03-31Fix spacing in brace command list grammar.anton
Initial diff by me, later improved by schwarze@; also ok jmc@
2018-03-31Fix overflows while handling 64 bit integers.Tobias Stoeckmann
Based on FreeBSD's expr and NetBSD's old regression test suite. with input by and ok schwarze
2018-03-16improve markup quality in the cases found by the new "--" style messageIngo Schwarze
2018-03-15Favor usage of __func__ in warning/error messages. Some of them referred to theanton
wrong function and fix the rest for consistency. Diff from Michael W. Bombardieri with some cosmetic cleanup applied. ok benno@ tb@
2018-02-26Make ed(1) warn about modifications if 'r'ead in an empty file andMartijn van Duren
trying to quit. Diff from Tim Chase OK tb@ and millert@
2018-02-13atoll -> strtonumcheloha
ok millert@ tb@
2018-02-06Clarify that the "bind" built-in command only affects Emacs editingIngo Schwarze
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.
2018-02-05CKSUM_DIGEST_STRING_LENGTH bounding didn't include full range of size_tTheo de Raadt
and NUL ok millert krw tb
2018-02-04use sizeof, rather than the constant. on change in binary.Theo de Raadt
2018-02-04repair ugly indentsTheo de Raadt
2018-02-04Print strtonum(3)-style error messages on invalid numeric input.cheloha
More informative than the usage message. While here, no need to return EINVAL: just return 1 if we overflow. ok jca@ schwarze@
2018-02-02Extend range for seconds from 100 million to upper bound of time_t.cheloha
Makes us compliant with POSIX.1-2008, which requires that sleep(1) support up to 2147483647 seconds. Bounced off of tb@ and jca@. ok tb@ millert@ jca@
2018-01-20Remove code that has been disabled since 1999. From Michael W. Bombardieri whoanton
also took the time to provide an excellent explanation on why the code isn't useful on tech@. ok jca@
2018-01-16Introduce internal_warningf() and mark internal_errorf() as noreturnJeremie Courreges-Anglas
This helps tools like scan-build, and follows the example of warningf() and errorf(). ok anton@
2018-01-16Stop constructing the ulimit optstring passed to ksh_getopt() at runtime sinceanton
it's rarely subject to change. While here, unifdef RLIMIT_VMEM. ok jca@
2018-01-16One minor scan-build warningJeremie Courreges-Anglas
emacs.c:1041:2: warning: Value stored to 'cp' is never read
2018-01-15Don't try to open HISTFILE if the variable is unset.Jeremie Courreges-Anglas
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@