#
1.100 |
|
23-Jul-2023 |
kn |
avoid MAIL* environment variables to save a few bytes in install media
ksh(1) MAIL, MAILCHECK, MAILPATH mbox handling is useless in the installer.
OK miod deraadt
|
Revision tags: OPENBSD_7_3_BASE
|
#
1.99 |
|
08-Feb-2023 |
kn |
Omit version in SMALL ksh builds
No need for KSH_VERSION and its PS1 esacape sequences in installer shells. Save some bits and clean up what(1) output on ramdisk kernels.
OK deraadt
|
Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE
|
#
1.98 |
|
28-Jun-2019 |
deraadt |
When system calls indicate an error they return -1, not some arbitrary 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.
|
Revision tags: OPENBSD_6_5_BASE
|
#
1.97 |
|
20-Feb-2019 |
schwarze |
When evaluating an arithmetical expression, for example inside $(()), 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.96 |
|
20-Nov-2018 |
martijn |
Fix the case where the recursion detection isn't reset when the command is interrupted.
Lots of back and forth with anton@ OK jca@, tb@, anton@
|
#
1.95 |
|
17-Nov-2018 |
deraadt |
Use a very regular call pattern to pledge, so that we can continue to grep and compare the use in all programs..
|
#
1.94 |
|
16-Nov-2018 |
nicm |
Include "id" in pledge (for setres[ug]id, setgroups) if the shell is privileged and remove it when dropping privileges (set +p), setting a flag to make sure we don't do it again.
ok deraadt millert
|
Revision tags: OPENBSD_6_4_BASE
|
#
1.93 |
|
29-Sep-2018 |
millert |
Export the PWD and OLDPWD shell variables as per POSIX. Previously, these would only be exported if they were present in the environment when the shell started. OK deraadt@ anton@ kn@
|
#
1.92 |
|
18-May-2018 |
benno |
remove the alias type='whence -v' and replace it with 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@
|
#
1.91 |
|
09-Apr-2018 |
tobias |
Support 64 bit integers on 32 bit architectures.
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
|
Revision tags: OPENBSD_6_3_BASE
|
#
1.90 |
|
15-Mar-2018 |
anton |
Favor usage of __func__ in warning/error messages. Some of them referred to the wrong function and fix the rest for consistency. Diff from Michael W. Bombardieri with some cosmetic cleanup applied.
ok benno@ tb@
|
#
1.89 |
|
16-Jan-2018 |
jca |
Introduce internal_warningf() and mark internal_errorf() as noreturn
This helps tools like scan-build, and follows the example of warningf() and errorf(). ok anton@
|
#
1.88 |
|
15-Jan-2018 |
jca |
Stop pretending we support building ksh without EDIT/HISTORY support
ok anton@
|
#
1.87 |
|
14-Jan-2018 |
anton |
unifdef BRACE_EXPAND; ok jca@
|
#
1.86 |
|
05-Jan-2018 |
jca |
unifdef JOBS support
Prompted by a mail from Klemens Nanni, who also had the same diff. ok deraadt@ millert@
|
#
1.85 |
|
12-Dec-2017 |
tb |
Include hostname in shell prompts by default
With tmux, ssh and vmd, we tend to open shells on many different hosts simultaneously and the default prompts '$ ' and '# ' for {,k}sh as well as '% ' and '# ' for csh become dangerous: it's very easy to issue a command on the wrong host.
This can easily be avoided by displaying the hostname in the prompt. Everything beyond "hostname{$,#,%} " is going to be a matter of taste, so we left it at that. If you use an FQDN, only the first part (the output of 'hostname -s') will be printed.
requested by and ok deraadt; mostly positive feedback many ok anton, brynet, bcallah and others
|
#
1.84 |
|
07-Dec-2017 |
tb |
Drop the unused second argument from set_prompt(). It used to be used for early special casing of ! and !! in the PS1 expansion. This was removed from set_prompt() as part of the implementaion of the character count toggles \[ and \] back in 2004.
ok jca
|
Revision tags: OPENBSD_6_2_BASE
|
#
1.83 |
|
11-Aug-2017 |
guenther |
Retire old behavior of requiring root prompt to contain # or \!
Requested by akoshibe and phessler ok phessler@ anton@ jca@
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.82 |
|
17-Oct-2016 |
schwarze |
No need to inspect LC_CTYPE: * It was only used in vi input mode. * No functional change in case of set -o vi-show8. * No functional change if LC_CTYPE is set to UTF-8. * More robust for the default of LC_CTYPE=C on a UTF-8 xterm.
Behaviour changes for the combination LC_CTYPE=C with set +o vi-show8 on non-UTF-8 terminals, but that combination is useless and dangerous with or without this patch. If you want to edit individual raw non-ASCII non-UTF-8 bytes on the shell command line, always use set -o vi-show8. (Besides, i doubt that you actually want to do that; better use a real hex editor in the first place.)
OK czarkoff@.
|
#
1.81 |
|
11-Oct-2016 |
schwarze |
Partial UTF-8 line editing support for ksh(1) vi input mode; so far, it covers these commands: a h i l x / This is an isu8cont()-based hack similar in style to what i did in emacs input mode, but less elegant and slightly more intrusive because the vi mode code is much more ugly and less straightforward than the emacs mode code. This one required partial rewrites of a few helper functions, and comments were added while there.
This is not perfect, but hopefully reduces people's cursing until a more rigorous solution can be devised (much) later. Some polishing may be useful in tree, in particular adding utf8cont() support to a few missing commands.
Mostly written shortly after Christmas 2015. Reminded by and OK czarkoff@. Feedback, partial review and testing, no longer any objection by martijn@. Feedback and testing by tb@. Also read fine to nicm@.
|
#
1.80 |
|
08-Sep-2016 |
millert |
Mark PPID read-only as per the manual. From Anthony Coulter.
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.79 |
|
04-Mar-2016 |
deraadt |
remove CSRG BSD-licensed mknod builtin code which was previously used to accelerate install/upgrade time MAKEDEV runs. That allows ramdisk ksh to be pledged, without needing "dpath". We'll solve the performance issues a different way (soon). ok otto espie natano tb tobiasu rpe
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.78 |
|
30-Dec-2015 |
tedu |
rename global "e" to genv to avoid accidental shadowing and aliasing. ok millert nicm tb
|
#
1.77 |
|
27-Dec-2015 |
jca |
Tweak comment: we now always make a copy of argv.
ok halex@
|
#
1.76 |
|
27-Dec-2015 |
halex |
unconditionally duplicate the argv array on initialization, to make it resilient against being altered by a subsequent shift operation
tweak and ok semarie@
|
#
1.75 |
|
14-Dec-2015 |
tb |
Move system headers from sh.h to those files that actually need them.
ok mmcc@ a while ago
|
#
1.74 |
|
11-Nov-2015 |
deraadt |
exit() after perror() for pledge failure. Perhaps this got introduced as a test idiom, either when pledge was young or during the transition to strings.... dunno
|
#
1.73 |
|
01-Nov-2015 |
mmcc |
Add uses of areallocarray(). mksh and Bitrig ksh already have similar functions. With help from Theo Buehler.
ok nicm@
|
#
1.72 |
|
30-Oct-2015 |
guenther |
'fc -e -' is deprecated in favor of 'fc -s', so update the built-in alias
ok millert@
|
#
1.71 |
|
22-Oct-2015 |
mmcc |
Final removal of EXTERN.
ok nicm@
|
#
1.70 |
|
21-Oct-2015 |
mmcc |
Penultimate commit to remove EXTERN.
ok nicm@
|
#
1.69 |
|
19-Oct-2015 |
mmcc |
Move string.h include from sh.h to the files that use it.
ok nicm@
|
#
1.68 |
|
19-Oct-2015 |
mmcc |
More removal of EXTERN.
ok nicm@
|
#
1.67 |
|
19-Oct-2015 |
mmcc |
Apply style(9) to header includes.
ok nicm@
|
#
1.66 |
|
18-Oct-2015 |
mmcc |
Move more EXTERN-defined globals from sh.h.
ok nicm@
|
#
1.65 |
|
17-Oct-2015 |
mmcc |
Move a system header include from the global header (sh.h) into the files that need it. No binary change.
"This looks fine" -nicm@
|
#
1.64 |
|
16-Oct-2015 |
deraadt |
wrap a long line
|
#
1.63 |
|
16-Oct-2015 |
millert |
Implement real "flock" request and add it to userland programs that use pledge and file locking. OK deraadt@
|
#
1.62 |
|
10-Oct-2015 |
deraadt |
normalize a few more tame request orderings, to help review
|
#
1.61 |
|
10-Oct-2015 |
deraadt |
ksh can run with pledge "stdio rpath wpath cpath getpw fattr proc exec tty" if the mknod builtin is disabled. It looks like a lot of abilities, but hey, this is a shell. can't open sockets or do other nasty stuff though. (we'll leave the mknod builtin enabled on the install media for now; there is work happening to regain the MAKEDEV performance in a different way) discussions with otto & millert in particular
|
#
1.60 |
|
18-Sep-2015 |
nicm |
Last of the (thing *)0 -> NULL, from Michael McConville. No binary change.
|
#
1.59 |
|
17-Sep-2015 |
nicm |
Remove unnecessary casts, from Michael McConville. No binary change.
|
#
1.58 |
|
15-Sep-2015 |
tedu |
correct spelling of NULL from (char *)0. from Michael McConville. ok md5
|
#
1.57 |
|
10-Sep-2015 |
nicm |
Replace newline and space defines by "\n" and " " directly, from Michael McConville. ok millert
|
#
1.56 |
|
01-Sep-2015 |
tedu |
no need to check for null argv anymore. from Martijn van Duren ok deraadt
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.55 |
|
09-Feb-2015 |
jsg |
If we hit multiple errors while unwinding we'll end up running code that assumes a pointer is valid when it has been free'd.
This is convoluted as ksh has it's own allocator and uses long jumps. Set the pointer to NULL after the quitenv() call in unwind() in case we later hit a long jump in unwind().
Found with afl a while back.
ok tedu@ deraadt@
|
Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
|
#
1.54 |
|
28-Nov-2013 |
sobrado |
remove trailing whitespaces; use tabs instead of spaces where appropriate; no binary changes.
|
#
1.53 |
|
04-Sep-2013 |
millert |
Add a proper suspend builtin that saves/restores the tty and pgrp as needed instead of an alias that just sends SIGSTOP. Login shells may be suspended if they are not running in an orphan process group. OK guenther@ jmc@
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.52 |
|
15-Jun-2013 |
millert |
Run any pending traps before calling the EXIT or ERR traps when -e is set. Fixes a bug where we would not run the signal trap if, for example, ^C was pressed and -e was set. OK espie@
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.51 |
|
10-Sep-2012 |
tedu |
fake a sigwinch after each job, so if the terminal changes size, we'll notice and update
|
#
1.50 |
|
06-Sep-2012 |
millert |
Avoid modifying argv when building argv for $* and $@ since it will affect ps output. This can happen when command line options are specified, e.g. "sh -c command". Based on a diff from espie@ OK espie@
|
#
1.49 |
|
05-Sep-2012 |
espie |
backout, Todd's version may be cleaner, but it's also wrong.
|
#
1.48 |
|
05-Sep-2012 |
espie |
sh -c should not munge argv[]. This fixes ps -ww output.
joint work by millert@ and me@.
okay otto@, deraadt@ "feel free to commit my version" millert@
|
Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.47 |
|
07-Sep-2011 |
otto |
beter determination if the shell is restricted; from Alf Schlichting. ok jasper@ millert@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
|
#
1.46 |
|
19-May-2010 |
jasper |
properly keep track of the line number after a trap. this fixes pr 6195. diff from manuel giraud, thanks.
ok kili@
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
|
#
1.45 |
|
29-Jan-2009 |
jaredy |
pass "xerrok" status across the execution call stack to more closely match what both POSIX and ksh.1 already describe in regards to set -e/errexit's behavior in determining when to exit from nonzero return values.
specifically, the truth values tested as operands to `&&' and `||', as well as the resulting compound expression itself, along with the truth value resulting from a negated command (i.e. a pipeline prefixed `!'), should not make the shell exit when -e is in effect.
issue reported by matthieu. testing matthieu, naddy. ok miod (earlier version), otto. man page ok jmc.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.44 |
|
05-Jul-2008 |
djm |
ksh starting as root will refuse to import a PS1 prompt unless it contains a '#' character. Make it also accept the \$ PS1 sequence (which is supposed to automagically be $ or # depending on the user running the shell) unless ksh has been started in sh-compatibility mode.
pointed out by millert@ when I asked why my SUDO_PS1 was not being honoured; ok millert@
|
Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
|
#
1.43 |
|
31-May-2007 |
otto |
Only process ENV when in interactive mode as SU says. Started by tedu to fix make -j, SU thing spotted by naddy@; ok millert@ @tedu jmc@ for the man page bit.
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.42 |
|
02-Nov-2006 |
ray |
Only check if last three letters are "/sh" if string is at least three characters long.
OK moritz@.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.41 |
|
10-Apr-2006 |
jaredy |
fix lint comments, no functional changes; ok ray
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.40 |
|
11-Dec-2005 |
otto |
fix a few name clashes with libc; found by lint. ok deraadt@
|
#
1.39 |
|
11-Dec-2005 |
deraadt |
remove unused variables and functions
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.38 |
|
30-Mar-2005 |
deraadt |
lots of indentation cleanup, now ksh is readable like our other code. double checked to make sure no binaries change, and eyed by niallo
|
#
1.37 |
|
28-Mar-2005 |
deraadt |
if argv[0] not set, do not set it to "pdksh", but to "ksh"
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
21-Feb-2005 |
otto |
Set \u in prompt expansion to the right value, while avoiding getpw* calls, which might be very inconvenient when the yp server is not available.
ok deraadt@ millert@
|
#
1.35 |
|
22-Dec-2004 |
otto |
Fix a use-after-free, that causs core dumps if a shell is killed running with strict malloc.conf options. Problem spotted by hshoexer@; fix by me with some help from millert@.
ok millert@ hshoexer@ krw@ deraadt@
|
#
1.34 |
|
22-Dec-2004 |
millert |
Use stdbool.h instead of rolling our own bools.
|
#
1.33 |
|
20-Dec-2004 |
otto |
Ansification plus some minor knf. No binary change on i386 and sparc64, binary change in lex.o on macppc due to introduction of dopprompt() prototype. ok millert@
|
#
1.32 |
|
18-Dec-2004 |
millert |
deregister
|
#
1.31 |
|
18-Dec-2004 |
millert |
When invoked as sh set SH_VERSION, not KSH_VERSION like the man page says.
|
#
1.30 |
|
18-Dec-2004 |
millert |
Get rid of #ifdef KSH since we don't care about building a V7 style sh and the #ifdef KSH code is required to make a POSIX sh. From Matthias Kilian
|
#
1.29 |
|
18-Dec-2004 |
millert |
Remove unused OS dependent #ifdef blocks, #defines and macro abstraction. First step in making the ksh code easier to read. From Matthias Kilian
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.28 |
|
23-Aug-2004 |
millert |
Don't send SIGINT or SIGTERM to the entire processes group when the shell receives SIGINT/SIGTERM unless the shell is the process group leader. Fixes PR 3820. OK danh@ sturm@ miod@
|
#
1.27 |
|
07-Jun-2004 |
deraadt |
do not push ksh into stupid-random mode; leave it in arc4random() mode. oops. spotted by weerd@weirdnet.nl
|
Revision tags: OPENBSD_3_5_BASE
|
#
1.26 |
|
08-Jan-2004 |
jmc |
typo; from ray at cyth dot net (PR 3632);
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.25 |
|
26-Jun-2003 |
deraadt |
protos
|
#
1.24 |
|
04-Apr-2003 |
deraadt |
two fixes; help from tedu & tdeval
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.23 |
|
10-Mar-2003 |
david |
spelling fixes ok millert@
|
#
1.22 |
|
28-Feb-2003 |
jmc |
typos; from Brian Poole
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.21 |
|
09-Jun-2002 |
todd |
knf
|
Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE
|
#
1.20 |
|
19-Dec-2000 |
markus |
do not reset nonblock if shell is not interactive, from crossd@cs.rpi.edu (i should have commited this about 6 months ago, ok millert@).
|
Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
|
#
1.19 |
|
14-Nov-1999 |
millert |
Better fix for PR #921 (main.c rev 1.18) from the pdksh cvs tree.
|
#
1.18 |
|
14-Nov-1999 |
millert |
Fix a core dump caused by a signal race; yval@hackers.co.il
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.17 |
|
04-Aug-1999 |
millert |
Turn <tab> completion on by default for people used to bash, tcsh, etc...
|
#
1.16 |
|
15-Jul-1999 |
millert |
o Set default line edit mode to emacs (VISUAL/EDITOR or user can override) o Spell environment correctly
|
#
1.15 |
|
15-Jun-1999 |
millert |
patches from pdksh 5.2.13.11
|
#
1.14 |
|
27-Apr-1999 |
millert |
disable newgrp alias since OpenBSD doesn't have a newgrp(1)
|
Revision tags: OPENBSD_2_5_BASE
|
#
1.13 |
|
10-Jan-1999 |
millert |
sync with pdksh-unstable-5.2.13.6
|
#
1.12 |
|
08-Jan-1999 |
millert |
bug fixes from pdksh-unstable-5.2.13.5; some of which we already had.
|
#
1.11 |
|
29-Oct-1998 |
millert |
Bug fixes from pdksh-unstable-5.2.13.4, including "official" versions of some that we had already fixed locally. o typeset -f FUNC doesn't print follows command (and expression) substitutions. o when re-allocating memory, too much may be copied from old memory. o set -o printed some options sans names. o emacs mode: <esc>. in very fist command causes core dump. o pdksh dumps core after a cd command. o typeset -i reports on array elements that have no value (at&t ksh reports on array base name - no index). o ulimit -ctn unlimittttted kills shell (resource exceeded). o ". /dev/null" says access denied. o flag field in aliases incorrectly changed (all flags set instead of clearing ISSET) in exec.c(flushcom). o ${#array[*]} prints largest index instead of number of (set) elements in an array (ksh88 does the former). o sys_siglist[] doesn't always have NSIG non-null entries...
|
Revision tags: OPENBSD_2_4_BASE
|
#
1.10 |
|
25-Jun-1998 |
millert |
pdksh-5.2.13 + local changes
|
Revision tags: OPENBSD_2_3_BASE
|
#
1.9 |
|
12-Sep-1997 |
deraadt |
do not quitenv() too early, or "s" goes away due to it's temporary nature; fix found in freebsd ports tree.. original by ejc@bazzle.com
|
#
1.8 |
|
01-Sep-1997 |
deraadt |
i am bored enough to fix terminal space/tab uglies
|
#
1.7 |
|
19-Jun-1997 |
kstailey |
back out
|
#
1.6 |
|
18-Jun-1997 |
kstailey |
(foo *)0 -> NULL
|
#
1.5 |
|
02-Jan-1997 |
downsj |
Add FSH (set -o sh), initialize it if we're /bin/sh, and add the first use: don't set $_ if we're non-interactive.
|
#
1.4 |
|
21-Nov-1996 |
downsj |
Update to 5.2.12.
|
#
1.3 |
|
01-Oct-1996 |
downsj |
Integrate pdksh 5.2.9.
|
#
1.2 |
|
19-Aug-1996 |
downsj |
update to pdksh-5.2.8
|
#
1.1 |
|
14-Aug-1996 |
downsj |
branches: 1.1.1; Initial revision
|
#
1.99 |
|
08-Feb-2023 |
kn |
Omit version in SMALL ksh builds
No need for KSH_VERSION and its PS1 esacape sequences in installer shells. Save some bits and clean up what(1) output on ramdisk kernels.
OK deraadt
|
Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE
|
#
1.98 |
|
28-Jun-2019 |
deraadt |
When system calls indicate an error they return -1, not some arbitrary 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.
|
Revision tags: OPENBSD_6_5_BASE
|
#
1.97 |
|
20-Feb-2019 |
schwarze |
When evaluating an arithmetical expression, for example inside $(()), 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.96 |
|
20-Nov-2018 |
martijn |
Fix the case where the recursion detection isn't reset when the command is interrupted.
Lots of back and forth with anton@ OK jca@, tb@, anton@
|
#
1.95 |
|
17-Nov-2018 |
deraadt |
Use a very regular call pattern to pledge, so that we can continue to grep and compare the use in all programs..
|
#
1.94 |
|
16-Nov-2018 |
nicm |
Include "id" in pledge (for setres[ug]id, setgroups) if the shell is privileged and remove it when dropping privileges (set +p), setting a flag to make sure we don't do it again.
ok deraadt millert
|
Revision tags: OPENBSD_6_4_BASE
|
#
1.93 |
|
29-Sep-2018 |
millert |
Export the PWD and OLDPWD shell variables as per POSIX. Previously, these would only be exported if they were present in the environment when the shell started. OK deraadt@ anton@ kn@
|
#
1.92 |
|
18-May-2018 |
benno |
remove the alias type='whence -v' and replace it with 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@
|
#
1.91 |
|
09-Apr-2018 |
tobias |
Support 64 bit integers on 32 bit architectures.
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
|
Revision tags: OPENBSD_6_3_BASE
|
#
1.90 |
|
15-Mar-2018 |
anton |
Favor usage of __func__ in warning/error messages. Some of them referred to the wrong function and fix the rest for consistency. Diff from Michael W. Bombardieri with some cosmetic cleanup applied.
ok benno@ tb@
|
#
1.89 |
|
16-Jan-2018 |
jca |
Introduce internal_warningf() and mark internal_errorf() as noreturn
This helps tools like scan-build, and follows the example of warningf() and errorf(). ok anton@
|
#
1.88 |
|
15-Jan-2018 |
jca |
Stop pretending we support building ksh without EDIT/HISTORY support
ok anton@
|
#
1.87 |
|
14-Jan-2018 |
anton |
unifdef BRACE_EXPAND; ok jca@
|
#
1.86 |
|
05-Jan-2018 |
jca |
unifdef JOBS support
Prompted by a mail from Klemens Nanni, who also had the same diff. ok deraadt@ millert@
|
#
1.85 |
|
12-Dec-2017 |
tb |
Include hostname in shell prompts by default
With tmux, ssh and vmd, we tend to open shells on many different hosts simultaneously and the default prompts '$ ' and '# ' for {,k}sh as well as '% ' and '# ' for csh become dangerous: it's very easy to issue a command on the wrong host.
This can easily be avoided by displaying the hostname in the prompt. Everything beyond "hostname{$,#,%} " is going to be a matter of taste, so we left it at that. If you use an FQDN, only the first part (the output of 'hostname -s') will be printed.
requested by and ok deraadt; mostly positive feedback many ok anton, brynet, bcallah and others
|
#
1.84 |
|
07-Dec-2017 |
tb |
Drop the unused second argument from set_prompt(). It used to be used for early special casing of ! and !! in the PS1 expansion. This was removed from set_prompt() as part of the implementaion of the character count toggles \[ and \] back in 2004.
ok jca
|
Revision tags: OPENBSD_6_2_BASE
|
#
1.83 |
|
11-Aug-2017 |
guenther |
Retire old behavior of requiring root prompt to contain # or \!
Requested by akoshibe and phessler ok phessler@ anton@ jca@
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.82 |
|
17-Oct-2016 |
schwarze |
No need to inspect LC_CTYPE: * It was only used in vi input mode. * No functional change in case of set -o vi-show8. * No functional change if LC_CTYPE is set to UTF-8. * More robust for the default of LC_CTYPE=C on a UTF-8 xterm.
Behaviour changes for the combination LC_CTYPE=C with set +o vi-show8 on non-UTF-8 terminals, but that combination is useless and dangerous with or without this patch. If you want to edit individual raw non-ASCII non-UTF-8 bytes on the shell command line, always use set -o vi-show8. (Besides, i doubt that you actually want to do that; better use a real hex editor in the first place.)
OK czarkoff@.
|
#
1.81 |
|
11-Oct-2016 |
schwarze |
Partial UTF-8 line editing support for ksh(1) vi input mode; so far, it covers these commands: a h i l x / This is an isu8cont()-based hack similar in style to what i did in emacs input mode, but less elegant and slightly more intrusive because the vi mode code is much more ugly and less straightforward than the emacs mode code. This one required partial rewrites of a few helper functions, and comments were added while there.
This is not perfect, but hopefully reduces people's cursing until a more rigorous solution can be devised (much) later. Some polishing may be useful in tree, in particular adding utf8cont() support to a few missing commands.
Mostly written shortly after Christmas 2015. Reminded by and OK czarkoff@. Feedback, partial review and testing, no longer any objection by martijn@. Feedback and testing by tb@. Also read fine to nicm@.
|
#
1.80 |
|
08-Sep-2016 |
millert |
Mark PPID read-only as per the manual. From Anthony Coulter.
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.79 |
|
04-Mar-2016 |
deraadt |
remove CSRG BSD-licensed mknod builtin code which was previously used to accelerate install/upgrade time MAKEDEV runs. That allows ramdisk ksh to be pledged, without needing "dpath". We'll solve the performance issues a different way (soon). ok otto espie natano tb tobiasu rpe
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.78 |
|
30-Dec-2015 |
tedu |
rename global "e" to genv to avoid accidental shadowing and aliasing. ok millert nicm tb
|
#
1.77 |
|
27-Dec-2015 |
jca |
Tweak comment: we now always make a copy of argv.
ok halex@
|
#
1.76 |
|
27-Dec-2015 |
halex |
unconditionally duplicate the argv array on initialization, to make it resilient against being altered by a subsequent shift operation
tweak and ok semarie@
|
#
1.75 |
|
14-Dec-2015 |
tb |
Move system headers from sh.h to those files that actually need them.
ok mmcc@ a while ago
|
#
1.74 |
|
11-Nov-2015 |
deraadt |
exit() after perror() for pledge failure. Perhaps this got introduced as a test idiom, either when pledge was young or during the transition to strings.... dunno
|
#
1.73 |
|
01-Nov-2015 |
mmcc |
Add uses of areallocarray(). mksh and Bitrig ksh already have similar functions. With help from Theo Buehler.
ok nicm@
|
#
1.72 |
|
30-Oct-2015 |
guenther |
'fc -e -' is deprecated in favor of 'fc -s', so update the built-in alias
ok millert@
|
#
1.71 |
|
22-Oct-2015 |
mmcc |
Final removal of EXTERN.
ok nicm@
|
#
1.70 |
|
21-Oct-2015 |
mmcc |
Penultimate commit to remove EXTERN.
ok nicm@
|
#
1.69 |
|
19-Oct-2015 |
mmcc |
Move string.h include from sh.h to the files that use it.
ok nicm@
|
#
1.68 |
|
19-Oct-2015 |
mmcc |
More removal of EXTERN.
ok nicm@
|
#
1.67 |
|
19-Oct-2015 |
mmcc |
Apply style(9) to header includes.
ok nicm@
|
#
1.66 |
|
18-Oct-2015 |
mmcc |
Move more EXTERN-defined globals from sh.h.
ok nicm@
|
#
1.65 |
|
17-Oct-2015 |
mmcc |
Move a system header include from the global header (sh.h) into the files that need it. No binary change.
"This looks fine" -nicm@
|
#
1.64 |
|
16-Oct-2015 |
deraadt |
wrap a long line
|
#
1.63 |
|
16-Oct-2015 |
millert |
Implement real "flock" request and add it to userland programs that use pledge and file locking. OK deraadt@
|
#
1.62 |
|
10-Oct-2015 |
deraadt |
normalize a few more tame request orderings, to help review
|
#
1.61 |
|
10-Oct-2015 |
deraadt |
ksh can run with pledge "stdio rpath wpath cpath getpw fattr proc exec tty" if the mknod builtin is disabled. It looks like a lot of abilities, but hey, this is a shell. can't open sockets or do other nasty stuff though. (we'll leave the mknod builtin enabled on the install media for now; there is work happening to regain the MAKEDEV performance in a different way) discussions with otto & millert in particular
|
#
1.60 |
|
18-Sep-2015 |
nicm |
Last of the (thing *)0 -> NULL, from Michael McConville. No binary change.
|
#
1.59 |
|
17-Sep-2015 |
nicm |
Remove unnecessary casts, from Michael McConville. No binary change.
|
#
1.58 |
|
15-Sep-2015 |
tedu |
correct spelling of NULL from (char *)0. from Michael McConville. ok md5
|
#
1.57 |
|
10-Sep-2015 |
nicm |
Replace newline and space defines by "\n" and " " directly, from Michael McConville. ok millert
|
#
1.56 |
|
01-Sep-2015 |
tedu |
no need to check for null argv anymore. from Martijn van Duren ok deraadt
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.55 |
|
09-Feb-2015 |
jsg |
If we hit multiple errors while unwinding we'll end up running code that assumes a pointer is valid when it has been free'd.
This is convoluted as ksh has it's own allocator and uses long jumps. Set the pointer to NULL after the quitenv() call in unwind() in case we later hit a long jump in unwind().
Found with afl a while back.
ok tedu@ deraadt@
|
Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
|
#
1.54 |
|
28-Nov-2013 |
sobrado |
remove trailing whitespaces; use tabs instead of spaces where appropriate; no binary changes.
|
#
1.53 |
|
04-Sep-2013 |
millert |
Add a proper suspend builtin that saves/restores the tty and pgrp as needed instead of an alias that just sends SIGSTOP. Login shells may be suspended if they are not running in an orphan process group. OK guenther@ jmc@
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.52 |
|
15-Jun-2013 |
millert |
Run any pending traps before calling the EXIT or ERR traps when -e is set. Fixes a bug where we would not run the signal trap if, for example, ^C was pressed and -e was set. OK espie@
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.51 |
|
10-Sep-2012 |
tedu |
fake a sigwinch after each job, so if the terminal changes size, we'll notice and update
|
#
1.50 |
|
06-Sep-2012 |
millert |
Avoid modifying argv when building argv for $* and $@ since it will affect ps output. This can happen when command line options are specified, e.g. "sh -c command". Based on a diff from espie@ OK espie@
|
#
1.49 |
|
05-Sep-2012 |
espie |
backout, Todd's version may be cleaner, but it's also wrong.
|
#
1.48 |
|
05-Sep-2012 |
espie |
sh -c should not munge argv[]. This fixes ps -ww output.
joint work by millert@ and me@.
okay otto@, deraadt@ "feel free to commit my version" millert@
|
Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.47 |
|
07-Sep-2011 |
otto |
beter determination if the shell is restricted; from Alf Schlichting. ok jasper@ millert@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
|
#
1.46 |
|
19-May-2010 |
jasper |
properly keep track of the line number after a trap. this fixes pr 6195. diff from manuel giraud, thanks.
ok kili@
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
|
#
1.45 |
|
29-Jan-2009 |
jaredy |
pass "xerrok" status across the execution call stack to more closely match what both POSIX and ksh.1 already describe in regards to set -e/errexit's behavior in determining when to exit from nonzero return values.
specifically, the truth values tested as operands to `&&' and `||', as well as the resulting compound expression itself, along with the truth value resulting from a negated command (i.e. a pipeline prefixed `!'), should not make the shell exit when -e is in effect.
issue reported by matthieu. testing matthieu, naddy. ok miod (earlier version), otto. man page ok jmc.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.44 |
|
05-Jul-2008 |
djm |
ksh starting as root will refuse to import a PS1 prompt unless it contains a '#' character. Make it also accept the \$ PS1 sequence (which is supposed to automagically be $ or # depending on the user running the shell) unless ksh has been started in sh-compatibility mode.
pointed out by millert@ when I asked why my SUDO_PS1 was not being honoured; ok millert@
|
Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
|
#
1.43 |
|
31-May-2007 |
otto |
Only process ENV when in interactive mode as SU says. Started by tedu to fix make -j, SU thing spotted by naddy@; ok millert@ @tedu jmc@ for the man page bit.
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.42 |
|
02-Nov-2006 |
ray |
Only check if last three letters are "/sh" if string is at least three characters long.
OK moritz@.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.41 |
|
10-Apr-2006 |
jaredy |
fix lint comments, no functional changes; ok ray
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.40 |
|
11-Dec-2005 |
otto |
fix a few name clashes with libc; found by lint. ok deraadt@
|
#
1.39 |
|
11-Dec-2005 |
deraadt |
remove unused variables and functions
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.38 |
|
30-Mar-2005 |
deraadt |
lots of indentation cleanup, now ksh is readable like our other code. double checked to make sure no binaries change, and eyed by niallo
|
#
1.37 |
|
28-Mar-2005 |
deraadt |
if argv[0] not set, do not set it to "pdksh", but to "ksh"
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
21-Feb-2005 |
otto |
Set \u in prompt expansion to the right value, while avoiding getpw* calls, which might be very inconvenient when the yp server is not available.
ok deraadt@ millert@
|
#
1.35 |
|
22-Dec-2004 |
otto |
Fix a use-after-free, that causs core dumps if a shell is killed running with strict malloc.conf options. Problem spotted by hshoexer@; fix by me with some help from millert@.
ok millert@ hshoexer@ krw@ deraadt@
|
#
1.34 |
|
22-Dec-2004 |
millert |
Use stdbool.h instead of rolling our own bools.
|
#
1.33 |
|
20-Dec-2004 |
otto |
Ansification plus some minor knf. No binary change on i386 and sparc64, binary change in lex.o on macppc due to introduction of dopprompt() prototype. ok millert@
|
#
1.32 |
|
18-Dec-2004 |
millert |
deregister
|
#
1.31 |
|
18-Dec-2004 |
millert |
When invoked as sh set SH_VERSION, not KSH_VERSION like the man page says.
|
#
1.30 |
|
18-Dec-2004 |
millert |
Get rid of #ifdef KSH since we don't care about building a V7 style sh and the #ifdef KSH code is required to make a POSIX sh. From Matthias Kilian
|
#
1.29 |
|
18-Dec-2004 |
millert |
Remove unused OS dependent #ifdef blocks, #defines and macro abstraction. First step in making the ksh code easier to read. From Matthias Kilian
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.28 |
|
23-Aug-2004 |
millert |
Don't send SIGINT or SIGTERM to the entire processes group when the shell receives SIGINT/SIGTERM unless the shell is the process group leader. Fixes PR 3820. OK danh@ sturm@ miod@
|
#
1.27 |
|
07-Jun-2004 |
deraadt |
do not push ksh into stupid-random mode; leave it in arc4random() mode. oops. spotted by weerd@weirdnet.nl
|
Revision tags: OPENBSD_3_5_BASE
|
#
1.26 |
|
08-Jan-2004 |
jmc |
typo; from ray at cyth dot net (PR 3632);
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.25 |
|
26-Jun-2003 |
deraadt |
protos
|
#
1.24 |
|
04-Apr-2003 |
deraadt |
two fixes; help from tedu & tdeval
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.23 |
|
10-Mar-2003 |
david |
spelling fixes ok millert@
|
#
1.22 |
|
28-Feb-2003 |
jmc |
typos; from Brian Poole
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.21 |
|
09-Jun-2002 |
todd |
knf
|
Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE
|
#
1.20 |
|
19-Dec-2000 |
markus |
do not reset nonblock if shell is not interactive, from crossd@cs.rpi.edu (i should have commited this about 6 months ago, ok millert@).
|
Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
|
#
1.19 |
|
14-Nov-1999 |
millert |
Better fix for PR #921 (main.c rev 1.18) from the pdksh cvs tree.
|
#
1.18 |
|
14-Nov-1999 |
millert |
Fix a core dump caused by a signal race; yval@hackers.co.il
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.17 |
|
04-Aug-1999 |
millert |
Turn <tab> completion on by default for people used to bash, tcsh, etc...
|
#
1.16 |
|
15-Jul-1999 |
millert |
o Set default line edit mode to emacs (VISUAL/EDITOR or user can override) o Spell environment correctly
|
#
1.15 |
|
15-Jun-1999 |
millert |
patches from pdksh 5.2.13.11
|
#
1.14 |
|
27-Apr-1999 |
millert |
disable newgrp alias since OpenBSD doesn't have a newgrp(1)
|
Revision tags: OPENBSD_2_5_BASE
|
#
1.13 |
|
10-Jan-1999 |
millert |
sync with pdksh-unstable-5.2.13.6
|
#
1.12 |
|
08-Jan-1999 |
millert |
bug fixes from pdksh-unstable-5.2.13.5; some of which we already had.
|
#
1.11 |
|
29-Oct-1998 |
millert |
Bug fixes from pdksh-unstable-5.2.13.4, including "official" versions of some that we had already fixed locally. o typeset -f FUNC doesn't print follows command (and expression) substitutions. o when re-allocating memory, too much may be copied from old memory. o set -o printed some options sans names. o emacs mode: <esc>. in very fist command causes core dump. o pdksh dumps core after a cd command. o typeset -i reports on array elements that have no value (at&t ksh reports on array base name - no index). o ulimit -ctn unlimittttted kills shell (resource exceeded). o ". /dev/null" says access denied. o flag field in aliases incorrectly changed (all flags set instead of clearing ISSET) in exec.c(flushcom). o ${#array[*]} prints largest index instead of number of (set) elements in an array (ksh88 does the former). o sys_siglist[] doesn't always have NSIG non-null entries...
|
Revision tags: OPENBSD_2_4_BASE
|
#
1.10 |
|
25-Jun-1998 |
millert |
pdksh-5.2.13 + local changes
|
Revision tags: OPENBSD_2_3_BASE
|
#
1.9 |
|
12-Sep-1997 |
deraadt |
do not quitenv() too early, or "s" goes away due to it's temporary nature; fix found in freebsd ports tree.. original by ejc@bazzle.com
|
#
1.8 |
|
01-Sep-1997 |
deraadt |
i am bored enough to fix terminal space/tab uglies
|
#
1.7 |
|
19-Jun-1997 |
kstailey |
back out
|
#
1.6 |
|
18-Jun-1997 |
kstailey |
(foo *)0 -> NULL
|
#
1.5 |
|
02-Jan-1997 |
downsj |
Add FSH (set -o sh), initialize it if we're /bin/sh, and add the first use: don't set $_ if we're non-interactive.
|
#
1.4 |
|
21-Nov-1996 |
downsj |
Update to 5.2.12.
|
#
1.3 |
|
01-Oct-1996 |
downsj |
Integrate pdksh 5.2.9.
|
#
1.2 |
|
19-Aug-1996 |
downsj |
update to pdksh-5.2.8
|
#
1.1 |
|
14-Aug-1996 |
downsj |
branches: 1.1.1; Initial revision
|
#
1.98 |
|
28-Jun-2019 |
deraadt |
When system calls indicate an error they return -1, not some arbitrary 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.
|
Revision tags: OPENBSD_6_5_BASE
|
#
1.97 |
|
20-Feb-2019 |
schwarze |
When evaluating an arithmetical expression, for example inside $(()), 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.96 |
|
20-Nov-2018 |
martijn |
Fix the case where the recursion detection isn't reset when the command is interrupted.
Lots of back and forth with anton@ OK jca@, tb@, anton@
|
#
1.95 |
|
17-Nov-2018 |
deraadt |
Use a very regular call pattern to pledge, so that we can continue to grep and compare the use in all programs..
|
#
1.94 |
|
16-Nov-2018 |
nicm |
Include "id" in pledge (for setres[ug]id, setgroups) if the shell is privileged and remove it when dropping privileges (set +p), setting a flag to make sure we don't do it again.
ok deraadt millert
|
Revision tags: OPENBSD_6_4_BASE
|
#
1.93 |
|
29-Sep-2018 |
millert |
Export the PWD and OLDPWD shell variables as per POSIX. Previously, these would only be exported if they were present in the environment when the shell started. OK deraadt@ anton@ kn@
|
#
1.92 |
|
18-May-2018 |
benno |
remove the alias type='whence -v' and replace it with 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@
|
#
1.91 |
|
09-Apr-2018 |
tobias |
Support 64 bit integers on 32 bit architectures.
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
|
Revision tags: OPENBSD_6_3_BASE
|
#
1.90 |
|
15-Mar-2018 |
anton |
Favor usage of __func__ in warning/error messages. Some of them referred to the wrong function and fix the rest for consistency. Diff from Michael W. Bombardieri with some cosmetic cleanup applied.
ok benno@ tb@
|
#
1.89 |
|
16-Jan-2018 |
jca |
Introduce internal_warningf() and mark internal_errorf() as noreturn
This helps tools like scan-build, and follows the example of warningf() and errorf(). ok anton@
|
#
1.88 |
|
15-Jan-2018 |
jca |
Stop pretending we support building ksh without EDIT/HISTORY support
ok anton@
|
#
1.87 |
|
14-Jan-2018 |
anton |
unifdef BRACE_EXPAND; ok jca@
|
#
1.86 |
|
05-Jan-2018 |
jca |
unifdef JOBS support
Prompted by a mail from Klemens Nanni, who also had the same diff. ok deraadt@ millert@
|
#
1.85 |
|
12-Dec-2017 |
tb |
Include hostname in shell prompts by default
With tmux, ssh and vmd, we tend to open shells on many different hosts simultaneously and the default prompts '$ ' and '# ' for {,k}sh as well as '% ' and '# ' for csh become dangerous: it's very easy to issue a command on the wrong host.
This can easily be avoided by displaying the hostname in the prompt. Everything beyond "hostname{$,#,%} " is going to be a matter of taste, so we left it at that. If you use an FQDN, only the first part (the output of 'hostname -s') will be printed.
requested by and ok deraadt; mostly positive feedback many ok anton, brynet, bcallah and others
|
#
1.84 |
|
07-Dec-2017 |
tb |
Drop the unused second argument from set_prompt(). It used to be used for early special casing of ! and !! in the PS1 expansion. This was removed from set_prompt() as part of the implementaion of the character count toggles \[ and \] back in 2004.
ok jca
|
Revision tags: OPENBSD_6_2_BASE
|
#
1.83 |
|
11-Aug-2017 |
guenther |
Retire old behavior of requiring root prompt to contain # or \!
Requested by akoshibe and phessler ok phessler@ anton@ jca@
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.82 |
|
17-Oct-2016 |
schwarze |
No need to inspect LC_CTYPE: * It was only used in vi input mode. * No functional change in case of set -o vi-show8. * No functional change if LC_CTYPE is set to UTF-8. * More robust for the default of LC_CTYPE=C on a UTF-8 xterm.
Behaviour changes for the combination LC_CTYPE=C with set +o vi-show8 on non-UTF-8 terminals, but that combination is useless and dangerous with or without this patch. If you want to edit individual raw non-ASCII non-UTF-8 bytes on the shell command line, always use set -o vi-show8. (Besides, i doubt that you actually want to do that; better use a real hex editor in the first place.)
OK czarkoff@.
|
#
1.81 |
|
11-Oct-2016 |
schwarze |
Partial UTF-8 line editing support for ksh(1) vi input mode; so far, it covers these commands: a h i l x / This is an isu8cont()-based hack similar in style to what i did in emacs input mode, but less elegant and slightly more intrusive because the vi mode code is much more ugly and less straightforward than the emacs mode code. This one required partial rewrites of a few helper functions, and comments were added while there.
This is not perfect, but hopefully reduces people's cursing until a more rigorous solution can be devised (much) later. Some polishing may be useful in tree, in particular adding utf8cont() support to a few missing commands.
Mostly written shortly after Christmas 2015. Reminded by and OK czarkoff@. Feedback, partial review and testing, no longer any objection by martijn@. Feedback and testing by tb@. Also read fine to nicm@.
|
#
1.80 |
|
08-Sep-2016 |
millert |
Mark PPID read-only as per the manual. From Anthony Coulter.
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.79 |
|
04-Mar-2016 |
deraadt |
remove CSRG BSD-licensed mknod builtin code which was previously used to accelerate install/upgrade time MAKEDEV runs. That allows ramdisk ksh to be pledged, without needing "dpath". We'll solve the performance issues a different way (soon). ok otto espie natano tb tobiasu rpe
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.78 |
|
30-Dec-2015 |
tedu |
rename global "e" to genv to avoid accidental shadowing and aliasing. ok millert nicm tb
|
#
1.77 |
|
27-Dec-2015 |
jca |
Tweak comment: we now always make a copy of argv.
ok halex@
|
#
1.76 |
|
27-Dec-2015 |
halex |
unconditionally duplicate the argv array on initialization, to make it resilient against being altered by a subsequent shift operation
tweak and ok semarie@
|
#
1.75 |
|
14-Dec-2015 |
tb |
Move system headers from sh.h to those files that actually need them.
ok mmcc@ a while ago
|
#
1.74 |
|
11-Nov-2015 |
deraadt |
exit() after perror() for pledge failure. Perhaps this got introduced as a test idiom, either when pledge was young or during the transition to strings.... dunno
|
#
1.73 |
|
01-Nov-2015 |
mmcc |
Add uses of areallocarray(). mksh and Bitrig ksh already have similar functions. With help from Theo Buehler.
ok nicm@
|
#
1.72 |
|
30-Oct-2015 |
guenther |
'fc -e -' is deprecated in favor of 'fc -s', so update the built-in alias
ok millert@
|
#
1.71 |
|
22-Oct-2015 |
mmcc |
Final removal of EXTERN.
ok nicm@
|
#
1.70 |
|
21-Oct-2015 |
mmcc |
Penultimate commit to remove EXTERN.
ok nicm@
|
#
1.69 |
|
19-Oct-2015 |
mmcc |
Move string.h include from sh.h to the files that use it.
ok nicm@
|
#
1.68 |
|
19-Oct-2015 |
mmcc |
More removal of EXTERN.
ok nicm@
|
#
1.67 |
|
19-Oct-2015 |
mmcc |
Apply style(9) to header includes.
ok nicm@
|
#
1.66 |
|
18-Oct-2015 |
mmcc |
Move more EXTERN-defined globals from sh.h.
ok nicm@
|
#
1.65 |
|
17-Oct-2015 |
mmcc |
Move a system header include from the global header (sh.h) into the files that need it. No binary change.
"This looks fine" -nicm@
|
#
1.64 |
|
16-Oct-2015 |
deraadt |
wrap a long line
|
#
1.63 |
|
16-Oct-2015 |
millert |
Implement real "flock" request and add it to userland programs that use pledge and file locking. OK deraadt@
|
#
1.62 |
|
10-Oct-2015 |
deraadt |
normalize a few more tame request orderings, to help review
|
#
1.61 |
|
10-Oct-2015 |
deraadt |
ksh can run with pledge "stdio rpath wpath cpath getpw fattr proc exec tty" if the mknod builtin is disabled. It looks like a lot of abilities, but hey, this is a shell. can't open sockets or do other nasty stuff though. (we'll leave the mknod builtin enabled on the install media for now; there is work happening to regain the MAKEDEV performance in a different way) discussions with otto & millert in particular
|
#
1.60 |
|
18-Sep-2015 |
nicm |
Last of the (thing *)0 -> NULL, from Michael McConville. No binary change.
|
#
1.59 |
|
17-Sep-2015 |
nicm |
Remove unnecessary casts, from Michael McConville. No binary change.
|
#
1.58 |
|
15-Sep-2015 |
tedu |
correct spelling of NULL from (char *)0. from Michael McConville. ok md5
|
#
1.57 |
|
10-Sep-2015 |
nicm |
Replace newline and space defines by "\n" and " " directly, from Michael McConville. ok millert
|
#
1.56 |
|
01-Sep-2015 |
tedu |
no need to check for null argv anymore. from Martijn van Duren ok deraadt
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.55 |
|
09-Feb-2015 |
jsg |
If we hit multiple errors while unwinding we'll end up running code that assumes a pointer is valid when it has been free'd.
This is convoluted as ksh has it's own allocator and uses long jumps. Set the pointer to NULL after the quitenv() call in unwind() in case we later hit a long jump in unwind().
Found with afl a while back.
ok tedu@ deraadt@
|
Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
|
#
1.54 |
|
28-Nov-2013 |
sobrado |
remove trailing whitespaces; use tabs instead of spaces where appropriate; no binary changes.
|
#
1.53 |
|
04-Sep-2013 |
millert |
Add a proper suspend builtin that saves/restores the tty and pgrp as needed instead of an alias that just sends SIGSTOP. Login shells may be suspended if they are not running in an orphan process group. OK guenther@ jmc@
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.52 |
|
15-Jun-2013 |
millert |
Run any pending traps before calling the EXIT or ERR traps when -e is set. Fixes a bug where we would not run the signal trap if, for example, ^C was pressed and -e was set. OK espie@
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.51 |
|
10-Sep-2012 |
tedu |
fake a sigwinch after each job, so if the terminal changes size, we'll notice and update
|
#
1.50 |
|
06-Sep-2012 |
millert |
Avoid modifying argv when building argv for $* and $@ since it will affect ps output. This can happen when command line options are specified, e.g. "sh -c command". Based on a diff from espie@ OK espie@
|
#
1.49 |
|
05-Sep-2012 |
espie |
backout, Todd's version may be cleaner, but it's also wrong.
|
#
1.48 |
|
05-Sep-2012 |
espie |
sh -c should not munge argv[]. This fixes ps -ww output.
joint work by millert@ and me@.
okay otto@, deraadt@ "feel free to commit my version" millert@
|
Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.47 |
|
07-Sep-2011 |
otto |
beter determination if the shell is restricted; from Alf Schlichting. ok jasper@ millert@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
|
#
1.46 |
|
19-May-2010 |
jasper |
properly keep track of the line number after a trap. this fixes pr 6195. diff from manuel giraud, thanks.
ok kili@
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
|
#
1.45 |
|
29-Jan-2009 |
jaredy |
pass "xerrok" status across the execution call stack to more closely match what both POSIX and ksh.1 already describe in regards to set -e/errexit's behavior in determining when to exit from nonzero return values.
specifically, the truth values tested as operands to `&&' and `||', as well as the resulting compound expression itself, along with the truth value resulting from a negated command (i.e. a pipeline prefixed `!'), should not make the shell exit when -e is in effect.
issue reported by matthieu. testing matthieu, naddy. ok miod (earlier version), otto. man page ok jmc.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.44 |
|
05-Jul-2008 |
djm |
ksh starting as root will refuse to import a PS1 prompt unless it contains a '#' character. Make it also accept the \$ PS1 sequence (which is supposed to automagically be $ or # depending on the user running the shell) unless ksh has been started in sh-compatibility mode.
pointed out by millert@ when I asked why my SUDO_PS1 was not being honoured; ok millert@
|
Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
|
#
1.43 |
|
31-May-2007 |
otto |
Only process ENV when in interactive mode as SU says. Started by tedu to fix make -j, SU thing spotted by naddy@; ok millert@ @tedu jmc@ for the man page bit.
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.42 |
|
02-Nov-2006 |
ray |
Only check if last three letters are "/sh" if string is at least three characters long.
OK moritz@.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.41 |
|
10-Apr-2006 |
jaredy |
fix lint comments, no functional changes; ok ray
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.40 |
|
11-Dec-2005 |
otto |
fix a few name clashes with libc; found by lint. ok deraadt@
|
#
1.39 |
|
11-Dec-2005 |
deraadt |
remove unused variables and functions
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.38 |
|
30-Mar-2005 |
deraadt |
lots of indentation cleanup, now ksh is readable like our other code. double checked to make sure no binaries change, and eyed by niallo
|
#
1.37 |
|
28-Mar-2005 |
deraadt |
if argv[0] not set, do not set it to "pdksh", but to "ksh"
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
21-Feb-2005 |
otto |
Set \u in prompt expansion to the right value, while avoiding getpw* calls, which might be very inconvenient when the yp server is not available.
ok deraadt@ millert@
|
#
1.35 |
|
22-Dec-2004 |
otto |
Fix a use-after-free, that causs core dumps if a shell is killed running with strict malloc.conf options. Problem spotted by hshoexer@; fix by me with some help from millert@.
ok millert@ hshoexer@ krw@ deraadt@
|
#
1.34 |
|
22-Dec-2004 |
millert |
Use stdbool.h instead of rolling our own bools.
|
#
1.33 |
|
20-Dec-2004 |
otto |
Ansification plus some minor knf. No binary change on i386 and sparc64, binary change in lex.o on macppc due to introduction of dopprompt() prototype. ok millert@
|
#
1.32 |
|
18-Dec-2004 |
millert |
deregister
|
#
1.31 |
|
18-Dec-2004 |
millert |
When invoked as sh set SH_VERSION, not KSH_VERSION like the man page says.
|
#
1.30 |
|
18-Dec-2004 |
millert |
Get rid of #ifdef KSH since we don't care about building a V7 style sh and the #ifdef KSH code is required to make a POSIX sh. From Matthias Kilian
|
#
1.29 |
|
18-Dec-2004 |
millert |
Remove unused OS dependent #ifdef blocks, #defines and macro abstraction. First step in making the ksh code easier to read. From Matthias Kilian
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.28 |
|
23-Aug-2004 |
millert |
Don't send SIGINT or SIGTERM to the entire processes group when the shell receives SIGINT/SIGTERM unless the shell is the process group leader. Fixes PR 3820. OK danh@ sturm@ miod@
|
#
1.27 |
|
07-Jun-2004 |
deraadt |
do not push ksh into stupid-random mode; leave it in arc4random() mode. oops. spotted by weerd@weirdnet.nl
|
Revision tags: OPENBSD_3_5_BASE
|
#
1.26 |
|
08-Jan-2004 |
jmc |
typo; from ray at cyth dot net (PR 3632);
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.25 |
|
26-Jun-2003 |
deraadt |
protos
|
#
1.24 |
|
04-Apr-2003 |
deraadt |
two fixes; help from tedu & tdeval
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.23 |
|
10-Mar-2003 |
david |
spelling fixes ok millert@
|
#
1.22 |
|
28-Feb-2003 |
jmc |
typos; from Brian Poole
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.21 |
|
09-Jun-2002 |
todd |
knf
|
Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE
|
#
1.20 |
|
19-Dec-2000 |
markus |
do not reset nonblock if shell is not interactive, from crossd@cs.rpi.edu (i should have commited this about 6 months ago, ok millert@).
|
Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
|
#
1.19 |
|
14-Nov-1999 |
millert |
Better fix for PR #921 (main.c rev 1.18) from the pdksh cvs tree.
|
#
1.18 |
|
14-Nov-1999 |
millert |
Fix a core dump caused by a signal race; yval@hackers.co.il
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.17 |
|
04-Aug-1999 |
millert |
Turn <tab> completion on by default for people used to bash, tcsh, etc...
|
#
1.16 |
|
15-Jul-1999 |
millert |
o Set default line edit mode to emacs (VISUAL/EDITOR or user can override) o Spell environment correctly
|
#
1.15 |
|
15-Jun-1999 |
millert |
patches from pdksh 5.2.13.11
|
#
1.14 |
|
27-Apr-1999 |
millert |
disable newgrp alias since OpenBSD doesn't have a newgrp(1)
|
Revision tags: OPENBSD_2_5_BASE
|
#
1.13 |
|
10-Jan-1999 |
millert |
sync with pdksh-unstable-5.2.13.6
|
#
1.12 |
|
08-Jan-1999 |
millert |
bug fixes from pdksh-unstable-5.2.13.5; some of which we already had.
|
#
1.11 |
|
29-Oct-1998 |
millert |
Bug fixes from pdksh-unstable-5.2.13.4, including "official" versions of some that we had already fixed locally. o typeset -f FUNC doesn't print follows command (and expression) substitutions. o when re-allocating memory, too much may be copied from old memory. o set -o printed some options sans names. o emacs mode: <esc>. in very fist command causes core dump. o pdksh dumps core after a cd command. o typeset -i reports on array elements that have no value (at&t ksh reports on array base name - no index). o ulimit -ctn unlimittttted kills shell (resource exceeded). o ". /dev/null" says access denied. o flag field in aliases incorrectly changed (all flags set instead of clearing ISSET) in exec.c(flushcom). o ${#array[*]} prints largest index instead of number of (set) elements in an array (ksh88 does the former). o sys_siglist[] doesn't always have NSIG non-null entries...
|
Revision tags: OPENBSD_2_4_BASE
|
#
1.10 |
|
25-Jun-1998 |
millert |
pdksh-5.2.13 + local changes
|
Revision tags: OPENBSD_2_3_BASE
|
#
1.9 |
|
12-Sep-1997 |
deraadt |
do not quitenv() too early, or "s" goes away due to it's temporary nature; fix found in freebsd ports tree.. original by ejc@bazzle.com
|
#
1.8 |
|
01-Sep-1997 |
deraadt |
i am bored enough to fix terminal space/tab uglies
|
#
1.7 |
|
19-Jun-1997 |
kstailey |
back out
|
#
1.6 |
|
18-Jun-1997 |
kstailey |
(foo *)0 -> NULL
|
#
1.5 |
|
02-Jan-1997 |
downsj |
Add FSH (set -o sh), initialize it if we're /bin/sh, and add the first use: don't set $_ if we're non-interactive.
|
#
1.4 |
|
21-Nov-1996 |
downsj |
Update to 5.2.12.
|
#
1.3 |
|
01-Oct-1996 |
downsj |
Integrate pdksh 5.2.9.
|
#
1.2 |
|
19-Aug-1996 |
downsj |
update to pdksh-5.2.8
|
#
1.1 |
|
14-Aug-1996 |
downsj |
branches: 1.1.1; Initial revision
|
#
1.97 |
|
20-Feb-2019 |
schwarze |
When evaluating an arithmetical expression, for example inside $(()), 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.96 |
|
20-Nov-2018 |
martijn |
Fix the case where the recursion detection isn't reset when the command is interrupted.
Lots of back and forth with anton@ OK jca@, tb@, anton@
|
#
1.95 |
|
17-Nov-2018 |
deraadt |
Use a very regular call pattern to pledge, so that we can continue to grep and compare the use in all programs..
|
#
1.94 |
|
16-Nov-2018 |
nicm |
Include "id" in pledge (for setres[ug]id, setgroups) if the shell is privileged and remove it when dropping privileges (set +p), setting a flag to make sure we don't do it again.
ok deraadt millert
|
Revision tags: OPENBSD_6_4_BASE
|
#
1.93 |
|
29-Sep-2018 |
millert |
Export the PWD and OLDPWD shell variables as per POSIX. Previously, these would only be exported if they were present in the environment when the shell started. OK deraadt@ anton@ kn@
|
#
1.92 |
|
18-May-2018 |
benno |
remove the alias type='whence -v' and replace it with 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@
|
#
1.91 |
|
09-Apr-2018 |
tobias |
Support 64 bit integers on 32 bit architectures.
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
|
Revision tags: OPENBSD_6_3_BASE
|
#
1.90 |
|
15-Mar-2018 |
anton |
Favor usage of __func__ in warning/error messages. Some of them referred to the wrong function and fix the rest for consistency. Diff from Michael W. Bombardieri with some cosmetic cleanup applied.
ok benno@ tb@
|
#
1.89 |
|
16-Jan-2018 |
jca |
Introduce internal_warningf() and mark internal_errorf() as noreturn
This helps tools like scan-build, and follows the example of warningf() and errorf(). ok anton@
|
#
1.88 |
|
15-Jan-2018 |
jca |
Stop pretending we support building ksh without EDIT/HISTORY support
ok anton@
|
#
1.87 |
|
14-Jan-2018 |
anton |
unifdef BRACE_EXPAND; ok jca@
|
#
1.86 |
|
05-Jan-2018 |
jca |
unifdef JOBS support
Prompted by a mail from Klemens Nanni, who also had the same diff. ok deraadt@ millert@
|
#
1.85 |
|
12-Dec-2017 |
tb |
Include hostname in shell prompts by default
With tmux, ssh and vmd, we tend to open shells on many different hosts simultaneously and the default prompts '$ ' and '# ' for {,k}sh as well as '% ' and '# ' for csh become dangerous: it's very easy to issue a command on the wrong host.
This can easily be avoided by displaying the hostname in the prompt. Everything beyond "hostname{$,#,%} " is going to be a matter of taste, so we left it at that. If you use an FQDN, only the first part (the output of 'hostname -s') will be printed.
requested by and ok deraadt; mostly positive feedback many ok anton, brynet, bcallah and others
|
#
1.84 |
|
07-Dec-2017 |
tb |
Drop the unused second argument from set_prompt(). It used to be used for early special casing of ! and !! in the PS1 expansion. This was removed from set_prompt() as part of the implementaion of the character count toggles \[ and \] back in 2004.
ok jca
|
Revision tags: OPENBSD_6_2_BASE
|
#
1.83 |
|
11-Aug-2017 |
guenther |
Retire old behavior of requiring root prompt to contain # or \!
Requested by akoshibe and phessler ok phessler@ anton@ jca@
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.82 |
|
17-Oct-2016 |
schwarze |
No need to inspect LC_CTYPE: * It was only used in vi input mode. * No functional change in case of set -o vi-show8. * No functional change if LC_CTYPE is set to UTF-8. * More robust for the default of LC_CTYPE=C on a UTF-8 xterm.
Behaviour changes for the combination LC_CTYPE=C with set +o vi-show8 on non-UTF-8 terminals, but that combination is useless and dangerous with or without this patch. If you want to edit individual raw non-ASCII non-UTF-8 bytes on the shell command line, always use set -o vi-show8. (Besides, i doubt that you actually want to do that; better use a real hex editor in the first place.)
OK czarkoff@.
|
#
1.81 |
|
11-Oct-2016 |
schwarze |
Partial UTF-8 line editing support for ksh(1) vi input mode; so far, it covers these commands: a h i l x / This is an isu8cont()-based hack similar in style to what i did in emacs input mode, but less elegant and slightly more intrusive because the vi mode code is much more ugly and less straightforward than the emacs mode code. This one required partial rewrites of a few helper functions, and comments were added while there.
This is not perfect, but hopefully reduces people's cursing until a more rigorous solution can be devised (much) later. Some polishing may be useful in tree, in particular adding utf8cont() support to a few missing commands.
Mostly written shortly after Christmas 2015. Reminded by and OK czarkoff@. Feedback, partial review and testing, no longer any objection by martijn@. Feedback and testing by tb@. Also read fine to nicm@.
|
#
1.80 |
|
08-Sep-2016 |
millert |
Mark PPID read-only as per the manual. From Anthony Coulter.
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.79 |
|
04-Mar-2016 |
deraadt |
remove CSRG BSD-licensed mknod builtin code which was previously used to accelerate install/upgrade time MAKEDEV runs. That allows ramdisk ksh to be pledged, without needing "dpath". We'll solve the performance issues a different way (soon). ok otto espie natano tb tobiasu rpe
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.78 |
|
30-Dec-2015 |
tedu |
rename global "e" to genv to avoid accidental shadowing and aliasing. ok millert nicm tb
|
#
1.77 |
|
27-Dec-2015 |
jca |
Tweak comment: we now always make a copy of argv.
ok halex@
|
#
1.76 |
|
27-Dec-2015 |
halex |
unconditionally duplicate the argv array on initialization, to make it resilient against being altered by a subsequent shift operation
tweak and ok semarie@
|
#
1.75 |
|
14-Dec-2015 |
tb |
Move system headers from sh.h to those files that actually need them.
ok mmcc@ a while ago
|
#
1.74 |
|
11-Nov-2015 |
deraadt |
exit() after perror() for pledge failure. Perhaps this got introduced as a test idiom, either when pledge was young or during the transition to strings.... dunno
|
#
1.73 |
|
01-Nov-2015 |
mmcc |
Add uses of areallocarray(). mksh and Bitrig ksh already have similar functions. With help from Theo Buehler.
ok nicm@
|
#
1.72 |
|
30-Oct-2015 |
guenther |
'fc -e -' is deprecated in favor of 'fc -s', so update the built-in alias
ok millert@
|
#
1.71 |
|
22-Oct-2015 |
mmcc |
Final removal of EXTERN.
ok nicm@
|
#
1.70 |
|
21-Oct-2015 |
mmcc |
Penultimate commit to remove EXTERN.
ok nicm@
|
#
1.69 |
|
19-Oct-2015 |
mmcc |
Move string.h include from sh.h to the files that use it.
ok nicm@
|
#
1.68 |
|
19-Oct-2015 |
mmcc |
More removal of EXTERN.
ok nicm@
|
#
1.67 |
|
19-Oct-2015 |
mmcc |
Apply style(9) to header includes.
ok nicm@
|
#
1.66 |
|
18-Oct-2015 |
mmcc |
Move more EXTERN-defined globals from sh.h.
ok nicm@
|
#
1.65 |
|
17-Oct-2015 |
mmcc |
Move a system header include from the global header (sh.h) into the files that need it. No binary change.
"This looks fine" -nicm@
|
#
1.64 |
|
16-Oct-2015 |
deraadt |
wrap a long line
|
#
1.63 |
|
16-Oct-2015 |
millert |
Implement real "flock" request and add it to userland programs that use pledge and file locking. OK deraadt@
|
#
1.62 |
|
10-Oct-2015 |
deraadt |
normalize a few more tame request orderings, to help review
|
#
1.61 |
|
10-Oct-2015 |
deraadt |
ksh can run with pledge "stdio rpath wpath cpath getpw fattr proc exec tty" if the mknod builtin is disabled. It looks like a lot of abilities, but hey, this is a shell. can't open sockets or do other nasty stuff though. (we'll leave the mknod builtin enabled on the install media for now; there is work happening to regain the MAKEDEV performance in a different way) discussions with otto & millert in particular
|
#
1.60 |
|
18-Sep-2015 |
nicm |
Last of the (thing *)0 -> NULL, from Michael McConville. No binary change.
|
#
1.59 |
|
17-Sep-2015 |
nicm |
Remove unnecessary casts, from Michael McConville. No binary change.
|
#
1.58 |
|
15-Sep-2015 |
tedu |
correct spelling of NULL from (char *)0. from Michael McConville. ok md5
|
#
1.57 |
|
10-Sep-2015 |
nicm |
Replace newline and space defines by "\n" and " " directly, from Michael McConville. ok millert
|
#
1.56 |
|
01-Sep-2015 |
tedu |
no need to check for null argv anymore. from Martijn van Duren ok deraadt
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.55 |
|
09-Feb-2015 |
jsg |
If we hit multiple errors while unwinding we'll end up running code that assumes a pointer is valid when it has been free'd.
This is convoluted as ksh has it's own allocator and uses long jumps. Set the pointer to NULL after the quitenv() call in unwind() in case we later hit a long jump in unwind().
Found with afl a while back.
ok tedu@ deraadt@
|
Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
|
#
1.54 |
|
28-Nov-2013 |
sobrado |
remove trailing whitespaces; use tabs instead of spaces where appropriate; no binary changes.
|
#
1.53 |
|
04-Sep-2013 |
millert |
Add a proper suspend builtin that saves/restores the tty and pgrp as needed instead of an alias that just sends SIGSTOP. Login shells may be suspended if they are not running in an orphan process group. OK guenther@ jmc@
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.52 |
|
15-Jun-2013 |
millert |
Run any pending traps before calling the EXIT or ERR traps when -e is set. Fixes a bug where we would not run the signal trap if, for example, ^C was pressed and -e was set. OK espie@
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.51 |
|
10-Sep-2012 |
tedu |
fake a sigwinch after each job, so if the terminal changes size, we'll notice and update
|
#
1.50 |
|
06-Sep-2012 |
millert |
Avoid modifying argv when building argv for $* and $@ since it will affect ps output. This can happen when command line options are specified, e.g. "sh -c command". Based on a diff from espie@ OK espie@
|
#
1.49 |
|
05-Sep-2012 |
espie |
backout, Todd's version may be cleaner, but it's also wrong.
|
#
1.48 |
|
05-Sep-2012 |
espie |
sh -c should not munge argv[]. This fixes ps -ww output.
joint work by millert@ and me@.
okay otto@, deraadt@ "feel free to commit my version" millert@
|
Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.47 |
|
07-Sep-2011 |
otto |
beter determination if the shell is restricted; from Alf Schlichting. ok jasper@ millert@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
|
#
1.46 |
|
19-May-2010 |
jasper |
properly keep track of the line number after a trap. this fixes pr 6195. diff from manuel giraud, thanks.
ok kili@
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
|
#
1.45 |
|
29-Jan-2009 |
jaredy |
pass "xerrok" status across the execution call stack to more closely match what both POSIX and ksh.1 already describe in regards to set -e/errexit's behavior in determining when to exit from nonzero return values.
specifically, the truth values tested as operands to `&&' and `||', as well as the resulting compound expression itself, along with the truth value resulting from a negated command (i.e. a pipeline prefixed `!'), should not make the shell exit when -e is in effect.
issue reported by matthieu. testing matthieu, naddy. ok miod (earlier version), otto. man page ok jmc.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.44 |
|
05-Jul-2008 |
djm |
ksh starting as root will refuse to import a PS1 prompt unless it contains a '#' character. Make it also accept the \$ PS1 sequence (which is supposed to automagically be $ or # depending on the user running the shell) unless ksh has been started in sh-compatibility mode.
pointed out by millert@ when I asked why my SUDO_PS1 was not being honoured; ok millert@
|
Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
|
#
1.43 |
|
31-May-2007 |
otto |
Only process ENV when in interactive mode as SU says. Started by tedu to fix make -j, SU thing spotted by naddy@; ok millert@ @tedu jmc@ for the man page bit.
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.42 |
|
02-Nov-2006 |
ray |
Only check if last three letters are "/sh" if string is at least three characters long.
OK moritz@.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.41 |
|
10-Apr-2006 |
jaredy |
fix lint comments, no functional changes; ok ray
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.40 |
|
11-Dec-2005 |
otto |
fix a few name clashes with libc; found by lint. ok deraadt@
|
#
1.39 |
|
11-Dec-2005 |
deraadt |
remove unused variables and functions
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.38 |
|
30-Mar-2005 |
deraadt |
lots of indentation cleanup, now ksh is readable like our other code. double checked to make sure no binaries change, and eyed by niallo
|
#
1.37 |
|
28-Mar-2005 |
deraadt |
if argv[0] not set, do not set it to "pdksh", but to "ksh"
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
21-Feb-2005 |
otto |
Set \u in prompt expansion to the right value, while avoiding getpw* calls, which might be very inconvenient when the yp server is not available.
ok deraadt@ millert@
|
#
1.35 |
|
22-Dec-2004 |
otto |
Fix a use-after-free, that causs core dumps if a shell is killed running with strict malloc.conf options. Problem spotted by hshoexer@; fix by me with some help from millert@.
ok millert@ hshoexer@ krw@ deraadt@
|
#
1.34 |
|
22-Dec-2004 |
millert |
Use stdbool.h instead of rolling our own bools.
|
#
1.33 |
|
20-Dec-2004 |
otto |
Ansification plus some minor knf. No binary change on i386 and sparc64, binary change in lex.o on macppc due to introduction of dopprompt() prototype. ok millert@
|
#
1.32 |
|
18-Dec-2004 |
millert |
deregister
|
#
1.31 |
|
18-Dec-2004 |
millert |
When invoked as sh set SH_VERSION, not KSH_VERSION like the man page says.
|
#
1.30 |
|
18-Dec-2004 |
millert |
Get rid of #ifdef KSH since we don't care about building a V7 style sh and the #ifdef KSH code is required to make a POSIX sh. From Matthias Kilian
|
#
1.29 |
|
18-Dec-2004 |
millert |
Remove unused OS dependent #ifdef blocks, #defines and macro abstraction. First step in making the ksh code easier to read. From Matthias Kilian
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.28 |
|
23-Aug-2004 |
millert |
Don't send SIGINT or SIGTERM to the entire processes group when the shell receives SIGINT/SIGTERM unless the shell is the process group leader. Fixes PR 3820. OK danh@ sturm@ miod@
|
#
1.27 |
|
07-Jun-2004 |
deraadt |
do not push ksh into stupid-random mode; leave it in arc4random() mode. oops. spotted by weerd@weirdnet.nl
|
Revision tags: OPENBSD_3_5_BASE
|
#
1.26 |
|
08-Jan-2004 |
jmc |
typo; from ray at cyth dot net (PR 3632);
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.25 |
|
26-Jun-2003 |
deraadt |
protos
|
#
1.24 |
|
04-Apr-2003 |
deraadt |
two fixes; help from tedu & tdeval
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.23 |
|
10-Mar-2003 |
david |
spelling fixes ok millert@
|
#
1.22 |
|
28-Feb-2003 |
jmc |
typos; from Brian Poole
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.21 |
|
09-Jun-2002 |
todd |
knf
|
Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE
|
#
1.20 |
|
19-Dec-2000 |
markus |
do not reset nonblock if shell is not interactive, from crossd@cs.rpi.edu (i should have commited this about 6 months ago, ok millert@).
|
Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
|
#
1.19 |
|
14-Nov-1999 |
millert |
Better fix for PR #921 (main.c rev 1.18) from the pdksh cvs tree.
|
#
1.18 |
|
14-Nov-1999 |
millert |
Fix a core dump caused by a signal race; yval@hackers.co.il
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.17 |
|
04-Aug-1999 |
millert |
Turn <tab> completion on by default for people used to bash, tcsh, etc...
|
#
1.16 |
|
15-Jul-1999 |
millert |
o Set default line edit mode to emacs (VISUAL/EDITOR or user can override) o Spell environment correctly
|
#
1.15 |
|
15-Jun-1999 |
millert |
patches from pdksh 5.2.13.11
|
#
1.14 |
|
27-Apr-1999 |
millert |
disable newgrp alias since OpenBSD doesn't have a newgrp(1)
|
Revision tags: OPENBSD_2_5_BASE
|
#
1.13 |
|
10-Jan-1999 |
millert |
sync with pdksh-unstable-5.2.13.6
|
#
1.12 |
|
08-Jan-1999 |
millert |
bug fixes from pdksh-unstable-5.2.13.5; some of which we already had.
|
#
1.11 |
|
29-Oct-1998 |
millert |
Bug fixes from pdksh-unstable-5.2.13.4, including "official" versions of some that we had already fixed locally. o typeset -f FUNC doesn't print follows command (and expression) substitutions. o when re-allocating memory, too much may be copied from old memory. o set -o printed some options sans names. o emacs mode: <esc>. in very fist command causes core dump. o pdksh dumps core after a cd command. o typeset -i reports on array elements that have no value (at&t ksh reports on array base name - no index). o ulimit -ctn unlimittttted kills shell (resource exceeded). o ". /dev/null" says access denied. o flag field in aliases incorrectly changed (all flags set instead of clearing ISSET) in exec.c(flushcom). o ${#array[*]} prints largest index instead of number of (set) elements in an array (ksh88 does the former). o sys_siglist[] doesn't always have NSIG non-null entries...
|
Revision tags: OPENBSD_2_4_BASE
|
#
1.10 |
|
25-Jun-1998 |
millert |
pdksh-5.2.13 + local changes
|
Revision tags: OPENBSD_2_3_BASE
|
#
1.9 |
|
12-Sep-1997 |
deraadt |
do not quitenv() too early, or "s" goes away due to it's temporary nature; fix found in freebsd ports tree.. original by ejc@bazzle.com
|
#
1.8 |
|
01-Sep-1997 |
deraadt |
i am bored enough to fix terminal space/tab uglies
|
#
1.7 |
|
19-Jun-1997 |
kstailey |
back out
|
#
1.6 |
|
18-Jun-1997 |
kstailey |
(foo *)0 -> NULL
|
#
1.5 |
|
02-Jan-1997 |
downsj |
Add FSH (set -o sh), initialize it if we're /bin/sh, and add the first use: don't set $_ if we're non-interactive.
|
#
1.4 |
|
21-Nov-1996 |
downsj |
Update to 5.2.12.
|
#
1.3 |
|
01-Oct-1996 |
downsj |
Integrate pdksh 5.2.9.
|
#
1.2 |
|
19-Aug-1996 |
downsj |
update to pdksh-5.2.8
|
#
1.1 |
|
14-Aug-1996 |
downsj |
branches: 1.1.1; Initial revision
|
#
1.96 |
|
20-Nov-2018 |
martijn |
Fix the case where the recursion detection isn't reset when the command is interrupted.
Lots of back and forth with anton@ OK jca@, tb@, anton@
|
#
1.95 |
|
17-Nov-2018 |
deraadt |
Use a very regular call pattern to pledge, so that we can continue to grep and compare the use in all programs..
|
#
1.94 |
|
16-Nov-2018 |
nicm |
Include "id" in pledge (for setres[ug]id, setgroups) if the shell is privileged and remove it when dropping privileges (set +p), setting a flag to make sure we don't do it again.
ok deraadt millert
|
Revision tags: OPENBSD_6_4_BASE
|
#
1.93 |
|
29-Sep-2018 |
millert |
Export the PWD and OLDPWD shell variables as per POSIX. Previously, these would only be exported if they were present in the environment when the shell started. OK deraadt@ anton@ kn@
|
#
1.92 |
|
18-May-2018 |
benno |
remove the alias type='whence -v' and replace it with 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@
|
#
1.91 |
|
09-Apr-2018 |
tobias |
Support 64 bit integers on 32 bit architectures.
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
|
Revision tags: OPENBSD_6_3_BASE
|
#
1.90 |
|
15-Mar-2018 |
anton |
Favor usage of __func__ in warning/error messages. Some of them referred to the wrong function and fix the rest for consistency. Diff from Michael W. Bombardieri with some cosmetic cleanup applied.
ok benno@ tb@
|
#
1.89 |
|
16-Jan-2018 |
jca |
Introduce internal_warningf() and mark internal_errorf() as noreturn
This helps tools like scan-build, and follows the example of warningf() and errorf(). ok anton@
|
#
1.88 |
|
15-Jan-2018 |
jca |
Stop pretending we support building ksh without EDIT/HISTORY support
ok anton@
|
#
1.87 |
|
14-Jan-2018 |
anton |
unifdef BRACE_EXPAND; ok jca@
|
#
1.86 |
|
05-Jan-2018 |
jca |
unifdef JOBS support
Prompted by a mail from Klemens Nanni, who also had the same diff. ok deraadt@ millert@
|
#
1.85 |
|
12-Dec-2017 |
tb |
Include hostname in shell prompts by default
With tmux, ssh and vmd, we tend to open shells on many different hosts simultaneously and the default prompts '$ ' and '# ' for {,k}sh as well as '% ' and '# ' for csh become dangerous: it's very easy to issue a command on the wrong host.
This can easily be avoided by displaying the hostname in the prompt. Everything beyond "hostname{$,#,%} " is going to be a matter of taste, so we left it at that. If you use an FQDN, only the first part (the output of 'hostname -s') will be printed.
requested by and ok deraadt; mostly positive feedback many ok anton, brynet, bcallah and others
|
#
1.84 |
|
07-Dec-2017 |
tb |
Drop the unused second argument from set_prompt(). It used to be used for early special casing of ! and !! in the PS1 expansion. This was removed from set_prompt() as part of the implementaion of the character count toggles \[ and \] back in 2004.
ok jca
|
Revision tags: OPENBSD_6_2_BASE
|
#
1.83 |
|
11-Aug-2017 |
guenther |
Retire old behavior of requiring root prompt to contain # or \!
Requested by akoshibe and phessler ok phessler@ anton@ jca@
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.82 |
|
17-Oct-2016 |
schwarze |
No need to inspect LC_CTYPE: * It was only used in vi input mode. * No functional change in case of set -o vi-show8. * No functional change if LC_CTYPE is set to UTF-8. * More robust for the default of LC_CTYPE=C on a UTF-8 xterm.
Behaviour changes for the combination LC_CTYPE=C with set +o vi-show8 on non-UTF-8 terminals, but that combination is useless and dangerous with or without this patch. If you want to edit individual raw non-ASCII non-UTF-8 bytes on the shell command line, always use set -o vi-show8. (Besides, i doubt that you actually want to do that; better use a real hex editor in the first place.)
OK czarkoff@.
|
#
1.81 |
|
11-Oct-2016 |
schwarze |
Partial UTF-8 line editing support for ksh(1) vi input mode; so far, it covers these commands: a h i l x / This is an isu8cont()-based hack similar in style to what i did in emacs input mode, but less elegant and slightly more intrusive because the vi mode code is much more ugly and less straightforward than the emacs mode code. This one required partial rewrites of a few helper functions, and comments were added while there.
This is not perfect, but hopefully reduces people's cursing until a more rigorous solution can be devised (much) later. Some polishing may be useful in tree, in particular adding utf8cont() support to a few missing commands.
Mostly written shortly after Christmas 2015. Reminded by and OK czarkoff@. Feedback, partial review and testing, no longer any objection by martijn@. Feedback and testing by tb@. Also read fine to nicm@.
|
#
1.80 |
|
08-Sep-2016 |
millert |
Mark PPID read-only as per the manual. From Anthony Coulter.
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.79 |
|
04-Mar-2016 |
deraadt |
remove CSRG BSD-licensed mknod builtin code which was previously used to accelerate install/upgrade time MAKEDEV runs. That allows ramdisk ksh to be pledged, without needing "dpath". We'll solve the performance issues a different way (soon). ok otto espie natano tb tobiasu rpe
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.78 |
|
30-Dec-2015 |
tedu |
rename global "e" to genv to avoid accidental shadowing and aliasing. ok millert nicm tb
|
#
1.77 |
|
27-Dec-2015 |
jca |
Tweak comment: we now always make a copy of argv.
ok halex@
|
#
1.76 |
|
27-Dec-2015 |
halex |
unconditionally duplicate the argv array on initialization, to make it resilient against being altered by a subsequent shift operation
tweak and ok semarie@
|
#
1.75 |
|
14-Dec-2015 |
tb |
Move system headers from sh.h to those files that actually need them.
ok mmcc@ a while ago
|
#
1.74 |
|
11-Nov-2015 |
deraadt |
exit() after perror() for pledge failure. Perhaps this got introduced as a test idiom, either when pledge was young or during the transition to strings.... dunno
|
#
1.73 |
|
01-Nov-2015 |
mmcc |
Add uses of areallocarray(). mksh and Bitrig ksh already have similar functions. With help from Theo Buehler.
ok nicm@
|
#
1.72 |
|
30-Oct-2015 |
guenther |
'fc -e -' is deprecated in favor of 'fc -s', so update the built-in alias
ok millert@
|
#
1.71 |
|
22-Oct-2015 |
mmcc |
Final removal of EXTERN.
ok nicm@
|
#
1.70 |
|
21-Oct-2015 |
mmcc |
Penultimate commit to remove EXTERN.
ok nicm@
|
#
1.69 |
|
19-Oct-2015 |
mmcc |
Move string.h include from sh.h to the files that use it.
ok nicm@
|
#
1.68 |
|
19-Oct-2015 |
mmcc |
More removal of EXTERN.
ok nicm@
|
#
1.67 |
|
19-Oct-2015 |
mmcc |
Apply style(9) to header includes.
ok nicm@
|
#
1.66 |
|
18-Oct-2015 |
mmcc |
Move more EXTERN-defined globals from sh.h.
ok nicm@
|
#
1.65 |
|
17-Oct-2015 |
mmcc |
Move a system header include from the global header (sh.h) into the files that need it. No binary change.
"This looks fine" -nicm@
|
#
1.64 |
|
16-Oct-2015 |
deraadt |
wrap a long line
|
#
1.63 |
|
16-Oct-2015 |
millert |
Implement real "flock" request and add it to userland programs that use pledge and file locking. OK deraadt@
|
#
1.62 |
|
10-Oct-2015 |
deraadt |
normalize a few more tame request orderings, to help review
|
#
1.61 |
|
10-Oct-2015 |
deraadt |
ksh can run with pledge "stdio rpath wpath cpath getpw fattr proc exec tty" if the mknod builtin is disabled. It looks like a lot of abilities, but hey, this is a shell. can't open sockets or do other nasty stuff though. (we'll leave the mknod builtin enabled on the install media for now; there is work happening to regain the MAKEDEV performance in a different way) discussions with otto & millert in particular
|
#
1.60 |
|
18-Sep-2015 |
nicm |
Last of the (thing *)0 -> NULL, from Michael McConville. No binary change.
|
#
1.59 |
|
17-Sep-2015 |
nicm |
Remove unnecessary casts, from Michael McConville. No binary change.
|
#
1.58 |
|
15-Sep-2015 |
tedu |
correct spelling of NULL from (char *)0. from Michael McConville. ok md5
|
#
1.57 |
|
10-Sep-2015 |
nicm |
Replace newline and space defines by "\n" and " " directly, from Michael McConville. ok millert
|
#
1.56 |
|
01-Sep-2015 |
tedu |
no need to check for null argv anymore. from Martijn van Duren ok deraadt
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.55 |
|
09-Feb-2015 |
jsg |
If we hit multiple errors while unwinding we'll end up running code that assumes a pointer is valid when it has been free'd.
This is convoluted as ksh has it's own allocator and uses long jumps. Set the pointer to NULL after the quitenv() call in unwind() in case we later hit a long jump in unwind().
Found with afl a while back.
ok tedu@ deraadt@
|
Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
|
#
1.54 |
|
28-Nov-2013 |
sobrado |
remove trailing whitespaces; use tabs instead of spaces where appropriate; no binary changes.
|
#
1.53 |
|
04-Sep-2013 |
millert |
Add a proper suspend builtin that saves/restores the tty and pgrp as needed instead of an alias that just sends SIGSTOP. Login shells may be suspended if they are not running in an orphan process group. OK guenther@ jmc@
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.52 |
|
15-Jun-2013 |
millert |
Run any pending traps before calling the EXIT or ERR traps when -e is set. Fixes a bug where we would not run the signal trap if, for example, ^C was pressed and -e was set. OK espie@
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.51 |
|
10-Sep-2012 |
tedu |
fake a sigwinch after each job, so if the terminal changes size, we'll notice and update
|
#
1.50 |
|
06-Sep-2012 |
millert |
Avoid modifying argv when building argv for $* and $@ since it will affect ps output. This can happen when command line options are specified, e.g. "sh -c command". Based on a diff from espie@ OK espie@
|
#
1.49 |
|
05-Sep-2012 |
espie |
backout, Todd's version may be cleaner, but it's also wrong.
|
#
1.48 |
|
05-Sep-2012 |
espie |
sh -c should not munge argv[]. This fixes ps -ww output.
joint work by millert@ and me@.
okay otto@, deraadt@ "feel free to commit my version" millert@
|
Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.47 |
|
07-Sep-2011 |
otto |
beter determination if the shell is restricted; from Alf Schlichting. ok jasper@ millert@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
|
#
1.46 |
|
19-May-2010 |
jasper |
properly keep track of the line number after a trap. this fixes pr 6195. diff from manuel giraud, thanks.
ok kili@
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
|
#
1.45 |
|
29-Jan-2009 |
jaredy |
pass "xerrok" status across the execution call stack to more closely match what both POSIX and ksh.1 already describe in regards to set -e/errexit's behavior in determining when to exit from nonzero return values.
specifically, the truth values tested as operands to `&&' and `||', as well as the resulting compound expression itself, along with the truth value resulting from a negated command (i.e. a pipeline prefixed `!'), should not make the shell exit when -e is in effect.
issue reported by matthieu. testing matthieu, naddy. ok miod (earlier version), otto. man page ok jmc.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.44 |
|
05-Jul-2008 |
djm |
ksh starting as root will refuse to import a PS1 prompt unless it contains a '#' character. Make it also accept the \$ PS1 sequence (which is supposed to automagically be $ or # depending on the user running the shell) unless ksh has been started in sh-compatibility mode.
pointed out by millert@ when I asked why my SUDO_PS1 was not being honoured; ok millert@
|
Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
|
#
1.43 |
|
31-May-2007 |
otto |
Only process ENV when in interactive mode as SU says. Started by tedu to fix make -j, SU thing spotted by naddy@; ok millert@ @tedu jmc@ for the man page bit.
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.42 |
|
02-Nov-2006 |
ray |
Only check if last three letters are "/sh" if string is at least three characters long.
OK moritz@.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.41 |
|
10-Apr-2006 |
jaredy |
fix lint comments, no functional changes; ok ray
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.40 |
|
11-Dec-2005 |
otto |
fix a few name clashes with libc; found by lint. ok deraadt@
|
#
1.39 |
|
11-Dec-2005 |
deraadt |
remove unused variables and functions
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.38 |
|
30-Mar-2005 |
deraadt |
lots of indentation cleanup, now ksh is readable like our other code. double checked to make sure no binaries change, and eyed by niallo
|
#
1.37 |
|
28-Mar-2005 |
deraadt |
if argv[0] not set, do not set it to "pdksh", but to "ksh"
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
21-Feb-2005 |
otto |
Set \u in prompt expansion to the right value, while avoiding getpw* calls, which might be very inconvenient when the yp server is not available.
ok deraadt@ millert@
|
#
1.35 |
|
22-Dec-2004 |
otto |
Fix a use-after-free, that causs core dumps if a shell is killed running with strict malloc.conf options. Problem spotted by hshoexer@; fix by me with some help from millert@.
ok millert@ hshoexer@ krw@ deraadt@
|
#
1.34 |
|
22-Dec-2004 |
millert |
Use stdbool.h instead of rolling our own bools.
|
#
1.33 |
|
20-Dec-2004 |
otto |
Ansification plus some minor knf. No binary change on i386 and sparc64, binary change in lex.o on macppc due to introduction of dopprompt() prototype. ok millert@
|
#
1.32 |
|
18-Dec-2004 |
millert |
deregister
|
#
1.31 |
|
18-Dec-2004 |
millert |
When invoked as sh set SH_VERSION, not KSH_VERSION like the man page says.
|
#
1.30 |
|
18-Dec-2004 |
millert |
Get rid of #ifdef KSH since we don't care about building a V7 style sh and the #ifdef KSH code is required to make a POSIX sh. From Matthias Kilian
|
#
1.29 |
|
18-Dec-2004 |
millert |
Remove unused OS dependent #ifdef blocks, #defines and macro abstraction. First step in making the ksh code easier to read. From Matthias Kilian
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.28 |
|
23-Aug-2004 |
millert |
Don't send SIGINT or SIGTERM to the entire processes group when the shell receives SIGINT/SIGTERM unless the shell is the process group leader. Fixes PR 3820. OK danh@ sturm@ miod@
|
#
1.27 |
|
07-Jun-2004 |
deraadt |
do not push ksh into stupid-random mode; leave it in arc4random() mode. oops. spotted by weerd@weirdnet.nl
|
Revision tags: OPENBSD_3_5_BASE
|
#
1.26 |
|
08-Jan-2004 |
jmc |
typo; from ray at cyth dot net (PR 3632);
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.25 |
|
26-Jun-2003 |
deraadt |
protos
|
#
1.24 |
|
04-Apr-2003 |
deraadt |
two fixes; help from tedu & tdeval
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.23 |
|
10-Mar-2003 |
david |
spelling fixes ok millert@
|
#
1.22 |
|
28-Feb-2003 |
jmc |
typos; from Brian Poole
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.21 |
|
09-Jun-2002 |
todd |
knf
|
Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE
|
#
1.20 |
|
19-Dec-2000 |
markus |
do not reset nonblock if shell is not interactive, from crossd@cs.rpi.edu (i should have commited this about 6 months ago, ok millert@).
|
Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
|
#
1.19 |
|
14-Nov-1999 |
millert |
Better fix for PR #921 (main.c rev 1.18) from the pdksh cvs tree.
|
#
1.18 |
|
14-Nov-1999 |
millert |
Fix a core dump caused by a signal race; yval@hackers.co.il
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.17 |
|
04-Aug-1999 |
millert |
Turn <tab> completion on by default for people used to bash, tcsh, etc...
|
#
1.16 |
|
15-Jul-1999 |
millert |
o Set default line edit mode to emacs (VISUAL/EDITOR or user can override) o Spell environment correctly
|
#
1.15 |
|
15-Jun-1999 |
millert |
patches from pdksh 5.2.13.11
|
#
1.14 |
|
27-Apr-1999 |
millert |
disable newgrp alias since OpenBSD doesn't have a newgrp(1)
|
Revision tags: OPENBSD_2_5_BASE
|
#
1.13 |
|
10-Jan-1999 |
millert |
sync with pdksh-unstable-5.2.13.6
|
#
1.12 |
|
08-Jan-1999 |
millert |
bug fixes from pdksh-unstable-5.2.13.5; some of which we already had.
|
#
1.11 |
|
29-Oct-1998 |
millert |
Bug fixes from pdksh-unstable-5.2.13.4, including "official" versions of some that we had already fixed locally. o typeset -f FUNC doesn't print follows command (and expression) substitutions. o when re-allocating memory, too much may be copied from old memory. o set -o printed some options sans names. o emacs mode: <esc>. in very fist command causes core dump. o pdksh dumps core after a cd command. o typeset -i reports on array elements that have no value (at&t ksh reports on array base name - no index). o ulimit -ctn unlimittttted kills shell (resource exceeded). o ". /dev/null" says access denied. o flag field in aliases incorrectly changed (all flags set instead of clearing ISSET) in exec.c(flushcom). o ${#array[*]} prints largest index instead of number of (set) elements in an array (ksh88 does the former). o sys_siglist[] doesn't always have NSIG non-null entries...
|
Revision tags: OPENBSD_2_4_BASE
|
#
1.10 |
|
25-Jun-1998 |
millert |
pdksh-5.2.13 + local changes
|
Revision tags: OPENBSD_2_3_BASE
|
#
1.9 |
|
12-Sep-1997 |
deraadt |
do not quitenv() too early, or "s" goes away due to it's temporary nature; fix found in freebsd ports tree.. original by ejc@bazzle.com
|
#
1.8 |
|
01-Sep-1997 |
deraadt |
i am bored enough to fix terminal space/tab uglies
|
#
1.7 |
|
19-Jun-1997 |
kstailey |
back out
|
#
1.6 |
|
18-Jun-1997 |
kstailey |
(foo *)0 -> NULL
|
#
1.5 |
|
02-Jan-1997 |
downsj |
Add FSH (set -o sh), initialize it if we're /bin/sh, and add the first use: don't set $_ if we're non-interactive.
|
#
1.4 |
|
21-Nov-1996 |
downsj |
Update to 5.2.12.
|
#
1.3 |
|
01-Oct-1996 |
downsj |
Integrate pdksh 5.2.9.
|
#
1.2 |
|
19-Aug-1996 |
downsj |
update to pdksh-5.2.8
|
#
1.1 |
|
14-Aug-1996 |
downsj |
branches: 1.1.1; Initial revision
|
#
1.95 |
|
17-Nov-2018 |
deraadt |
Use a very regular call pattern to pledge, so that we can continue to grep and compare the use in all programs..
|
#
1.94 |
|
16-Nov-2018 |
nicm |
Include "id" in pledge (for setres[ug]id, setgroups) if the shell is privileged and remove it when dropping privileges (set +p), setting a flag to make sure we don't do it again.
ok deraadt millert
|
Revision tags: OPENBSD_6_4_BASE
|
#
1.93 |
|
29-Sep-2018 |
millert |
Export the PWD and OLDPWD shell variables as per POSIX. Previously, these would only be exported if they were present in the environment when the shell started. OK deraadt@ anton@ kn@
|
#
1.92 |
|
18-May-2018 |
benno |
remove the alias type='whence -v' and replace it with 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@
|
#
1.91 |
|
09-Apr-2018 |
tobias |
Support 64 bit integers on 32 bit architectures.
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
|
Revision tags: OPENBSD_6_3_BASE
|
#
1.90 |
|
15-Mar-2018 |
anton |
Favor usage of __func__ in warning/error messages. Some of them referred to the wrong function and fix the rest for consistency. Diff from Michael W. Bombardieri with some cosmetic cleanup applied.
ok benno@ tb@
|
#
1.89 |
|
16-Jan-2018 |
jca |
Introduce internal_warningf() and mark internal_errorf() as noreturn
This helps tools like scan-build, and follows the example of warningf() and errorf(). ok anton@
|
#
1.88 |
|
15-Jan-2018 |
jca |
Stop pretending we support building ksh without EDIT/HISTORY support
ok anton@
|
#
1.87 |
|
14-Jan-2018 |
anton |
unifdef BRACE_EXPAND; ok jca@
|
#
1.86 |
|
05-Jan-2018 |
jca |
unifdef JOBS support
Prompted by a mail from Klemens Nanni, who also had the same diff. ok deraadt@ millert@
|
#
1.85 |
|
12-Dec-2017 |
tb |
Include hostname in shell prompts by default
With tmux, ssh and vmd, we tend to open shells on many different hosts simultaneously and the default prompts '$ ' and '# ' for {,k}sh as well as '% ' and '# ' for csh become dangerous: it's very easy to issue a command on the wrong host.
This can easily be avoided by displaying the hostname in the prompt. Everything beyond "hostname{$,#,%} " is going to be a matter of taste, so we left it at that. If you use an FQDN, only the first part (the output of 'hostname -s') will be printed.
requested by and ok deraadt; mostly positive feedback many ok anton, brynet, bcallah and others
|
#
1.84 |
|
07-Dec-2017 |
tb |
Drop the unused second argument from set_prompt(). It used to be used for early special casing of ! and !! in the PS1 expansion. This was removed from set_prompt() as part of the implementaion of the character count toggles \[ and \] back in 2004.
ok jca
|
Revision tags: OPENBSD_6_2_BASE
|
#
1.83 |
|
11-Aug-2017 |
guenther |
Retire old behavior of requiring root prompt to contain # or \!
Requested by akoshibe and phessler ok phessler@ anton@ jca@
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.82 |
|
17-Oct-2016 |
schwarze |
No need to inspect LC_CTYPE: * It was only used in vi input mode. * No functional change in case of set -o vi-show8. * No functional change if LC_CTYPE is set to UTF-8. * More robust for the default of LC_CTYPE=C on a UTF-8 xterm.
Behaviour changes for the combination LC_CTYPE=C with set +o vi-show8 on non-UTF-8 terminals, but that combination is useless and dangerous with or without this patch. If you want to edit individual raw non-ASCII non-UTF-8 bytes on the shell command line, always use set -o vi-show8. (Besides, i doubt that you actually want to do that; better use a real hex editor in the first place.)
OK czarkoff@.
|
#
1.81 |
|
11-Oct-2016 |
schwarze |
Partial UTF-8 line editing support for ksh(1) vi input mode; so far, it covers these commands: a h i l x / This is an isu8cont()-based hack similar in style to what i did in emacs input mode, but less elegant and slightly more intrusive because the vi mode code is much more ugly and less straightforward than the emacs mode code. This one required partial rewrites of a few helper functions, and comments were added while there.
This is not perfect, but hopefully reduces people's cursing until a more rigorous solution can be devised (much) later. Some polishing may be useful in tree, in particular adding utf8cont() support to a few missing commands.
Mostly written shortly after Christmas 2015. Reminded by and OK czarkoff@. Feedback, partial review and testing, no longer any objection by martijn@. Feedback and testing by tb@. Also read fine to nicm@.
|
#
1.80 |
|
08-Sep-2016 |
millert |
Mark PPID read-only as per the manual. From Anthony Coulter.
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.79 |
|
04-Mar-2016 |
deraadt |
remove CSRG BSD-licensed mknod builtin code which was previously used to accelerate install/upgrade time MAKEDEV runs. That allows ramdisk ksh to be pledged, without needing "dpath". We'll solve the performance issues a different way (soon). ok otto espie natano tb tobiasu rpe
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.78 |
|
30-Dec-2015 |
tedu |
rename global "e" to genv to avoid accidental shadowing and aliasing. ok millert nicm tb
|
#
1.77 |
|
27-Dec-2015 |
jca |
Tweak comment: we now always make a copy of argv.
ok halex@
|
#
1.76 |
|
27-Dec-2015 |
halex |
unconditionally duplicate the argv array on initialization, to make it resilient against being altered by a subsequent shift operation
tweak and ok semarie@
|
#
1.75 |
|
14-Dec-2015 |
tb |
Move system headers from sh.h to those files that actually need them.
ok mmcc@ a while ago
|
#
1.74 |
|
11-Nov-2015 |
deraadt |
exit() after perror() for pledge failure. Perhaps this got introduced as a test idiom, either when pledge was young or during the transition to strings.... dunno
|
#
1.73 |
|
01-Nov-2015 |
mmcc |
Add uses of areallocarray(). mksh and Bitrig ksh already have similar functions. With help from Theo Buehler.
ok nicm@
|
#
1.72 |
|
30-Oct-2015 |
guenther |
'fc -e -' is deprecated in favor of 'fc -s', so update the built-in alias
ok millert@
|
#
1.71 |
|
22-Oct-2015 |
mmcc |
Final removal of EXTERN.
ok nicm@
|
#
1.70 |
|
21-Oct-2015 |
mmcc |
Penultimate commit to remove EXTERN.
ok nicm@
|
#
1.69 |
|
19-Oct-2015 |
mmcc |
Move string.h include from sh.h to the files that use it.
ok nicm@
|
#
1.68 |
|
19-Oct-2015 |
mmcc |
More removal of EXTERN.
ok nicm@
|
#
1.67 |
|
19-Oct-2015 |
mmcc |
Apply style(9) to header includes.
ok nicm@
|
#
1.66 |
|
18-Oct-2015 |
mmcc |
Move more EXTERN-defined globals from sh.h.
ok nicm@
|
#
1.65 |
|
17-Oct-2015 |
mmcc |
Move a system header include from the global header (sh.h) into the files that need it. No binary change.
"This looks fine" -nicm@
|
#
1.64 |
|
16-Oct-2015 |
deraadt |
wrap a long line
|
#
1.63 |
|
16-Oct-2015 |
millert |
Implement real "flock" request and add it to userland programs that use pledge and file locking. OK deraadt@
|
#
1.62 |
|
10-Oct-2015 |
deraadt |
normalize a few more tame request orderings, to help review
|
#
1.61 |
|
10-Oct-2015 |
deraadt |
ksh can run with pledge "stdio rpath wpath cpath getpw fattr proc exec tty" if the mknod builtin is disabled. It looks like a lot of abilities, but hey, this is a shell. can't open sockets or do other nasty stuff though. (we'll leave the mknod builtin enabled on the install media for now; there is work happening to regain the MAKEDEV performance in a different way) discussions with otto & millert in particular
|
#
1.60 |
|
18-Sep-2015 |
nicm |
Last of the (thing *)0 -> NULL, from Michael McConville. No binary change.
|
#
1.59 |
|
17-Sep-2015 |
nicm |
Remove unnecessary casts, from Michael McConville. No binary change.
|
#
1.58 |
|
15-Sep-2015 |
tedu |
correct spelling of NULL from (char *)0. from Michael McConville. ok md5
|
#
1.57 |
|
10-Sep-2015 |
nicm |
Replace newline and space defines by "\n" and " " directly, from Michael McConville. ok millert
|
#
1.56 |
|
01-Sep-2015 |
tedu |
no need to check for null argv anymore. from Martijn van Duren ok deraadt
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.55 |
|
09-Feb-2015 |
jsg |
If we hit multiple errors while unwinding we'll end up running code that assumes a pointer is valid when it has been free'd.
This is convoluted as ksh has it's own allocator and uses long jumps. Set the pointer to NULL after the quitenv() call in unwind() in case we later hit a long jump in unwind().
Found with afl a while back.
ok tedu@ deraadt@
|
Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
|
#
1.54 |
|
28-Nov-2013 |
sobrado |
remove trailing whitespaces; use tabs instead of spaces where appropriate; no binary changes.
|
#
1.53 |
|
04-Sep-2013 |
millert |
Add a proper suspend builtin that saves/restores the tty and pgrp as needed instead of an alias that just sends SIGSTOP. Login shells may be suspended if they are not running in an orphan process group. OK guenther@ jmc@
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.52 |
|
15-Jun-2013 |
millert |
Run any pending traps before calling the EXIT or ERR traps when -e is set. Fixes a bug where we would not run the signal trap if, for example, ^C was pressed and -e was set. OK espie@
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.51 |
|
10-Sep-2012 |
tedu |
fake a sigwinch after each job, so if the terminal changes size, we'll notice and update
|
#
1.50 |
|
06-Sep-2012 |
millert |
Avoid modifying argv when building argv for $* and $@ since it will affect ps output. This can happen when command line options are specified, e.g. "sh -c command". Based on a diff from espie@ OK espie@
|
#
1.49 |
|
05-Sep-2012 |
espie |
backout, Todd's version may be cleaner, but it's also wrong.
|
#
1.48 |
|
05-Sep-2012 |
espie |
sh -c should not munge argv[]. This fixes ps -ww output.
joint work by millert@ and me@.
okay otto@, deraadt@ "feel free to commit my version" millert@
|
Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.47 |
|
07-Sep-2011 |
otto |
beter determination if the shell is restricted; from Alf Schlichting. ok jasper@ millert@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
|
#
1.46 |
|
19-May-2010 |
jasper |
properly keep track of the line number after a trap. this fixes pr 6195. diff from manuel giraud, thanks.
ok kili@
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
|
#
1.45 |
|
29-Jan-2009 |
jaredy |
pass "xerrok" status across the execution call stack to more closely match what both POSIX and ksh.1 already describe in regards to set -e/errexit's behavior in determining when to exit from nonzero return values.
specifically, the truth values tested as operands to `&&' and `||', as well as the resulting compound expression itself, along with the truth value resulting from a negated command (i.e. a pipeline prefixed `!'), should not make the shell exit when -e is in effect.
issue reported by matthieu. testing matthieu, naddy. ok miod (earlier version), otto. man page ok jmc.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.44 |
|
05-Jul-2008 |
djm |
ksh starting as root will refuse to import a PS1 prompt unless it contains a '#' character. Make it also accept the \$ PS1 sequence (which is supposed to automagically be $ or # depending on the user running the shell) unless ksh has been started in sh-compatibility mode.
pointed out by millert@ when I asked why my SUDO_PS1 was not being honoured; ok millert@
|
Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
|
#
1.43 |
|
31-May-2007 |
otto |
Only process ENV when in interactive mode as SU says. Started by tedu to fix make -j, SU thing spotted by naddy@; ok millert@ @tedu jmc@ for the man page bit.
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.42 |
|
02-Nov-2006 |
ray |
Only check if last three letters are "/sh" if string is at least three characters long.
OK moritz@.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.41 |
|
10-Apr-2006 |
jaredy |
fix lint comments, no functional changes; ok ray
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.40 |
|
11-Dec-2005 |
otto |
fix a few name clashes with libc; found by lint. ok deraadt@
|
#
1.39 |
|
11-Dec-2005 |
deraadt |
remove unused variables and functions
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.38 |
|
30-Mar-2005 |
deraadt |
lots of indentation cleanup, now ksh is readable like our other code. double checked to make sure no binaries change, and eyed by niallo
|
#
1.37 |
|
28-Mar-2005 |
deraadt |
if argv[0] not set, do not set it to "pdksh", but to "ksh"
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
21-Feb-2005 |
otto |
Set \u in prompt expansion to the right value, while avoiding getpw* calls, which might be very inconvenient when the yp server is not available.
ok deraadt@ millert@
|
#
1.35 |
|
22-Dec-2004 |
otto |
Fix a use-after-free, that causs core dumps if a shell is killed running with strict malloc.conf options. Problem spotted by hshoexer@; fix by me with some help from millert@.
ok millert@ hshoexer@ krw@ deraadt@
|
#
1.34 |
|
22-Dec-2004 |
millert |
Use stdbool.h instead of rolling our own bools.
|
#
1.33 |
|
20-Dec-2004 |
otto |
Ansification plus some minor knf. No binary change on i386 and sparc64, binary change in lex.o on macppc due to introduction of dopprompt() prototype. ok millert@
|
#
1.32 |
|
18-Dec-2004 |
millert |
deregister
|
#
1.31 |
|
18-Dec-2004 |
millert |
When invoked as sh set SH_VERSION, not KSH_VERSION like the man page says.
|
#
1.30 |
|
18-Dec-2004 |
millert |
Get rid of #ifdef KSH since we don't care about building a V7 style sh and the #ifdef KSH code is required to make a POSIX sh. From Matthias Kilian
|
#
1.29 |
|
18-Dec-2004 |
millert |
Remove unused OS dependent #ifdef blocks, #defines and macro abstraction. First step in making the ksh code easier to read. From Matthias Kilian
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.28 |
|
23-Aug-2004 |
millert |
Don't send SIGINT or SIGTERM to the entire processes group when the shell receives SIGINT/SIGTERM unless the shell is the process group leader. Fixes PR 3820. OK danh@ sturm@ miod@
|
#
1.27 |
|
07-Jun-2004 |
deraadt |
do not push ksh into stupid-random mode; leave it in arc4random() mode. oops. spotted by weerd@weirdnet.nl
|
Revision tags: OPENBSD_3_5_BASE
|
#
1.26 |
|
08-Jan-2004 |
jmc |
typo; from ray at cyth dot net (PR 3632);
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.25 |
|
26-Jun-2003 |
deraadt |
protos
|
#
1.24 |
|
04-Apr-2003 |
deraadt |
two fixes; help from tedu & tdeval
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.23 |
|
10-Mar-2003 |
david |
spelling fixes ok millert@
|
#
1.22 |
|
28-Feb-2003 |
jmc |
typos; from Brian Poole
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.21 |
|
09-Jun-2002 |
todd |
knf
|
Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE
|
#
1.20 |
|
19-Dec-2000 |
markus |
do not reset nonblock if shell is not interactive, from crossd@cs.rpi.edu (i should have commited this about 6 months ago, ok millert@).
|
Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
|
#
1.19 |
|
14-Nov-1999 |
millert |
Better fix for PR #921 (main.c rev 1.18) from the pdksh cvs tree.
|
#
1.18 |
|
14-Nov-1999 |
millert |
Fix a core dump caused by a signal race; yval@hackers.co.il
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.17 |
|
04-Aug-1999 |
millert |
Turn <tab> completion on by default for people used to bash, tcsh, etc...
|
#
1.16 |
|
15-Jul-1999 |
millert |
o Set default line edit mode to emacs (VISUAL/EDITOR or user can override) o Spell environment correctly
|
#
1.15 |
|
15-Jun-1999 |
millert |
patches from pdksh 5.2.13.11
|
#
1.14 |
|
27-Apr-1999 |
millert |
disable newgrp alias since OpenBSD doesn't have a newgrp(1)
|
Revision tags: OPENBSD_2_5_BASE
|
#
1.13 |
|
10-Jan-1999 |
millert |
sync with pdksh-unstable-5.2.13.6
|
#
1.12 |
|
08-Jan-1999 |
millert |
bug fixes from pdksh-unstable-5.2.13.5; some of which we already had.
|
#
1.11 |
|
29-Oct-1998 |
millert |
Bug fixes from pdksh-unstable-5.2.13.4, including "official" versions of some that we had already fixed locally. o typeset -f FUNC doesn't print follows command (and expression) substitutions. o when re-allocating memory, too much may be copied from old memory. o set -o printed some options sans names. o emacs mode: <esc>. in very fist command causes core dump. o pdksh dumps core after a cd command. o typeset -i reports on array elements that have no value (at&t ksh reports on array base name - no index). o ulimit -ctn unlimittttted kills shell (resource exceeded). o ". /dev/null" says access denied. o flag field in aliases incorrectly changed (all flags set instead of clearing ISSET) in exec.c(flushcom). o ${#array[*]} prints largest index instead of number of (set) elements in an array (ksh88 does the former). o sys_siglist[] doesn't always have NSIG non-null entries...
|
Revision tags: OPENBSD_2_4_BASE
|
#
1.10 |
|
25-Jun-1998 |
millert |
pdksh-5.2.13 + local changes
|
Revision tags: OPENBSD_2_3_BASE
|
#
1.9 |
|
12-Sep-1997 |
deraadt |
do not quitenv() too early, or "s" goes away due to it's temporary nature; fix found in freebsd ports tree.. original by ejc@bazzle.com
|
#
1.8 |
|
01-Sep-1997 |
deraadt |
i am bored enough to fix terminal space/tab uglies
|
#
1.7 |
|
19-Jun-1997 |
kstailey |
back out
|
#
1.6 |
|
18-Jun-1997 |
kstailey |
(foo *)0 -> NULL
|
#
1.5 |
|
02-Jan-1997 |
downsj |
Add FSH (set -o sh), initialize it if we're /bin/sh, and add the first use: don't set $_ if we're non-interactive.
|
#
1.4 |
|
21-Nov-1996 |
downsj |
Update to 5.2.12.
|
#
1.3 |
|
01-Oct-1996 |
downsj |
Integrate pdksh 5.2.9.
|
#
1.2 |
|
19-Aug-1996 |
downsj |
update to pdksh-5.2.8
|
#
1.1 |
|
14-Aug-1996 |
downsj |
branches: 1.1.1; Initial revision
|
#
1.94 |
|
16-Nov-2018 |
nicm |
Include "id" in pledge (for setres[ug]id, setgroups) if the shell is privileged and remove it when dropping privileges (set +p), setting a flag to make sure we don't do it again.
ok deraadt millert
|
Revision tags: OPENBSD_6_4_BASE
|
#
1.93 |
|
29-Sep-2018 |
millert |
Export the PWD and OLDPWD shell variables as per POSIX. Previously, these would only be exported if they were present in the environment when the shell started. OK deraadt@ anton@ kn@
|
#
1.92 |
|
18-May-2018 |
benno |
remove the alias type='whence -v' and replace it with 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@
|
#
1.91 |
|
09-Apr-2018 |
tobias |
Support 64 bit integers on 32 bit architectures.
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
|
Revision tags: OPENBSD_6_3_BASE
|
#
1.90 |
|
15-Mar-2018 |
anton |
Favor usage of __func__ in warning/error messages. Some of them referred to the wrong function and fix the rest for consistency. Diff from Michael W. Bombardieri with some cosmetic cleanup applied.
ok benno@ tb@
|
#
1.89 |
|
16-Jan-2018 |
jca |
Introduce internal_warningf() and mark internal_errorf() as noreturn
This helps tools like scan-build, and follows the example of warningf() and errorf(). ok anton@
|
#
1.88 |
|
15-Jan-2018 |
jca |
Stop pretending we support building ksh without EDIT/HISTORY support
ok anton@
|
#
1.87 |
|
14-Jan-2018 |
anton |
unifdef BRACE_EXPAND; ok jca@
|
#
1.86 |
|
05-Jan-2018 |
jca |
unifdef JOBS support
Prompted by a mail from Klemens Nanni, who also had the same diff. ok deraadt@ millert@
|
#
1.85 |
|
12-Dec-2017 |
tb |
Include hostname in shell prompts by default
With tmux, ssh and vmd, we tend to open shells on many different hosts simultaneously and the default prompts '$ ' and '# ' for {,k}sh as well as '% ' and '# ' for csh become dangerous: it's very easy to issue a command on the wrong host.
This can easily be avoided by displaying the hostname in the prompt. Everything beyond "hostname{$,#,%} " is going to be a matter of taste, so we left it at that. If you use an FQDN, only the first part (the output of 'hostname -s') will be printed.
requested by and ok deraadt; mostly positive feedback many ok anton, brynet, bcallah and others
|
#
1.84 |
|
07-Dec-2017 |
tb |
Drop the unused second argument from set_prompt(). It used to be used for early special casing of ! and !! in the PS1 expansion. This was removed from set_prompt() as part of the implementaion of the character count toggles \[ and \] back in 2004.
ok jca
|
Revision tags: OPENBSD_6_2_BASE
|
#
1.83 |
|
11-Aug-2017 |
guenther |
Retire old behavior of requiring root prompt to contain # or \!
Requested by akoshibe and phessler ok phessler@ anton@ jca@
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.82 |
|
17-Oct-2016 |
schwarze |
No need to inspect LC_CTYPE: * It was only used in vi input mode. * No functional change in case of set -o vi-show8. * No functional change if LC_CTYPE is set to UTF-8. * More robust for the default of LC_CTYPE=C on a UTF-8 xterm.
Behaviour changes for the combination LC_CTYPE=C with set +o vi-show8 on non-UTF-8 terminals, but that combination is useless and dangerous with or without this patch. If you want to edit individual raw non-ASCII non-UTF-8 bytes on the shell command line, always use set -o vi-show8. (Besides, i doubt that you actually want to do that; better use a real hex editor in the first place.)
OK czarkoff@.
|
#
1.81 |
|
11-Oct-2016 |
schwarze |
Partial UTF-8 line editing support for ksh(1) vi input mode; so far, it covers these commands: a h i l x / This is an isu8cont()-based hack similar in style to what i did in emacs input mode, but less elegant and slightly more intrusive because the vi mode code is much more ugly and less straightforward than the emacs mode code. This one required partial rewrites of a few helper functions, and comments were added while there.
This is not perfect, but hopefully reduces people's cursing until a more rigorous solution can be devised (much) later. Some polishing may be useful in tree, in particular adding utf8cont() support to a few missing commands.
Mostly written shortly after Christmas 2015. Reminded by and OK czarkoff@. Feedback, partial review and testing, no longer any objection by martijn@. Feedback and testing by tb@. Also read fine to nicm@.
|
#
1.80 |
|
08-Sep-2016 |
millert |
Mark PPID read-only as per the manual. From Anthony Coulter.
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.79 |
|
04-Mar-2016 |
deraadt |
remove CSRG BSD-licensed mknod builtin code which was previously used to accelerate install/upgrade time MAKEDEV runs. That allows ramdisk ksh to be pledged, without needing "dpath". We'll solve the performance issues a different way (soon). ok otto espie natano tb tobiasu rpe
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.78 |
|
30-Dec-2015 |
tedu |
rename global "e" to genv to avoid accidental shadowing and aliasing. ok millert nicm tb
|
#
1.77 |
|
27-Dec-2015 |
jca |
Tweak comment: we now always make a copy of argv.
ok halex@
|
#
1.76 |
|
27-Dec-2015 |
halex |
unconditionally duplicate the argv array on initialization, to make it resilient against being altered by a subsequent shift operation
tweak and ok semarie@
|
#
1.75 |
|
14-Dec-2015 |
tb |
Move system headers from sh.h to those files that actually need them.
ok mmcc@ a while ago
|
#
1.74 |
|
11-Nov-2015 |
deraadt |
exit() after perror() for pledge failure. Perhaps this got introduced as a test idiom, either when pledge was young or during the transition to strings.... dunno
|
#
1.73 |
|
01-Nov-2015 |
mmcc |
Add uses of areallocarray(). mksh and Bitrig ksh already have similar functions. With help from Theo Buehler.
ok nicm@
|
#
1.72 |
|
30-Oct-2015 |
guenther |
'fc -e -' is deprecated in favor of 'fc -s', so update the built-in alias
ok millert@
|
#
1.71 |
|
22-Oct-2015 |
mmcc |
Final removal of EXTERN.
ok nicm@
|
#
1.70 |
|
21-Oct-2015 |
mmcc |
Penultimate commit to remove EXTERN.
ok nicm@
|
#
1.69 |
|
19-Oct-2015 |
mmcc |
Move string.h include from sh.h to the files that use it.
ok nicm@
|
#
1.68 |
|
19-Oct-2015 |
mmcc |
More removal of EXTERN.
ok nicm@
|
#
1.67 |
|
19-Oct-2015 |
mmcc |
Apply style(9) to header includes.
ok nicm@
|
#
1.66 |
|
18-Oct-2015 |
mmcc |
Move more EXTERN-defined globals from sh.h.
ok nicm@
|
#
1.65 |
|
17-Oct-2015 |
mmcc |
Move a system header include from the global header (sh.h) into the files that need it. No binary change.
"This looks fine" -nicm@
|
#
1.64 |
|
16-Oct-2015 |
deraadt |
wrap a long line
|
#
1.63 |
|
16-Oct-2015 |
millert |
Implement real "flock" request and add it to userland programs that use pledge and file locking. OK deraadt@
|
#
1.62 |
|
10-Oct-2015 |
deraadt |
normalize a few more tame request orderings, to help review
|
#
1.61 |
|
10-Oct-2015 |
deraadt |
ksh can run with pledge "stdio rpath wpath cpath getpw fattr proc exec tty" if the mknod builtin is disabled. It looks like a lot of abilities, but hey, this is a shell. can't open sockets or do other nasty stuff though. (we'll leave the mknod builtin enabled on the install media for now; there is work happening to regain the MAKEDEV performance in a different way) discussions with otto & millert in particular
|
#
1.60 |
|
18-Sep-2015 |
nicm |
Last of the (thing *)0 -> NULL, from Michael McConville. No binary change.
|
#
1.59 |
|
17-Sep-2015 |
nicm |
Remove unnecessary casts, from Michael McConville. No binary change.
|
#
1.58 |
|
15-Sep-2015 |
tedu |
correct spelling of NULL from (char *)0. from Michael McConville. ok md5
|
#
1.57 |
|
10-Sep-2015 |
nicm |
Replace newline and space defines by "\n" and " " directly, from Michael McConville. ok millert
|
#
1.56 |
|
01-Sep-2015 |
tedu |
no need to check for null argv anymore. from Martijn van Duren ok deraadt
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.55 |
|
09-Feb-2015 |
jsg |
If we hit multiple errors while unwinding we'll end up running code that assumes a pointer is valid when it has been free'd.
This is convoluted as ksh has it's own allocator and uses long jumps. Set the pointer to NULL after the quitenv() call in unwind() in case we later hit a long jump in unwind().
Found with afl a while back.
ok tedu@ deraadt@
|
Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
|
#
1.54 |
|
28-Nov-2013 |
sobrado |
remove trailing whitespaces; use tabs instead of spaces where appropriate; no binary changes.
|
#
1.53 |
|
04-Sep-2013 |
millert |
Add a proper suspend builtin that saves/restores the tty and pgrp as needed instead of an alias that just sends SIGSTOP. Login shells may be suspended if they are not running in an orphan process group. OK guenther@ jmc@
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.52 |
|
15-Jun-2013 |
millert |
Run any pending traps before calling the EXIT or ERR traps when -e is set. Fixes a bug where we would not run the signal trap if, for example, ^C was pressed and -e was set. OK espie@
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.51 |
|
10-Sep-2012 |
tedu |
fake a sigwinch after each job, so if the terminal changes size, we'll notice and update
|
#
1.50 |
|
06-Sep-2012 |
millert |
Avoid modifying argv when building argv for $* and $@ since it will affect ps output. This can happen when command line options are specified, e.g. "sh -c command". Based on a diff from espie@ OK espie@
|
#
1.49 |
|
05-Sep-2012 |
espie |
backout, Todd's version may be cleaner, but it's also wrong.
|
#
1.48 |
|
05-Sep-2012 |
espie |
sh -c should not munge argv[]. This fixes ps -ww output.
joint work by millert@ and me@.
okay otto@, deraadt@ "feel free to commit my version" millert@
|
Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.47 |
|
07-Sep-2011 |
otto |
beter determination if the shell is restricted; from Alf Schlichting. ok jasper@ millert@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
|
#
1.46 |
|
19-May-2010 |
jasper |
properly keep track of the line number after a trap. this fixes pr 6195. diff from manuel giraud, thanks.
ok kili@
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
|
#
1.45 |
|
29-Jan-2009 |
jaredy |
pass "xerrok" status across the execution call stack to more closely match what both POSIX and ksh.1 already describe in regards to set -e/errexit's behavior in determining when to exit from nonzero return values.
specifically, the truth values tested as operands to `&&' and `||', as well as the resulting compound expression itself, along with the truth value resulting from a negated command (i.e. a pipeline prefixed `!'), should not make the shell exit when -e is in effect.
issue reported by matthieu. testing matthieu, naddy. ok miod (earlier version), otto. man page ok jmc.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.44 |
|
05-Jul-2008 |
djm |
ksh starting as root will refuse to import a PS1 prompt unless it contains a '#' character. Make it also accept the \$ PS1 sequence (which is supposed to automagically be $ or # depending on the user running the shell) unless ksh has been started in sh-compatibility mode.
pointed out by millert@ when I asked why my SUDO_PS1 was not being honoured; ok millert@
|
Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
|
#
1.43 |
|
31-May-2007 |
otto |
Only process ENV when in interactive mode as SU says. Started by tedu to fix make -j, SU thing spotted by naddy@; ok millert@ @tedu jmc@ for the man page bit.
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.42 |
|
02-Nov-2006 |
ray |
Only check if last three letters are "/sh" if string is at least three characters long.
OK moritz@.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.41 |
|
10-Apr-2006 |
jaredy |
fix lint comments, no functional changes; ok ray
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.40 |
|
11-Dec-2005 |
otto |
fix a few name clashes with libc; found by lint. ok deraadt@
|
#
1.39 |
|
11-Dec-2005 |
deraadt |
remove unused variables and functions
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.38 |
|
30-Mar-2005 |
deraadt |
lots of indentation cleanup, now ksh is readable like our other code. double checked to make sure no binaries change, and eyed by niallo
|
#
1.37 |
|
28-Mar-2005 |
deraadt |
if argv[0] not set, do not set it to "pdksh", but to "ksh"
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
21-Feb-2005 |
otto |
Set \u in prompt expansion to the right value, while avoiding getpw* calls, which might be very inconvenient when the yp server is not available.
ok deraadt@ millert@
|
#
1.35 |
|
22-Dec-2004 |
otto |
Fix a use-after-free, that causs core dumps if a shell is killed running with strict malloc.conf options. Problem spotted by hshoexer@; fix by me with some help from millert@.
ok millert@ hshoexer@ krw@ deraadt@
|
#
1.34 |
|
22-Dec-2004 |
millert |
Use stdbool.h instead of rolling our own bools.
|
#
1.33 |
|
20-Dec-2004 |
otto |
Ansification plus some minor knf. No binary change on i386 and sparc64, binary change in lex.o on macppc due to introduction of dopprompt() prototype. ok millert@
|
#
1.32 |
|
18-Dec-2004 |
millert |
deregister
|
#
1.31 |
|
18-Dec-2004 |
millert |
When invoked as sh set SH_VERSION, not KSH_VERSION like the man page says.
|
#
1.30 |
|
18-Dec-2004 |
millert |
Get rid of #ifdef KSH since we don't care about building a V7 style sh and the #ifdef KSH code is required to make a POSIX sh. From Matthias Kilian
|
#
1.29 |
|
18-Dec-2004 |
millert |
Remove unused OS dependent #ifdef blocks, #defines and macro abstraction. First step in making the ksh code easier to read. From Matthias Kilian
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.28 |
|
23-Aug-2004 |
millert |
Don't send SIGINT or SIGTERM to the entire processes group when the shell receives SIGINT/SIGTERM unless the shell is the process group leader. Fixes PR 3820. OK danh@ sturm@ miod@
|
#
1.27 |
|
07-Jun-2004 |
deraadt |
do not push ksh into stupid-random mode; leave it in arc4random() mode. oops. spotted by weerd@weirdnet.nl
|
Revision tags: OPENBSD_3_5_BASE
|
#
1.26 |
|
08-Jan-2004 |
jmc |
typo; from ray at cyth dot net (PR 3632);
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.25 |
|
26-Jun-2003 |
deraadt |
protos
|
#
1.24 |
|
04-Apr-2003 |
deraadt |
two fixes; help from tedu & tdeval
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.23 |
|
10-Mar-2003 |
david |
spelling fixes ok millert@
|
#
1.22 |
|
28-Feb-2003 |
jmc |
typos; from Brian Poole
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.21 |
|
09-Jun-2002 |
todd |
knf
|
Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE
|
#
1.20 |
|
19-Dec-2000 |
markus |
do not reset nonblock if shell is not interactive, from crossd@cs.rpi.edu (i should have commited this about 6 months ago, ok millert@).
|
Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
|
#
1.19 |
|
14-Nov-1999 |
millert |
Better fix for PR #921 (main.c rev 1.18) from the pdksh cvs tree.
|
#
1.18 |
|
14-Nov-1999 |
millert |
Fix a core dump caused by a signal race; yval@hackers.co.il
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.17 |
|
04-Aug-1999 |
millert |
Turn <tab> completion on by default for people used to bash, tcsh, etc...
|
#
1.16 |
|
15-Jul-1999 |
millert |
o Set default line edit mode to emacs (VISUAL/EDITOR or user can override) o Spell environment correctly
|
#
1.15 |
|
15-Jun-1999 |
millert |
patches from pdksh 5.2.13.11
|
#
1.14 |
|
27-Apr-1999 |
millert |
disable newgrp alias since OpenBSD doesn't have a newgrp(1)
|
Revision tags: OPENBSD_2_5_BASE
|
#
1.13 |
|
10-Jan-1999 |
millert |
sync with pdksh-unstable-5.2.13.6
|
#
1.12 |
|
08-Jan-1999 |
millert |
bug fixes from pdksh-unstable-5.2.13.5; some of which we already had.
|
#
1.11 |
|
29-Oct-1998 |
millert |
Bug fixes from pdksh-unstable-5.2.13.4, including "official" versions of some that we had already fixed locally. o typeset -f FUNC doesn't print follows command (and expression) substitutions. o when re-allocating memory, too much may be copied from old memory. o set -o printed some options sans names. o emacs mode: <esc>. in very fist command causes core dump. o pdksh dumps core after a cd command. o typeset -i reports on array elements that have no value (at&t ksh reports on array base name - no index). o ulimit -ctn unlimittttted kills shell (resource exceeded). o ". /dev/null" says access denied. o flag field in aliases incorrectly changed (all flags set instead of clearing ISSET) in exec.c(flushcom). o ${#array[*]} prints largest index instead of number of (set) elements in an array (ksh88 does the former). o sys_siglist[] doesn't always have NSIG non-null entries...
|
Revision tags: OPENBSD_2_4_BASE
|
#
1.10 |
|
25-Jun-1998 |
millert |
pdksh-5.2.13 + local changes
|
Revision tags: OPENBSD_2_3_BASE
|
#
1.9 |
|
12-Sep-1997 |
deraadt |
do not quitenv() too early, or "s" goes away due to it's temporary nature; fix found in freebsd ports tree.. original by ejc@bazzle.com
|
#
1.8 |
|
01-Sep-1997 |
deraadt |
i am bored enough to fix terminal space/tab uglies
|
#
1.7 |
|
19-Jun-1997 |
kstailey |
back out
|
#
1.6 |
|
18-Jun-1997 |
kstailey |
(foo *)0 -> NULL
|
#
1.5 |
|
02-Jan-1997 |
downsj |
Add FSH (set -o sh), initialize it if we're /bin/sh, and add the first use: don't set $_ if we're non-interactive.
|
#
1.4 |
|
21-Nov-1996 |
downsj |
Update to 5.2.12.
|
#
1.3 |
|
01-Oct-1996 |
downsj |
Integrate pdksh 5.2.9.
|
#
1.2 |
|
19-Aug-1996 |
downsj |
update to pdksh-5.2.8
|
#
1.1 |
|
14-Aug-1996 |
downsj |
branches: 1.1.1; Initial revision
|
#
1.93 |
|
29-Sep-2018 |
millert |
Export the PWD and OLDPWD shell variables as per POSIX. Previously, these would only be exported if they were present in the environment when the shell started. OK deraadt@ anton@ kn@
|
#
1.92 |
|
18-May-2018 |
benno |
remove the alias type='whence -v' and replace it with 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@
|
#
1.91 |
|
09-Apr-2018 |
tobias |
Support 64 bit integers on 32 bit architectures.
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
|
Revision tags: OPENBSD_6_3_BASE
|
#
1.90 |
|
15-Mar-2018 |
anton |
Favor usage of __func__ in warning/error messages. Some of them referred to the wrong function and fix the rest for consistency. Diff from Michael W. Bombardieri with some cosmetic cleanup applied.
ok benno@ tb@
|
#
1.89 |
|
16-Jan-2018 |
jca |
Introduce internal_warningf() and mark internal_errorf() as noreturn
This helps tools like scan-build, and follows the example of warningf() and errorf(). ok anton@
|
#
1.88 |
|
15-Jan-2018 |
jca |
Stop pretending we support building ksh without EDIT/HISTORY support
ok anton@
|
#
1.87 |
|
14-Jan-2018 |
anton |
unifdef BRACE_EXPAND; ok jca@
|
#
1.86 |
|
05-Jan-2018 |
jca |
unifdef JOBS support
Prompted by a mail from Klemens Nanni, who also had the same diff. ok deraadt@ millert@
|
#
1.85 |
|
12-Dec-2017 |
tb |
Include hostname in shell prompts by default
With tmux, ssh and vmd, we tend to open shells on many different hosts simultaneously and the default prompts '$ ' and '# ' for {,k}sh as well as '% ' and '# ' for csh become dangerous: it's very easy to issue a command on the wrong host.
This can easily be avoided by displaying the hostname in the prompt. Everything beyond "hostname{$,#,%} " is going to be a matter of taste, so we left it at that. If you use an FQDN, only the first part (the output of 'hostname -s') will be printed.
requested by and ok deraadt; mostly positive feedback many ok anton, brynet, bcallah and others
|
#
1.84 |
|
07-Dec-2017 |
tb |
Drop the unused second argument from set_prompt(). It used to be used for early special casing of ! and !! in the PS1 expansion. This was removed from set_prompt() as part of the implementaion of the character count toggles \[ and \] back in 2004.
ok jca
|
Revision tags: OPENBSD_6_2_BASE
|
#
1.83 |
|
11-Aug-2017 |
guenther |
Retire old behavior of requiring root prompt to contain # or \!
Requested by akoshibe and phessler ok phessler@ anton@ jca@
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.82 |
|
17-Oct-2016 |
schwarze |
No need to inspect LC_CTYPE: * It was only used in vi input mode. * No functional change in case of set -o vi-show8. * No functional change if LC_CTYPE is set to UTF-8. * More robust for the default of LC_CTYPE=C on a UTF-8 xterm.
Behaviour changes for the combination LC_CTYPE=C with set +o vi-show8 on non-UTF-8 terminals, but that combination is useless and dangerous with or without this patch. If you want to edit individual raw non-ASCII non-UTF-8 bytes on the shell command line, always use set -o vi-show8. (Besides, i doubt that you actually want to do that; better use a real hex editor in the first place.)
OK czarkoff@.
|
#
1.81 |
|
11-Oct-2016 |
schwarze |
Partial UTF-8 line editing support for ksh(1) vi input mode; so far, it covers these commands: a h i l x / This is an isu8cont()-based hack similar in style to what i did in emacs input mode, but less elegant and slightly more intrusive because the vi mode code is much more ugly and less straightforward than the emacs mode code. This one required partial rewrites of a few helper functions, and comments were added while there.
This is not perfect, but hopefully reduces people's cursing until a more rigorous solution can be devised (much) later. Some polishing may be useful in tree, in particular adding utf8cont() support to a few missing commands.
Mostly written shortly after Christmas 2015. Reminded by and OK czarkoff@. Feedback, partial review and testing, no longer any objection by martijn@. Feedback and testing by tb@. Also read fine to nicm@.
|
#
1.80 |
|
08-Sep-2016 |
millert |
Mark PPID read-only as per the manual. From Anthony Coulter.
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.79 |
|
04-Mar-2016 |
deraadt |
remove CSRG BSD-licensed mknod builtin code which was previously used to accelerate install/upgrade time MAKEDEV runs. That allows ramdisk ksh to be pledged, without needing "dpath". We'll solve the performance issues a different way (soon). ok otto espie natano tb tobiasu rpe
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.78 |
|
30-Dec-2015 |
tedu |
rename global "e" to genv to avoid accidental shadowing and aliasing. ok millert nicm tb
|
#
1.77 |
|
27-Dec-2015 |
jca |
Tweak comment: we now always make a copy of argv.
ok halex@
|
#
1.76 |
|
27-Dec-2015 |
halex |
unconditionally duplicate the argv array on initialization, to make it resilient against being altered by a subsequent shift operation
tweak and ok semarie@
|
#
1.75 |
|
14-Dec-2015 |
tb |
Move system headers from sh.h to those files that actually need them.
ok mmcc@ a while ago
|
#
1.74 |
|
11-Nov-2015 |
deraadt |
exit() after perror() for pledge failure. Perhaps this got introduced as a test idiom, either when pledge was young or during the transition to strings.... dunno
|
#
1.73 |
|
01-Nov-2015 |
mmcc |
Add uses of areallocarray(). mksh and Bitrig ksh already have similar functions. With help from Theo Buehler.
ok nicm@
|
#
1.72 |
|
30-Oct-2015 |
guenther |
'fc -e -' is deprecated in favor of 'fc -s', so update the built-in alias
ok millert@
|
#
1.71 |
|
22-Oct-2015 |
mmcc |
Final removal of EXTERN.
ok nicm@
|
#
1.70 |
|
21-Oct-2015 |
mmcc |
Penultimate commit to remove EXTERN.
ok nicm@
|
#
1.69 |
|
19-Oct-2015 |
mmcc |
Move string.h include from sh.h to the files that use it.
ok nicm@
|
#
1.68 |
|
19-Oct-2015 |
mmcc |
More removal of EXTERN.
ok nicm@
|
#
1.67 |
|
19-Oct-2015 |
mmcc |
Apply style(9) to header includes.
ok nicm@
|
#
1.66 |
|
18-Oct-2015 |
mmcc |
Move more EXTERN-defined globals from sh.h.
ok nicm@
|
#
1.65 |
|
17-Oct-2015 |
mmcc |
Move a system header include from the global header (sh.h) into the files that need it. No binary change.
"This looks fine" -nicm@
|
#
1.64 |
|
16-Oct-2015 |
deraadt |
wrap a long line
|
#
1.63 |
|
16-Oct-2015 |
millert |
Implement real "flock" request and add it to userland programs that use pledge and file locking. OK deraadt@
|
#
1.62 |
|
10-Oct-2015 |
deraadt |
normalize a few more tame request orderings, to help review
|
#
1.61 |
|
10-Oct-2015 |
deraadt |
ksh can run with pledge "stdio rpath wpath cpath getpw fattr proc exec tty" if the mknod builtin is disabled. It looks like a lot of abilities, but hey, this is a shell. can't open sockets or do other nasty stuff though. (we'll leave the mknod builtin enabled on the install media for now; there is work happening to regain the MAKEDEV performance in a different way) discussions with otto & millert in particular
|
#
1.60 |
|
18-Sep-2015 |
nicm |
Last of the (thing *)0 -> NULL, from Michael McConville. No binary change.
|
#
1.59 |
|
17-Sep-2015 |
nicm |
Remove unnecessary casts, from Michael McConville. No binary change.
|
#
1.58 |
|
15-Sep-2015 |
tedu |
correct spelling of NULL from (char *)0. from Michael McConville. ok md5
|
#
1.57 |
|
10-Sep-2015 |
nicm |
Replace newline and space defines by "\n" and " " directly, from Michael McConville. ok millert
|
#
1.56 |
|
01-Sep-2015 |
tedu |
no need to check for null argv anymore. from Martijn van Duren ok deraadt
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.55 |
|
09-Feb-2015 |
jsg |
If we hit multiple errors while unwinding we'll end up running code that assumes a pointer is valid when it has been free'd.
This is convoluted as ksh has it's own allocator and uses long jumps. Set the pointer to NULL after the quitenv() call in unwind() in case we later hit a long jump in unwind().
Found with afl a while back.
ok tedu@ deraadt@
|
Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
|
#
1.54 |
|
28-Nov-2013 |
sobrado |
remove trailing whitespaces; use tabs instead of spaces where appropriate; no binary changes.
|
#
1.53 |
|
04-Sep-2013 |
millert |
Add a proper suspend builtin that saves/restores the tty and pgrp as needed instead of an alias that just sends SIGSTOP. Login shells may be suspended if they are not running in an orphan process group. OK guenther@ jmc@
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.52 |
|
15-Jun-2013 |
millert |
Run any pending traps before calling the EXIT or ERR traps when -e is set. Fixes a bug where we would not run the signal trap if, for example, ^C was pressed and -e was set. OK espie@
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.51 |
|
10-Sep-2012 |
tedu |
fake a sigwinch after each job, so if the terminal changes size, we'll notice and update
|
#
1.50 |
|
06-Sep-2012 |
millert |
Avoid modifying argv when building argv for $* and $@ since it will affect ps output. This can happen when command line options are specified, e.g. "sh -c command". Based on a diff from espie@ OK espie@
|
#
1.49 |
|
05-Sep-2012 |
espie |
backout, Todd's version may be cleaner, but it's also wrong.
|
#
1.48 |
|
05-Sep-2012 |
espie |
sh -c should not munge argv[]. This fixes ps -ww output.
joint work by millert@ and me@.
okay otto@, deraadt@ "feel free to commit my version" millert@
|
Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.47 |
|
07-Sep-2011 |
otto |
beter determination if the shell is restricted; from Alf Schlichting. ok jasper@ millert@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
|
#
1.46 |
|
19-May-2010 |
jasper |
properly keep track of the line number after a trap. this fixes pr 6195. diff from manuel giraud, thanks.
ok kili@
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
|
#
1.45 |
|
29-Jan-2009 |
jaredy |
pass "xerrok" status across the execution call stack to more closely match what both POSIX and ksh.1 already describe in regards to set -e/errexit's behavior in determining when to exit from nonzero return values.
specifically, the truth values tested as operands to `&&' and `||', as well as the resulting compound expression itself, along with the truth value resulting from a negated command (i.e. a pipeline prefixed `!'), should not make the shell exit when -e is in effect.
issue reported by matthieu. testing matthieu, naddy. ok miod (earlier version), otto. man page ok jmc.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.44 |
|
05-Jul-2008 |
djm |
ksh starting as root will refuse to import a PS1 prompt unless it contains a '#' character. Make it also accept the \$ PS1 sequence (which is supposed to automagically be $ or # depending on the user running the shell) unless ksh has been started in sh-compatibility mode.
pointed out by millert@ when I asked why my SUDO_PS1 was not being honoured; ok millert@
|
Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
|
#
1.43 |
|
31-May-2007 |
otto |
Only process ENV when in interactive mode as SU says. Started by tedu to fix make -j, SU thing spotted by naddy@; ok millert@ @tedu jmc@ for the man page bit.
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.42 |
|
02-Nov-2006 |
ray |
Only check if last three letters are "/sh" if string is at least three characters long.
OK moritz@.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.41 |
|
10-Apr-2006 |
jaredy |
fix lint comments, no functional changes; ok ray
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.40 |
|
11-Dec-2005 |
otto |
fix a few name clashes with libc; found by lint. ok deraadt@
|
#
1.39 |
|
11-Dec-2005 |
deraadt |
remove unused variables and functions
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.38 |
|
30-Mar-2005 |
deraadt |
lots of indentation cleanup, now ksh is readable like our other code. double checked to make sure no binaries change, and eyed by niallo
|
#
1.37 |
|
28-Mar-2005 |
deraadt |
if argv[0] not set, do not set it to "pdksh", but to "ksh"
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
21-Feb-2005 |
otto |
Set \u in prompt expansion to the right value, while avoiding getpw* calls, which might be very inconvenient when the yp server is not available.
ok deraadt@ millert@
|
#
1.35 |
|
22-Dec-2004 |
otto |
Fix a use-after-free, that causs core dumps if a shell is killed running with strict malloc.conf options. Problem spotted by hshoexer@; fix by me with some help from millert@.
ok millert@ hshoexer@ krw@ deraadt@
|
#
1.34 |
|
22-Dec-2004 |
millert |
Use stdbool.h instead of rolling our own bools.
|
#
1.33 |
|
20-Dec-2004 |
otto |
Ansification plus some minor knf. No binary change on i386 and sparc64, binary change in lex.o on macppc due to introduction of dopprompt() prototype. ok millert@
|
#
1.32 |
|
18-Dec-2004 |
millert |
deregister
|
#
1.31 |
|
18-Dec-2004 |
millert |
When invoked as sh set SH_VERSION, not KSH_VERSION like the man page says.
|
#
1.30 |
|
18-Dec-2004 |
millert |
Get rid of #ifdef KSH since we don't care about building a V7 style sh and the #ifdef KSH code is required to make a POSIX sh. From Matthias Kilian
|
#
1.29 |
|
18-Dec-2004 |
millert |
Remove unused OS dependent #ifdef blocks, #defines and macro abstraction. First step in making the ksh code easier to read. From Matthias Kilian
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.28 |
|
23-Aug-2004 |
millert |
Don't send SIGINT or SIGTERM to the entire processes group when the shell receives SIGINT/SIGTERM unless the shell is the process group leader. Fixes PR 3820. OK danh@ sturm@ miod@
|
#
1.27 |
|
07-Jun-2004 |
deraadt |
do not push ksh into stupid-random mode; leave it in arc4random() mode. oops. spotted by weerd@weirdnet.nl
|
Revision tags: OPENBSD_3_5_BASE
|
#
1.26 |
|
08-Jan-2004 |
jmc |
typo; from ray at cyth dot net (PR 3632);
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.25 |
|
26-Jun-2003 |
deraadt |
protos
|
#
1.24 |
|
04-Apr-2003 |
deraadt |
two fixes; help from tedu & tdeval
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.23 |
|
10-Mar-2003 |
david |
spelling fixes ok millert@
|
#
1.22 |
|
28-Feb-2003 |
jmc |
typos; from Brian Poole
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.21 |
|
09-Jun-2002 |
todd |
knf
|
Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE
|
#
1.20 |
|
19-Dec-2000 |
markus |
do not reset nonblock if shell is not interactive, from crossd@cs.rpi.edu (i should have commited this about 6 months ago, ok millert@).
|
Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
|
#
1.19 |
|
14-Nov-1999 |
millert |
Better fix for PR #921 (main.c rev 1.18) from the pdksh cvs tree.
|
#
1.18 |
|
14-Nov-1999 |
millert |
Fix a core dump caused by a signal race; yval@hackers.co.il
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.17 |
|
04-Aug-1999 |
millert |
Turn <tab> completion on by default for people used to bash, tcsh, etc...
|
#
1.16 |
|
15-Jul-1999 |
millert |
o Set default line edit mode to emacs (VISUAL/EDITOR or user can override) o Spell environment correctly
|
#
1.15 |
|
15-Jun-1999 |
millert |
patches from pdksh 5.2.13.11
|
#
1.14 |
|
27-Apr-1999 |
millert |
disable newgrp alias since OpenBSD doesn't have a newgrp(1)
|
Revision tags: OPENBSD_2_5_BASE
|
#
1.13 |
|
10-Jan-1999 |
millert |
sync with pdksh-unstable-5.2.13.6
|
#
1.12 |
|
08-Jan-1999 |
millert |
bug fixes from pdksh-unstable-5.2.13.5; some of which we already had.
|
#
1.11 |
|
29-Oct-1998 |
millert |
Bug fixes from pdksh-unstable-5.2.13.4, including "official" versions of some that we had already fixed locally. o typeset -f FUNC doesn't print follows command (and expression) substitutions. o when re-allocating memory, too much may be copied from old memory. o set -o printed some options sans names. o emacs mode: <esc>. in very fist command causes core dump. o pdksh dumps core after a cd command. o typeset -i reports on array elements that have no value (at&t ksh reports on array base name - no index). o ulimit -ctn unlimittttted kills shell (resource exceeded). o ". /dev/null" says access denied. o flag field in aliases incorrectly changed (all flags set instead of clearing ISSET) in exec.c(flushcom). o ${#array[*]} prints largest index instead of number of (set) elements in an array (ksh88 does the former). o sys_siglist[] doesn't always have NSIG non-null entries...
|
Revision tags: OPENBSD_2_4_BASE
|
#
1.10 |
|
25-Jun-1998 |
millert |
pdksh-5.2.13 + local changes
|
Revision tags: OPENBSD_2_3_BASE
|
#
1.9 |
|
12-Sep-1997 |
deraadt |
do not quitenv() too early, or "s" goes away due to it's temporary nature; fix found in freebsd ports tree.. original by ejc@bazzle.com
|
#
1.8 |
|
01-Sep-1997 |
deraadt |
i am bored enough to fix terminal space/tab uglies
|
#
1.7 |
|
19-Jun-1997 |
kstailey |
back out
|
#
1.6 |
|
18-Jun-1997 |
kstailey |
(foo *)0 -> NULL
|
#
1.5 |
|
02-Jan-1997 |
downsj |
Add FSH (set -o sh), initialize it if we're /bin/sh, and add the first use: don't set $_ if we're non-interactive.
|
#
1.4 |
|
21-Nov-1996 |
downsj |
Update to 5.2.12.
|
#
1.3 |
|
01-Oct-1996 |
downsj |
Integrate pdksh 5.2.9.
|
#
1.2 |
|
19-Aug-1996 |
downsj |
update to pdksh-5.2.8
|
#
1.1 |
|
14-Aug-1996 |
downsj |
branches: 1.1.1; Initial revision
|
#
1.92 |
|
18-May-2018 |
benno |
remove the alias type='whence -v' and replace it with 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@
|
#
1.91 |
|
09-Apr-2018 |
tobias |
Support 64 bit integers on 32 bit architectures.
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
|
Revision tags: OPENBSD_6_3_BASE
|
#
1.90 |
|
15-Mar-2018 |
anton |
Favor usage of __func__ in warning/error messages. Some of them referred to the wrong function and fix the rest for consistency. Diff from Michael W. Bombardieri with some cosmetic cleanup applied.
ok benno@ tb@
|
#
1.89 |
|
16-Jan-2018 |
jca |
Introduce internal_warningf() and mark internal_errorf() as noreturn
This helps tools like scan-build, and follows the example of warningf() and errorf(). ok anton@
|
#
1.88 |
|
15-Jan-2018 |
jca |
Stop pretending we support building ksh without EDIT/HISTORY support
ok anton@
|
#
1.87 |
|
14-Jan-2018 |
anton |
unifdef BRACE_EXPAND; ok jca@
|
#
1.86 |
|
05-Jan-2018 |
jca |
unifdef JOBS support
Prompted by a mail from Klemens Nanni, who also had the same diff. ok deraadt@ millert@
|
#
1.85 |
|
12-Dec-2017 |
tb |
Include hostname in shell prompts by default
With tmux, ssh and vmd, we tend to open shells on many different hosts simultaneously and the default prompts '$ ' and '# ' for {,k}sh as well as '% ' and '# ' for csh become dangerous: it's very easy to issue a command on the wrong host.
This can easily be avoided by displaying the hostname in the prompt. Everything beyond "hostname{$,#,%} " is going to be a matter of taste, so we left it at that. If you use an FQDN, only the first part (the output of 'hostname -s') will be printed.
requested by and ok deraadt; mostly positive feedback many ok anton, brynet, bcallah and others
|
#
1.84 |
|
07-Dec-2017 |
tb |
Drop the unused second argument from set_prompt(). It used to be used for early special casing of ! and !! in the PS1 expansion. This was removed from set_prompt() as part of the implementaion of the character count toggles \[ and \] back in 2004.
ok jca
|
Revision tags: OPENBSD_6_2_BASE
|
#
1.83 |
|
11-Aug-2017 |
guenther |
Retire old behavior of requiring root prompt to contain # or \!
Requested by akoshibe and phessler ok phessler@ anton@ jca@
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.82 |
|
17-Oct-2016 |
schwarze |
No need to inspect LC_CTYPE: * It was only used in vi input mode. * No functional change in case of set -o vi-show8. * No functional change if LC_CTYPE is set to UTF-8. * More robust for the default of LC_CTYPE=C on a UTF-8 xterm.
Behaviour changes for the combination LC_CTYPE=C with set +o vi-show8 on non-UTF-8 terminals, but that combination is useless and dangerous with or without this patch. If you want to edit individual raw non-ASCII non-UTF-8 bytes on the shell command line, always use set -o vi-show8. (Besides, i doubt that you actually want to do that; better use a real hex editor in the first place.)
OK czarkoff@.
|
#
1.81 |
|
11-Oct-2016 |
schwarze |
Partial UTF-8 line editing support for ksh(1) vi input mode; so far, it covers these commands: a h i l x / This is an isu8cont()-based hack similar in style to what i did in emacs input mode, but less elegant and slightly more intrusive because the vi mode code is much more ugly and less straightforward than the emacs mode code. This one required partial rewrites of a few helper functions, and comments were added while there.
This is not perfect, but hopefully reduces people's cursing until a more rigorous solution can be devised (much) later. Some polishing may be useful in tree, in particular adding utf8cont() support to a few missing commands.
Mostly written shortly after Christmas 2015. Reminded by and OK czarkoff@. Feedback, partial review and testing, no longer any objection by martijn@. Feedback and testing by tb@. Also read fine to nicm@.
|
#
1.80 |
|
08-Sep-2016 |
millert |
Mark PPID read-only as per the manual. From Anthony Coulter.
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.79 |
|
04-Mar-2016 |
deraadt |
remove CSRG BSD-licensed mknod builtin code which was previously used to accelerate install/upgrade time MAKEDEV runs. That allows ramdisk ksh to be pledged, without needing "dpath". We'll solve the performance issues a different way (soon). ok otto espie natano tb tobiasu rpe
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.78 |
|
30-Dec-2015 |
tedu |
rename global "e" to genv to avoid accidental shadowing and aliasing. ok millert nicm tb
|
#
1.77 |
|
27-Dec-2015 |
jca |
Tweak comment: we now always make a copy of argv.
ok halex@
|
#
1.76 |
|
27-Dec-2015 |
halex |
unconditionally duplicate the argv array on initialization, to make it resilient against being altered by a subsequent shift operation
tweak and ok semarie@
|
#
1.75 |
|
14-Dec-2015 |
tb |
Move system headers from sh.h to those files that actually need them.
ok mmcc@ a while ago
|
#
1.74 |
|
11-Nov-2015 |
deraadt |
exit() after perror() for pledge failure. Perhaps this got introduced as a test idiom, either when pledge was young or during the transition to strings.... dunno
|
#
1.73 |
|
01-Nov-2015 |
mmcc |
Add uses of areallocarray(). mksh and Bitrig ksh already have similar functions. With help from Theo Buehler.
ok nicm@
|
#
1.72 |
|
30-Oct-2015 |
guenther |
'fc -e -' is deprecated in favor of 'fc -s', so update the built-in alias
ok millert@
|
#
1.71 |
|
22-Oct-2015 |
mmcc |
Final removal of EXTERN.
ok nicm@
|
#
1.70 |
|
21-Oct-2015 |
mmcc |
Penultimate commit to remove EXTERN.
ok nicm@
|
#
1.69 |
|
19-Oct-2015 |
mmcc |
Move string.h include from sh.h to the files that use it.
ok nicm@
|
#
1.68 |
|
19-Oct-2015 |
mmcc |
More removal of EXTERN.
ok nicm@
|
#
1.67 |
|
19-Oct-2015 |
mmcc |
Apply style(9) to header includes.
ok nicm@
|
#
1.66 |
|
18-Oct-2015 |
mmcc |
Move more EXTERN-defined globals from sh.h.
ok nicm@
|
#
1.65 |
|
17-Oct-2015 |
mmcc |
Move a system header include from the global header (sh.h) into the files that need it. No binary change.
"This looks fine" -nicm@
|
#
1.64 |
|
16-Oct-2015 |
deraadt |
wrap a long line
|
#
1.63 |
|
16-Oct-2015 |
millert |
Implement real "flock" request and add it to userland programs that use pledge and file locking. OK deraadt@
|
#
1.62 |
|
10-Oct-2015 |
deraadt |
normalize a few more tame request orderings, to help review
|
#
1.61 |
|
10-Oct-2015 |
deraadt |
ksh can run with pledge "stdio rpath wpath cpath getpw fattr proc exec tty" if the mknod builtin is disabled. It looks like a lot of abilities, but hey, this is a shell. can't open sockets or do other nasty stuff though. (we'll leave the mknod builtin enabled on the install media for now; there is work happening to regain the MAKEDEV performance in a different way) discussions with otto & millert in particular
|
#
1.60 |
|
18-Sep-2015 |
nicm |
Last of the (thing *)0 -> NULL, from Michael McConville. No binary change.
|
#
1.59 |
|
17-Sep-2015 |
nicm |
Remove unnecessary casts, from Michael McConville. No binary change.
|
#
1.58 |
|
15-Sep-2015 |
tedu |
correct spelling of NULL from (char *)0. from Michael McConville. ok md5
|
#
1.57 |
|
10-Sep-2015 |
nicm |
Replace newline and space defines by "\n" and " " directly, from Michael McConville. ok millert
|
#
1.56 |
|
01-Sep-2015 |
tedu |
no need to check for null argv anymore. from Martijn van Duren ok deraadt
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.55 |
|
09-Feb-2015 |
jsg |
If we hit multiple errors while unwinding we'll end up running code that assumes a pointer is valid when it has been free'd.
This is convoluted as ksh has it's own allocator and uses long jumps. Set the pointer to NULL after the quitenv() call in unwind() in case we later hit a long jump in unwind().
Found with afl a while back.
ok tedu@ deraadt@
|
Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
|
#
1.54 |
|
28-Nov-2013 |
sobrado |
remove trailing whitespaces; use tabs instead of spaces where appropriate; no binary changes.
|
#
1.53 |
|
04-Sep-2013 |
millert |
Add a proper suspend builtin that saves/restores the tty and pgrp as needed instead of an alias that just sends SIGSTOP. Login shells may be suspended if they are not running in an orphan process group. OK guenther@ jmc@
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.52 |
|
15-Jun-2013 |
millert |
Run any pending traps before calling the EXIT or ERR traps when -e is set. Fixes a bug where we would not run the signal trap if, for example, ^C was pressed and -e was set. OK espie@
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.51 |
|
10-Sep-2012 |
tedu |
fake a sigwinch after each job, so if the terminal changes size, we'll notice and update
|
#
1.50 |
|
06-Sep-2012 |
millert |
Avoid modifying argv when building argv for $* and $@ since it will affect ps output. This can happen when command line options are specified, e.g. "sh -c command". Based on a diff from espie@ OK espie@
|
#
1.49 |
|
05-Sep-2012 |
espie |
backout, Todd's version may be cleaner, but it's also wrong.
|
#
1.48 |
|
05-Sep-2012 |
espie |
sh -c should not munge argv[]. This fixes ps -ww output.
joint work by millert@ and me@.
okay otto@, deraadt@ "feel free to commit my version" millert@
|
Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.47 |
|
07-Sep-2011 |
otto |
beter determination if the shell is restricted; from Alf Schlichting. ok jasper@ millert@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
|
#
1.46 |
|
19-May-2010 |
jasper |
properly keep track of the line number after a trap. this fixes pr 6195. diff from manuel giraud, thanks.
ok kili@
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
|
#
1.45 |
|
29-Jan-2009 |
jaredy |
pass "xerrok" status across the execution call stack to more closely match what both POSIX and ksh.1 already describe in regards to set -e/errexit's behavior in determining when to exit from nonzero return values.
specifically, the truth values tested as operands to `&&' and `||', as well as the resulting compound expression itself, along with the truth value resulting from a negated command (i.e. a pipeline prefixed `!'), should not make the shell exit when -e is in effect.
issue reported by matthieu. testing matthieu, naddy. ok miod (earlier version), otto. man page ok jmc.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.44 |
|
05-Jul-2008 |
djm |
ksh starting as root will refuse to import a PS1 prompt unless it contains a '#' character. Make it also accept the \$ PS1 sequence (which is supposed to automagically be $ or # depending on the user running the shell) unless ksh has been started in sh-compatibility mode.
pointed out by millert@ when I asked why my SUDO_PS1 was not being honoured; ok millert@
|
Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
|
#
1.43 |
|
31-May-2007 |
otto |
Only process ENV when in interactive mode as SU says. Started by tedu to fix make -j, SU thing spotted by naddy@; ok millert@ @tedu jmc@ for the man page bit.
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.42 |
|
02-Nov-2006 |
ray |
Only check if last three letters are "/sh" if string is at least three characters long.
OK moritz@.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.41 |
|
10-Apr-2006 |
jaredy |
fix lint comments, no functional changes; ok ray
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.40 |
|
11-Dec-2005 |
otto |
fix a few name clashes with libc; found by lint. ok deraadt@
|
#
1.39 |
|
11-Dec-2005 |
deraadt |
remove unused variables and functions
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.38 |
|
30-Mar-2005 |
deraadt |
lots of indentation cleanup, now ksh is readable like our other code. double checked to make sure no binaries change, and eyed by niallo
|
#
1.37 |
|
28-Mar-2005 |
deraadt |
if argv[0] not set, do not set it to "pdksh", but to "ksh"
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
21-Feb-2005 |
otto |
Set \u in prompt expansion to the right value, while avoiding getpw* calls, which might be very inconvenient when the yp server is not available.
ok deraadt@ millert@
|
#
1.35 |
|
22-Dec-2004 |
otto |
Fix a use-after-free, that causs core dumps if a shell is killed running with strict malloc.conf options. Problem spotted by hshoexer@; fix by me with some help from millert@.
ok millert@ hshoexer@ krw@ deraadt@
|
#
1.34 |
|
22-Dec-2004 |
millert |
Use stdbool.h instead of rolling our own bools.
|
#
1.33 |
|
20-Dec-2004 |
otto |
Ansification plus some minor knf. No binary change on i386 and sparc64, binary change in lex.o on macppc due to introduction of dopprompt() prototype. ok millert@
|
#
1.32 |
|
18-Dec-2004 |
millert |
deregister
|
#
1.31 |
|
18-Dec-2004 |
millert |
When invoked as sh set SH_VERSION, not KSH_VERSION like the man page says.
|
#
1.30 |
|
18-Dec-2004 |
millert |
Get rid of #ifdef KSH since we don't care about building a V7 style sh and the #ifdef KSH code is required to make a POSIX sh. From Matthias Kilian
|
#
1.29 |
|
18-Dec-2004 |
millert |
Remove unused OS dependent #ifdef blocks, #defines and macro abstraction. First step in making the ksh code easier to read. From Matthias Kilian
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.28 |
|
23-Aug-2004 |
millert |
Don't send SIGINT or SIGTERM to the entire processes group when the shell receives SIGINT/SIGTERM unless the shell is the process group leader. Fixes PR 3820. OK danh@ sturm@ miod@
|
#
1.27 |
|
07-Jun-2004 |
deraadt |
do not push ksh into stupid-random mode; leave it in arc4random() mode. oops. spotted by weerd@weirdnet.nl
|
Revision tags: OPENBSD_3_5_BASE
|
#
1.26 |
|
08-Jan-2004 |
jmc |
typo; from ray at cyth dot net (PR 3632);
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.25 |
|
26-Jun-2003 |
deraadt |
protos
|
#
1.24 |
|
04-Apr-2003 |
deraadt |
two fixes; help from tedu & tdeval
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.23 |
|
10-Mar-2003 |
david |
spelling fixes ok millert@
|
#
1.22 |
|
28-Feb-2003 |
jmc |
typos; from Brian Poole
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.21 |
|
09-Jun-2002 |
todd |
knf
|
Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE
|
#
1.20 |
|
19-Dec-2000 |
markus |
do not reset nonblock if shell is not interactive, from crossd@cs.rpi.edu (i should have commited this about 6 months ago, ok millert@).
|
Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
|
#
1.19 |
|
14-Nov-1999 |
millert |
Better fix for PR #921 (main.c rev 1.18) from the pdksh cvs tree.
|
#
1.18 |
|
14-Nov-1999 |
millert |
Fix a core dump caused by a signal race; yval@hackers.co.il
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.17 |
|
04-Aug-1999 |
millert |
Turn <tab> completion on by default for people used to bash, tcsh, etc...
|
#
1.16 |
|
15-Jul-1999 |
millert |
o Set default line edit mode to emacs (VISUAL/EDITOR or user can override) o Spell environment correctly
|
#
1.15 |
|
15-Jun-1999 |
millert |
patches from pdksh 5.2.13.11
|
#
1.14 |
|
27-Apr-1999 |
millert |
disable newgrp alias since OpenBSD doesn't have a newgrp(1)
|
Revision tags: OPENBSD_2_5_BASE
|
#
1.13 |
|
10-Jan-1999 |
millert |
sync with pdksh-unstable-5.2.13.6
|
#
1.12 |
|
08-Jan-1999 |
millert |
bug fixes from pdksh-unstable-5.2.13.5; some of which we already had.
|
#
1.11 |
|
29-Oct-1998 |
millert |
Bug fixes from pdksh-unstable-5.2.13.4, including "official" versions of some that we had already fixed locally. o typeset -f FUNC doesn't print follows command (and expression) substitutions. o when re-allocating memory, too much may be copied from old memory. o set -o printed some options sans names. o emacs mode: <esc>. in very fist command causes core dump. o pdksh dumps core after a cd command. o typeset -i reports on array elements that have no value (at&t ksh reports on array base name - no index). o ulimit -ctn unlimittttted kills shell (resource exceeded). o ". /dev/null" says access denied. o flag field in aliases incorrectly changed (all flags set instead of clearing ISSET) in exec.c(flushcom). o ${#array[*]} prints largest index instead of number of (set) elements in an array (ksh88 does the former). o sys_siglist[] doesn't always have NSIG non-null entries...
|
Revision tags: OPENBSD_2_4_BASE
|
#
1.10 |
|
25-Jun-1998 |
millert |
pdksh-5.2.13 + local changes
|
Revision tags: OPENBSD_2_3_BASE
|
#
1.9 |
|
12-Sep-1997 |
deraadt |
do not quitenv() too early, or "s" goes away due to it's temporary nature; fix found in freebsd ports tree.. original by ejc@bazzle.com
|
#
1.8 |
|
01-Sep-1997 |
deraadt |
i am bored enough to fix terminal space/tab uglies
|
#
1.7 |
|
19-Jun-1997 |
kstailey |
back out
|
#
1.6 |
|
18-Jun-1997 |
kstailey |
(foo *)0 -> NULL
|
#
1.5 |
|
02-Jan-1997 |
downsj |
Add FSH (set -o sh), initialize it if we're /bin/sh, and add the first use: don't set $_ if we're non-interactive.
|
#
1.4 |
|
21-Nov-1996 |
downsj |
Update to 5.2.12.
|
#
1.3 |
|
01-Oct-1996 |
downsj |
Integrate pdksh 5.2.9.
|
#
1.2 |
|
19-Aug-1996 |
downsj |
update to pdksh-5.2.8
|
#
1.1 |
|
14-Aug-1996 |
downsj |
branches: 1.1.1; Initial revision
|
#
1.91 |
|
09-Apr-2018 |
tobias |
Support 64 bit integers on 32 bit architectures.
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
|
Revision tags: OPENBSD_6_3_BASE
|
#
1.90 |
|
15-Mar-2018 |
anton |
Favor usage of __func__ in warning/error messages. Some of them referred to the wrong function and fix the rest for consistency. Diff from Michael W. Bombardieri with some cosmetic cleanup applied.
ok benno@ tb@
|
#
1.89 |
|
16-Jan-2018 |
jca |
Introduce internal_warningf() and mark internal_errorf() as noreturn
This helps tools like scan-build, and follows the example of warningf() and errorf(). ok anton@
|
#
1.88 |
|
15-Jan-2018 |
jca |
Stop pretending we support building ksh without EDIT/HISTORY support
ok anton@
|
#
1.87 |
|
14-Jan-2018 |
anton |
unifdef BRACE_EXPAND; ok jca@
|
#
1.86 |
|
05-Jan-2018 |
jca |
unifdef JOBS support
Prompted by a mail from Klemens Nanni, who also had the same diff. ok deraadt@ millert@
|
#
1.85 |
|
12-Dec-2017 |
tb |
Include hostname in shell prompts by default
With tmux, ssh and vmd, we tend to open shells on many different hosts simultaneously and the default prompts '$ ' and '# ' for {,k}sh as well as '% ' and '# ' for csh become dangerous: it's very easy to issue a command on the wrong host.
This can easily be avoided by displaying the hostname in the prompt. Everything beyond "hostname{$,#,%} " is going to be a matter of taste, so we left it at that. If you use an FQDN, only the first part (the output of 'hostname -s') will be printed.
requested by and ok deraadt; mostly positive feedback many ok anton, brynet, bcallah and others
|
#
1.84 |
|
07-Dec-2017 |
tb |
Drop the unused second argument from set_prompt(). It used to be used for early special casing of ! and !! in the PS1 expansion. This was removed from set_prompt() as part of the implementaion of the character count toggles \[ and \] back in 2004.
ok jca
|
Revision tags: OPENBSD_6_2_BASE
|
#
1.83 |
|
11-Aug-2017 |
guenther |
Retire old behavior of requiring root prompt to contain # or \!
Requested by akoshibe and phessler ok phessler@ anton@ jca@
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.82 |
|
17-Oct-2016 |
schwarze |
No need to inspect LC_CTYPE: * It was only used in vi input mode. * No functional change in case of set -o vi-show8. * No functional change if LC_CTYPE is set to UTF-8. * More robust for the default of LC_CTYPE=C on a UTF-8 xterm.
Behaviour changes for the combination LC_CTYPE=C with set +o vi-show8 on non-UTF-8 terminals, but that combination is useless and dangerous with or without this patch. If you want to edit individual raw non-ASCII non-UTF-8 bytes on the shell command line, always use set -o vi-show8. (Besides, i doubt that you actually want to do that; better use a real hex editor in the first place.)
OK czarkoff@.
|
#
1.81 |
|
11-Oct-2016 |
schwarze |
Partial UTF-8 line editing support for ksh(1) vi input mode; so far, it covers these commands: a h i l x / This is an isu8cont()-based hack similar in style to what i did in emacs input mode, but less elegant and slightly more intrusive because the vi mode code is much more ugly and less straightforward than the emacs mode code. This one required partial rewrites of a few helper functions, and comments were added while there.
This is not perfect, but hopefully reduces people's cursing until a more rigorous solution can be devised (much) later. Some polishing may be useful in tree, in particular adding utf8cont() support to a few missing commands.
Mostly written shortly after Christmas 2015. Reminded by and OK czarkoff@. Feedback, partial review and testing, no longer any objection by martijn@. Feedback and testing by tb@. Also read fine to nicm@.
|
#
1.80 |
|
08-Sep-2016 |
millert |
Mark PPID read-only as per the manual. From Anthony Coulter.
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.79 |
|
04-Mar-2016 |
deraadt |
remove CSRG BSD-licensed mknod builtin code which was previously used to accelerate install/upgrade time MAKEDEV runs. That allows ramdisk ksh to be pledged, without needing "dpath". We'll solve the performance issues a different way (soon). ok otto espie natano tb tobiasu rpe
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.78 |
|
30-Dec-2015 |
tedu |
rename global "e" to genv to avoid accidental shadowing and aliasing. ok millert nicm tb
|
#
1.77 |
|
27-Dec-2015 |
jca |
Tweak comment: we now always make a copy of argv.
ok halex@
|
#
1.76 |
|
27-Dec-2015 |
halex |
unconditionally duplicate the argv array on initialization, to make it resilient against being altered by a subsequent shift operation
tweak and ok semarie@
|
#
1.75 |
|
14-Dec-2015 |
tb |
Move system headers from sh.h to those files that actually need them.
ok mmcc@ a while ago
|
#
1.74 |
|
11-Nov-2015 |
deraadt |
exit() after perror() for pledge failure. Perhaps this got introduced as a test idiom, either when pledge was young or during the transition to strings.... dunno
|
#
1.73 |
|
01-Nov-2015 |
mmcc |
Add uses of areallocarray(). mksh and Bitrig ksh already have similar functions. With help from Theo Buehler.
ok nicm@
|
#
1.72 |
|
30-Oct-2015 |
guenther |
'fc -e -' is deprecated in favor of 'fc -s', so update the built-in alias
ok millert@
|
#
1.71 |
|
22-Oct-2015 |
mmcc |
Final removal of EXTERN.
ok nicm@
|
#
1.70 |
|
21-Oct-2015 |
mmcc |
Penultimate commit to remove EXTERN.
ok nicm@
|
#
1.69 |
|
19-Oct-2015 |
mmcc |
Move string.h include from sh.h to the files that use it.
ok nicm@
|
#
1.68 |
|
19-Oct-2015 |
mmcc |
More removal of EXTERN.
ok nicm@
|
#
1.67 |
|
19-Oct-2015 |
mmcc |
Apply style(9) to header includes.
ok nicm@
|
#
1.66 |
|
18-Oct-2015 |
mmcc |
Move more EXTERN-defined globals from sh.h.
ok nicm@
|
#
1.65 |
|
17-Oct-2015 |
mmcc |
Move a system header include from the global header (sh.h) into the files that need it. No binary change.
"This looks fine" -nicm@
|
#
1.64 |
|
16-Oct-2015 |
deraadt |
wrap a long line
|
#
1.63 |
|
16-Oct-2015 |
millert |
Implement real "flock" request and add it to userland programs that use pledge and file locking. OK deraadt@
|
#
1.62 |
|
10-Oct-2015 |
deraadt |
normalize a few more tame request orderings, to help review
|
#
1.61 |
|
10-Oct-2015 |
deraadt |
ksh can run with pledge "stdio rpath wpath cpath getpw fattr proc exec tty" if the mknod builtin is disabled. It looks like a lot of abilities, but hey, this is a shell. can't open sockets or do other nasty stuff though. (we'll leave the mknod builtin enabled on the install media for now; there is work happening to regain the MAKEDEV performance in a different way) discussions with otto & millert in particular
|
#
1.60 |
|
18-Sep-2015 |
nicm |
Last of the (thing *)0 -> NULL, from Michael McConville. No binary change.
|
#
1.59 |
|
17-Sep-2015 |
nicm |
Remove unnecessary casts, from Michael McConville. No binary change.
|
#
1.58 |
|
15-Sep-2015 |
tedu |
correct spelling of NULL from (char *)0. from Michael McConville. ok md5
|
#
1.57 |
|
10-Sep-2015 |
nicm |
Replace newline and space defines by "\n" and " " directly, from Michael McConville. ok millert
|
#
1.56 |
|
01-Sep-2015 |
tedu |
no need to check for null argv anymore. from Martijn van Duren ok deraadt
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.55 |
|
09-Feb-2015 |
jsg |
If we hit multiple errors while unwinding we'll end up running code that assumes a pointer is valid when it has been free'd.
This is convoluted as ksh has it's own allocator and uses long jumps. Set the pointer to NULL after the quitenv() call in unwind() in case we later hit a long jump in unwind().
Found with afl a while back.
ok tedu@ deraadt@
|
Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
|
#
1.54 |
|
28-Nov-2013 |
sobrado |
remove trailing whitespaces; use tabs instead of spaces where appropriate; no binary changes.
|
#
1.53 |
|
04-Sep-2013 |
millert |
Add a proper suspend builtin that saves/restores the tty and pgrp as needed instead of an alias that just sends SIGSTOP. Login shells may be suspended if they are not running in an orphan process group. OK guenther@ jmc@
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.52 |
|
15-Jun-2013 |
millert |
Run any pending traps before calling the EXIT or ERR traps when -e is set. Fixes a bug where we would not run the signal trap if, for example, ^C was pressed and -e was set. OK espie@
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.51 |
|
10-Sep-2012 |
tedu |
fake a sigwinch after each job, so if the terminal changes size, we'll notice and update
|
#
1.50 |
|
06-Sep-2012 |
millert |
Avoid modifying argv when building argv for $* and $@ since it will affect ps output. This can happen when command line options are specified, e.g. "sh -c command". Based on a diff from espie@ OK espie@
|
#
1.49 |
|
05-Sep-2012 |
espie |
backout, Todd's version may be cleaner, but it's also wrong.
|
#
1.48 |
|
05-Sep-2012 |
espie |
sh -c should not munge argv[]. This fixes ps -ww output.
joint work by millert@ and me@.
okay otto@, deraadt@ "feel free to commit my version" millert@
|
Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.47 |
|
07-Sep-2011 |
otto |
beter determination if the shell is restricted; from Alf Schlichting. ok jasper@ millert@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
|
#
1.46 |
|
19-May-2010 |
jasper |
properly keep track of the line number after a trap. this fixes pr 6195. diff from manuel giraud, thanks.
ok kili@
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
|
#
1.45 |
|
29-Jan-2009 |
jaredy |
pass "xerrok" status across the execution call stack to more closely match what both POSIX and ksh.1 already describe in regards to set -e/errexit's behavior in determining when to exit from nonzero return values.
specifically, the truth values tested as operands to `&&' and `||', as well as the resulting compound expression itself, along with the truth value resulting from a negated command (i.e. a pipeline prefixed `!'), should not make the shell exit when -e is in effect.
issue reported by matthieu. testing matthieu, naddy. ok miod (earlier version), otto. man page ok jmc.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.44 |
|
05-Jul-2008 |
djm |
ksh starting as root will refuse to import a PS1 prompt unless it contains a '#' character. Make it also accept the \$ PS1 sequence (which is supposed to automagically be $ or # depending on the user running the shell) unless ksh has been started in sh-compatibility mode.
pointed out by millert@ when I asked why my SUDO_PS1 was not being honoured; ok millert@
|
Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
|
#
1.43 |
|
31-May-2007 |
otto |
Only process ENV when in interactive mode as SU says. Started by tedu to fix make -j, SU thing spotted by naddy@; ok millert@ @tedu jmc@ for the man page bit.
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.42 |
|
02-Nov-2006 |
ray |
Only check if last three letters are "/sh" if string is at least three characters long.
OK moritz@.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.41 |
|
10-Apr-2006 |
jaredy |
fix lint comments, no functional changes; ok ray
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.40 |
|
11-Dec-2005 |
otto |
fix a few name clashes with libc; found by lint. ok deraadt@
|
#
1.39 |
|
11-Dec-2005 |
deraadt |
remove unused variables and functions
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.38 |
|
30-Mar-2005 |
deraadt |
lots of indentation cleanup, now ksh is readable like our other code. double checked to make sure no binaries change, and eyed by niallo
|
#
1.37 |
|
28-Mar-2005 |
deraadt |
if argv[0] not set, do not set it to "pdksh", but to "ksh"
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
21-Feb-2005 |
otto |
Set \u in prompt expansion to the right value, while avoiding getpw* calls, which might be very inconvenient when the yp server is not available.
ok deraadt@ millert@
|
#
1.35 |
|
22-Dec-2004 |
otto |
Fix a use-after-free, that causs core dumps if a shell is killed running with strict malloc.conf options. Problem spotted by hshoexer@; fix by me with some help from millert@.
ok millert@ hshoexer@ krw@ deraadt@
|
#
1.34 |
|
22-Dec-2004 |
millert |
Use stdbool.h instead of rolling our own bools.
|
#
1.33 |
|
20-Dec-2004 |
otto |
Ansification plus some minor knf. No binary change on i386 and sparc64, binary change in lex.o on macppc due to introduction of dopprompt() prototype. ok millert@
|
#
1.32 |
|
18-Dec-2004 |
millert |
deregister
|
#
1.31 |
|
18-Dec-2004 |
millert |
When invoked as sh set SH_VERSION, not KSH_VERSION like the man page says.
|
#
1.30 |
|
18-Dec-2004 |
millert |
Get rid of #ifdef KSH since we don't care about building a V7 style sh and the #ifdef KSH code is required to make a POSIX sh. From Matthias Kilian
|
#
1.29 |
|
18-Dec-2004 |
millert |
Remove unused OS dependent #ifdef blocks, #defines and macro abstraction. First step in making the ksh code easier to read. From Matthias Kilian
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.28 |
|
23-Aug-2004 |
millert |
Don't send SIGINT or SIGTERM to the entire processes group when the shell receives SIGINT/SIGTERM unless the shell is the process group leader. Fixes PR 3820. OK danh@ sturm@ miod@
|
#
1.27 |
|
07-Jun-2004 |
deraadt |
do not push ksh into stupid-random mode; leave it in arc4random() mode. oops. spotted by weerd@weirdnet.nl
|
Revision tags: OPENBSD_3_5_BASE
|
#
1.26 |
|
08-Jan-2004 |
jmc |
typo; from ray at cyth dot net (PR 3632);
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.25 |
|
26-Jun-2003 |
deraadt |
protos
|
#
1.24 |
|
04-Apr-2003 |
deraadt |
two fixes; help from tedu & tdeval
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.23 |
|
10-Mar-2003 |
david |
spelling fixes ok millert@
|
#
1.22 |
|
28-Feb-2003 |
jmc |
typos; from Brian Poole
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.21 |
|
09-Jun-2002 |
todd |
knf
|
Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE
|
#
1.20 |
|
19-Dec-2000 |
markus |
do not reset nonblock if shell is not interactive, from crossd@cs.rpi.edu (i should have commited this about 6 months ago, ok millert@).
|
Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
|
#
1.19 |
|
14-Nov-1999 |
millert |
Better fix for PR #921 (main.c rev 1.18) from the pdksh cvs tree.
|
#
1.18 |
|
14-Nov-1999 |
millert |
Fix a core dump caused by a signal race; yval@hackers.co.il
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.17 |
|
04-Aug-1999 |
millert |
Turn <tab> completion on by default for people used to bash, tcsh, etc...
|
#
1.16 |
|
15-Jul-1999 |
millert |
o Set default line edit mode to emacs (VISUAL/EDITOR or user can override) o Spell environment correctly
|
#
1.15 |
|
15-Jun-1999 |
millert |
patches from pdksh 5.2.13.11
|
#
1.14 |
|
27-Apr-1999 |
millert |
disable newgrp alias since OpenBSD doesn't have a newgrp(1)
|
Revision tags: OPENBSD_2_5_BASE
|
#
1.13 |
|
10-Jan-1999 |
millert |
sync with pdksh-unstable-5.2.13.6
|
#
1.12 |
|
08-Jan-1999 |
millert |
bug fixes from pdksh-unstable-5.2.13.5; some of which we already had.
|
#
1.11 |
|
29-Oct-1998 |
millert |
Bug fixes from pdksh-unstable-5.2.13.4, including "official" versions of some that we had already fixed locally. o typeset -f FUNC doesn't print follows command (and expression) substitutions. o when re-allocating memory, too much may be copied from old memory. o set -o printed some options sans names. o emacs mode: <esc>. in very fist command causes core dump. o pdksh dumps core after a cd command. o typeset -i reports on array elements that have no value (at&t ksh reports on array base name - no index). o ulimit -ctn unlimittttted kills shell (resource exceeded). o ". /dev/null" says access denied. o flag field in aliases incorrectly changed (all flags set instead of clearing ISSET) in exec.c(flushcom). o ${#array[*]} prints largest index instead of number of (set) elements in an array (ksh88 does the former). o sys_siglist[] doesn't always have NSIG non-null entries...
|
Revision tags: OPENBSD_2_4_BASE
|
#
1.10 |
|
25-Jun-1998 |
millert |
pdksh-5.2.13 + local changes
|
Revision tags: OPENBSD_2_3_BASE
|
#
1.9 |
|
12-Sep-1997 |
deraadt |
do not quitenv() too early, or "s" goes away due to it's temporary nature; fix found in freebsd ports tree.. original by ejc@bazzle.com
|
#
1.8 |
|
01-Sep-1997 |
deraadt |
i am bored enough to fix terminal space/tab uglies
|
#
1.7 |
|
19-Jun-1997 |
kstailey |
back out
|
#
1.6 |
|
18-Jun-1997 |
kstailey |
(foo *)0 -> NULL
|
#
1.5 |
|
02-Jan-1997 |
downsj |
Add FSH (set -o sh), initialize it if we're /bin/sh, and add the first use: don't set $_ if we're non-interactive.
|
#
1.4 |
|
21-Nov-1996 |
downsj |
Update to 5.2.12.
|
#
1.3 |
|
01-Oct-1996 |
downsj |
Integrate pdksh 5.2.9.
|
#
1.2 |
|
19-Aug-1996 |
downsj |
update to pdksh-5.2.8
|
#
1.1 |
|
14-Aug-1996 |
downsj |
branches: 1.1.1; Initial revision
|
Revision tags: OPENBSD_6_3_BASE
|
#
1.90 |
|
15-Mar-2018 |
anton |
Favor usage of __func__ in warning/error messages. Some of them referred to the wrong function and fix the rest for consistency. Diff from Michael W. Bombardieri with some cosmetic cleanup applied.
ok benno@ tb@
|
#
1.89 |
|
16-Jan-2018 |
jca |
Introduce internal_warningf() and mark internal_errorf() as noreturn
This helps tools like scan-build, and follows the example of warningf() and errorf(). ok anton@
|
#
1.88 |
|
15-Jan-2018 |
jca |
Stop pretending we support building ksh without EDIT/HISTORY support
ok anton@
|
#
1.87 |
|
14-Jan-2018 |
anton |
unifdef BRACE_EXPAND; ok jca@
|
#
1.86 |
|
05-Jan-2018 |
jca |
unifdef JOBS support
Prompted by a mail from Klemens Nanni, who also had the same diff. ok deraadt@ millert@
|
#
1.85 |
|
12-Dec-2017 |
tb |
Include hostname in shell prompts by default
With tmux, ssh and vmd, we tend to open shells on many different hosts simultaneously and the default prompts '$ ' and '# ' for {,k}sh as well as '% ' and '# ' for csh become dangerous: it's very easy to issue a command on the wrong host.
This can easily be avoided by displaying the hostname in the prompt. Everything beyond "hostname{$,#,%} " is going to be a matter of taste, so we left it at that. If you use an FQDN, only the first part (the output of 'hostname -s') will be printed.
requested by and ok deraadt; mostly positive feedback many ok anton, brynet, bcallah and others
|
#
1.84 |
|
07-Dec-2017 |
tb |
Drop the unused second argument from set_prompt(). It used to be used for early special casing of ! and !! in the PS1 expansion. This was removed from set_prompt() as part of the implementaion of the character count toggles \[ and \] back in 2004.
ok jca
|
Revision tags: OPENBSD_6_2_BASE
|
#
1.83 |
|
11-Aug-2017 |
guenther |
Retire old behavior of requiring root prompt to contain # or \!
Requested by akoshibe and phessler ok phessler@ anton@ jca@
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.82 |
|
17-Oct-2016 |
schwarze |
No need to inspect LC_CTYPE: * It was only used in vi input mode. * No functional change in case of set -o vi-show8. * No functional change if LC_CTYPE is set to UTF-8. * More robust for the default of LC_CTYPE=C on a UTF-8 xterm.
Behaviour changes for the combination LC_CTYPE=C with set +o vi-show8 on non-UTF-8 terminals, but that combination is useless and dangerous with or without this patch. If you want to edit individual raw non-ASCII non-UTF-8 bytes on the shell command line, always use set -o vi-show8. (Besides, i doubt that you actually want to do that; better use a real hex editor in the first place.)
OK czarkoff@.
|
#
1.81 |
|
11-Oct-2016 |
schwarze |
Partial UTF-8 line editing support for ksh(1) vi input mode; so far, it covers these commands: a h i l x / This is an isu8cont()-based hack similar in style to what i did in emacs input mode, but less elegant and slightly more intrusive because the vi mode code is much more ugly and less straightforward than the emacs mode code. This one required partial rewrites of a few helper functions, and comments were added while there.
This is not perfect, but hopefully reduces people's cursing until a more rigorous solution can be devised (much) later. Some polishing may be useful in tree, in particular adding utf8cont() support to a few missing commands.
Mostly written shortly after Christmas 2015. Reminded by and OK czarkoff@. Feedback, partial review and testing, no longer any objection by martijn@. Feedback and testing by tb@. Also read fine to nicm@.
|
#
1.80 |
|
08-Sep-2016 |
millert |
Mark PPID read-only as per the manual. From Anthony Coulter.
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.79 |
|
04-Mar-2016 |
deraadt |
remove CSRG BSD-licensed mknod builtin code which was previously used to accelerate install/upgrade time MAKEDEV runs. That allows ramdisk ksh to be pledged, without needing "dpath". We'll solve the performance issues a different way (soon). ok otto espie natano tb tobiasu rpe
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.78 |
|
30-Dec-2015 |
tedu |
rename global "e" to genv to avoid accidental shadowing and aliasing. ok millert nicm tb
|
#
1.77 |
|
27-Dec-2015 |
jca |
Tweak comment: we now always make a copy of argv.
ok halex@
|
#
1.76 |
|
27-Dec-2015 |
halex |
unconditionally duplicate the argv array on initialization, to make it resilient against being altered by a subsequent shift operation
tweak and ok semarie@
|
#
1.75 |
|
14-Dec-2015 |
tb |
Move system headers from sh.h to those files that actually need them.
ok mmcc@ a while ago
|
#
1.74 |
|
11-Nov-2015 |
deraadt |
exit() after perror() for pledge failure. Perhaps this got introduced as a test idiom, either when pledge was young or during the transition to strings.... dunno
|
#
1.73 |
|
01-Nov-2015 |
mmcc |
Add uses of areallocarray(). mksh and Bitrig ksh already have similar functions. With help from Theo Buehler.
ok nicm@
|
#
1.72 |
|
30-Oct-2015 |
guenther |
'fc -e -' is deprecated in favor of 'fc -s', so update the built-in alias
ok millert@
|
#
1.71 |
|
22-Oct-2015 |
mmcc |
Final removal of EXTERN.
ok nicm@
|
#
1.70 |
|
21-Oct-2015 |
mmcc |
Penultimate commit to remove EXTERN.
ok nicm@
|
#
1.69 |
|
19-Oct-2015 |
mmcc |
Move string.h include from sh.h to the files that use it.
ok nicm@
|
#
1.68 |
|
19-Oct-2015 |
mmcc |
More removal of EXTERN.
ok nicm@
|
#
1.67 |
|
19-Oct-2015 |
mmcc |
Apply style(9) to header includes.
ok nicm@
|
#
1.66 |
|
18-Oct-2015 |
mmcc |
Move more EXTERN-defined globals from sh.h.
ok nicm@
|
#
1.65 |
|
17-Oct-2015 |
mmcc |
Move a system header include from the global header (sh.h) into the files that need it. No binary change.
"This looks fine" -nicm@
|
#
1.64 |
|
16-Oct-2015 |
deraadt |
wrap a long line
|
#
1.63 |
|
16-Oct-2015 |
millert |
Implement real "flock" request and add it to userland programs that use pledge and file locking. OK deraadt@
|
#
1.62 |
|
10-Oct-2015 |
deraadt |
normalize a few more tame request orderings, to help review
|
#
1.61 |
|
10-Oct-2015 |
deraadt |
ksh can run with pledge "stdio rpath wpath cpath getpw fattr proc exec tty" if the mknod builtin is disabled. It looks like a lot of abilities, but hey, this is a shell. can't open sockets or do other nasty stuff though. (we'll leave the mknod builtin enabled on the install media for now; there is work happening to regain the MAKEDEV performance in a different way) discussions with otto & millert in particular
|
#
1.60 |
|
18-Sep-2015 |
nicm |
Last of the (thing *)0 -> NULL, from Michael McConville. No binary change.
|
#
1.59 |
|
17-Sep-2015 |
nicm |
Remove unnecessary casts, from Michael McConville. No binary change.
|
#
1.58 |
|
15-Sep-2015 |
tedu |
correct spelling of NULL from (char *)0. from Michael McConville. ok md5
|
#
1.57 |
|
10-Sep-2015 |
nicm |
Replace newline and space defines by "\n" and " " directly, from Michael McConville. ok millert
|
#
1.56 |
|
01-Sep-2015 |
tedu |
no need to check for null argv anymore. from Martijn van Duren ok deraadt
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.55 |
|
09-Feb-2015 |
jsg |
If we hit multiple errors while unwinding we'll end up running code that assumes a pointer is valid when it has been free'd.
This is convoluted as ksh has it's own allocator and uses long jumps. Set the pointer to NULL after the quitenv() call in unwind() in case we later hit a long jump in unwind().
Found with afl a while back.
ok tedu@ deraadt@
|
Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
|
#
1.54 |
|
28-Nov-2013 |
sobrado |
remove trailing whitespaces; use tabs instead of spaces where appropriate; no binary changes.
|
#
1.53 |
|
04-Sep-2013 |
millert |
Add a proper suspend builtin that saves/restores the tty and pgrp as needed instead of an alias that just sends SIGSTOP. Login shells may be suspended if they are not running in an orphan process group. OK guenther@ jmc@
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.52 |
|
15-Jun-2013 |
millert |
Run any pending traps before calling the EXIT or ERR traps when -e is set. Fixes a bug where we would not run the signal trap if, for example, ^C was pressed and -e was set. OK espie@
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.51 |
|
10-Sep-2012 |
tedu |
fake a sigwinch after each job, so if the terminal changes size, we'll notice and update
|
#
1.50 |
|
06-Sep-2012 |
millert |
Avoid modifying argv when building argv for $* and $@ since it will affect ps output. This can happen when command line options are specified, e.g. "sh -c command". Based on a diff from espie@ OK espie@
|
#
1.49 |
|
05-Sep-2012 |
espie |
backout, Todd's version may be cleaner, but it's also wrong.
|
#
1.48 |
|
05-Sep-2012 |
espie |
sh -c should not munge argv[]. This fixes ps -ww output.
joint work by millert@ and me@.
okay otto@, deraadt@ "feel free to commit my version" millert@
|
Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.47 |
|
07-Sep-2011 |
otto |
beter determination if the shell is restricted; from Alf Schlichting. ok jasper@ millert@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
|
#
1.46 |
|
19-May-2010 |
jasper |
properly keep track of the line number after a trap. this fixes pr 6195. diff from manuel giraud, thanks.
ok kili@
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
|
#
1.45 |
|
29-Jan-2009 |
jaredy |
pass "xerrok" status across the execution call stack to more closely match what both POSIX and ksh.1 already describe in regards to set -e/errexit's behavior in determining when to exit from nonzero return values.
specifically, the truth values tested as operands to `&&' and `||', as well as the resulting compound expression itself, along with the truth value resulting from a negated command (i.e. a pipeline prefixed `!'), should not make the shell exit when -e is in effect.
issue reported by matthieu. testing matthieu, naddy. ok miod (earlier version), otto. man page ok jmc.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.44 |
|
05-Jul-2008 |
djm |
ksh starting as root will refuse to import a PS1 prompt unless it contains a '#' character. Make it also accept the \$ PS1 sequence (which is supposed to automagically be $ or # depending on the user running the shell) unless ksh has been started in sh-compatibility mode.
pointed out by millert@ when I asked why my SUDO_PS1 was not being honoured; ok millert@
|
Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
|
#
1.43 |
|
31-May-2007 |
otto |
Only process ENV when in interactive mode as SU says. Started by tedu to fix make -j, SU thing spotted by naddy@; ok millert@ @tedu jmc@ for the man page bit.
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.42 |
|
02-Nov-2006 |
ray |
Only check if last three letters are "/sh" if string is at least three characters long.
OK moritz@.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.41 |
|
10-Apr-2006 |
jaredy |
fix lint comments, no functional changes; ok ray
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.40 |
|
11-Dec-2005 |
otto |
fix a few name clashes with libc; found by lint. ok deraadt@
|
#
1.39 |
|
11-Dec-2005 |
deraadt |
remove unused variables and functions
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.38 |
|
30-Mar-2005 |
deraadt |
lots of indentation cleanup, now ksh is readable like our other code. double checked to make sure no binaries change, and eyed by niallo
|
#
1.37 |
|
28-Mar-2005 |
deraadt |
if argv[0] not set, do not set it to "pdksh", but to "ksh"
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
21-Feb-2005 |
otto |
Set \u in prompt expansion to the right value, while avoiding getpw* calls, which might be very inconvenient when the yp server is not available.
ok deraadt@ millert@
|
#
1.35 |
|
22-Dec-2004 |
otto |
Fix a use-after-free, that causs core dumps if a shell is killed running with strict malloc.conf options. Problem spotted by hshoexer@; fix by me with some help from millert@.
ok millert@ hshoexer@ krw@ deraadt@
|
#
1.34 |
|
22-Dec-2004 |
millert |
Use stdbool.h instead of rolling our own bools.
|
#
1.33 |
|
20-Dec-2004 |
otto |
Ansification plus some minor knf. No binary change on i386 and sparc64, binary change in lex.o on macppc due to introduction of dopprompt() prototype. ok millert@
|
#
1.32 |
|
18-Dec-2004 |
millert |
deregister
|
#
1.31 |
|
18-Dec-2004 |
millert |
When invoked as sh set SH_VERSION, not KSH_VERSION like the man page says.
|
#
1.30 |
|
18-Dec-2004 |
millert |
Get rid of #ifdef KSH since we don't care about building a V7 style sh and the #ifdef KSH code is required to make a POSIX sh. From Matthias Kilian
|
#
1.29 |
|
18-Dec-2004 |
millert |
Remove unused OS dependent #ifdef blocks, #defines and macro abstraction. First step in making the ksh code easier to read. From Matthias Kilian
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.28 |
|
23-Aug-2004 |
millert |
Don't send SIGINT or SIGTERM to the entire processes group when the shell receives SIGINT/SIGTERM unless the shell is the process group leader. Fixes PR 3820. OK danh@ sturm@ miod@
|
#
1.27 |
|
07-Jun-2004 |
deraadt |
do not push ksh into stupid-random mode; leave it in arc4random() mode. oops. spotted by weerd@weirdnet.nl
|
Revision tags: OPENBSD_3_5_BASE
|
#
1.26 |
|
08-Jan-2004 |
jmc |
typo; from ray at cyth dot net (PR 3632);
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.25 |
|
26-Jun-2003 |
deraadt |
protos
|
#
1.24 |
|
04-Apr-2003 |
deraadt |
two fixes; help from tedu & tdeval
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.23 |
|
10-Mar-2003 |
david |
spelling fixes ok millert@
|
#
1.22 |
|
28-Feb-2003 |
jmc |
typos; from Brian Poole
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.21 |
|
09-Jun-2002 |
todd |
knf
|
Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE
|
#
1.20 |
|
19-Dec-2000 |
markus |
do not reset nonblock if shell is not interactive, from crossd@cs.rpi.edu (i should have commited this about 6 months ago, ok millert@).
|
Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
|
#
1.19 |
|
14-Nov-1999 |
millert |
Better fix for PR #921 (main.c rev 1.18) from the pdksh cvs tree.
|
#
1.18 |
|
14-Nov-1999 |
millert |
Fix a core dump caused by a signal race; yval@hackers.co.il
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.17 |
|
04-Aug-1999 |
millert |
Turn <tab> completion on by default for people used to bash, tcsh, etc...
|
#
1.16 |
|
15-Jul-1999 |
millert |
o Set default line edit mode to emacs (VISUAL/EDITOR or user can override) o Spell environment correctly
|
#
1.15 |
|
15-Jun-1999 |
millert |
patches from pdksh 5.2.13.11
|
#
1.14 |
|
27-Apr-1999 |
millert |
disable newgrp alias since OpenBSD doesn't have a newgrp(1)
|
Revision tags: OPENBSD_2_5_BASE
|
#
1.13 |
|
10-Jan-1999 |
millert |
sync with pdksh-unstable-5.2.13.6
|
#
1.12 |
|
08-Jan-1999 |
millert |
bug fixes from pdksh-unstable-5.2.13.5; some of which we already had.
|
#
1.11 |
|
29-Oct-1998 |
millert |
Bug fixes from pdksh-unstable-5.2.13.4, including "official" versions of some that we had already fixed locally. o typeset -f FUNC doesn't print follows command (and expression) substitutions. o when re-allocating memory, too much may be copied from old memory. o set -o printed some options sans names. o emacs mode: <esc>. in very fist command causes core dump. o pdksh dumps core after a cd command. o typeset -i reports on array elements that have no value (at&t ksh reports on array base name - no index). o ulimit -ctn unlimittttted kills shell (resource exceeded). o ". /dev/null" says access denied. o flag field in aliases incorrectly changed (all flags set instead of clearing ISSET) in exec.c(flushcom). o ${#array[*]} prints largest index instead of number of (set) elements in an array (ksh88 does the former). o sys_siglist[] doesn't always have NSIG non-null entries...
|
Revision tags: OPENBSD_2_4_BASE
|
#
1.10 |
|
25-Jun-1998 |
millert |
pdksh-5.2.13 + local changes
|
Revision tags: OPENBSD_2_3_BASE
|
#
1.9 |
|
12-Sep-1997 |
deraadt |
do not quitenv() too early, or "s" goes away due to it's temporary nature; fix found in freebsd ports tree.. original by ejc@bazzle.com
|
#
1.8 |
|
01-Sep-1997 |
deraadt |
i am bored enough to fix terminal space/tab uglies
|
#
1.7 |
|
19-Jun-1997 |
kstailey |
back out
|
#
1.6 |
|
18-Jun-1997 |
kstailey |
(foo *)0 -> NULL
|
#
1.5 |
|
02-Jan-1997 |
downsj |
Add FSH (set -o sh), initialize it if we're /bin/sh, and add the first use: don't set $_ if we're non-interactive.
|
#
1.4 |
|
21-Nov-1996 |
downsj |
Update to 5.2.12.
|
#
1.3 |
|
01-Oct-1996 |
downsj |
Integrate pdksh 5.2.9.
|
#
1.2 |
|
19-Aug-1996 |
downsj |
update to pdksh-5.2.8
|
#
1.1 |
|
14-Aug-1996 |
downsj |
branches: 1.1.1; Initial revision
|
#
1.89 |
|
16-Jan-2018 |
jca |
Introduce internal_warningf() and mark internal_errorf() as noreturn
This helps tools like scan-build, and follows the example of warningf() and errorf(). ok anton@
|
#
1.88 |
|
15-Jan-2018 |
jca |
Stop pretending we support building ksh without EDIT/HISTORY support
ok anton@
|
#
1.87 |
|
14-Jan-2018 |
anton |
unifdef BRACE_EXPAND; ok jca@
|
#
1.86 |
|
05-Jan-2018 |
jca |
unifdef JOBS support
Prompted by a mail from Klemens Nanni, who also had the same diff. ok deraadt@ millert@
|
#
1.85 |
|
12-Dec-2017 |
tb |
Include hostname in shell prompts by default
With tmux, ssh and vmd, we tend to open shells on many different hosts simultaneously and the default prompts '$ ' and '# ' for {,k}sh as well as '% ' and '# ' for csh become dangerous: it's very easy to issue a command on the wrong host.
This can easily be avoided by displaying the hostname in the prompt. Everything beyond "hostname{$,#,%} " is going to be a matter of taste, so we left it at that. If you use an FQDN, only the first part (the output of 'hostname -s') will be printed.
requested by and ok deraadt; mostly positive feedback many ok anton, brynet, bcallah and others
|
#
1.84 |
|
07-Dec-2017 |
tb |
Drop the unused second argument from set_prompt(). It used to be used for early special casing of ! and !! in the PS1 expansion. This was removed from set_prompt() as part of the implementaion of the character count toggles \[ and \] back in 2004.
ok jca
|
Revision tags: OPENBSD_6_2_BASE
|
#
1.83 |
|
11-Aug-2017 |
guenther |
Retire old behavior of requiring root prompt to contain # or \!
Requested by akoshibe and phessler ok phessler@ anton@ jca@
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.82 |
|
17-Oct-2016 |
schwarze |
No need to inspect LC_CTYPE: * It was only used in vi input mode. * No functional change in case of set -o vi-show8. * No functional change if LC_CTYPE is set to UTF-8. * More robust for the default of LC_CTYPE=C on a UTF-8 xterm.
Behaviour changes for the combination LC_CTYPE=C with set +o vi-show8 on non-UTF-8 terminals, but that combination is useless and dangerous with or without this patch. If you want to edit individual raw non-ASCII non-UTF-8 bytes on the shell command line, always use set -o vi-show8. (Besides, i doubt that you actually want to do that; better use a real hex editor in the first place.)
OK czarkoff@.
|
#
1.81 |
|
11-Oct-2016 |
schwarze |
Partial UTF-8 line editing support for ksh(1) vi input mode; so far, it covers these commands: a h i l x / This is an isu8cont()-based hack similar in style to what i did in emacs input mode, but less elegant and slightly more intrusive because the vi mode code is much more ugly and less straightforward than the emacs mode code. This one required partial rewrites of a few helper functions, and comments were added while there.
This is not perfect, but hopefully reduces people's cursing until a more rigorous solution can be devised (much) later. Some polishing may be useful in tree, in particular adding utf8cont() support to a few missing commands.
Mostly written shortly after Christmas 2015. Reminded by and OK czarkoff@. Feedback, partial review and testing, no longer any objection by martijn@. Feedback and testing by tb@. Also read fine to nicm@.
|
#
1.80 |
|
08-Sep-2016 |
millert |
Mark PPID read-only as per the manual. From Anthony Coulter.
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.79 |
|
04-Mar-2016 |
deraadt |
remove CSRG BSD-licensed mknod builtin code which was previously used to accelerate install/upgrade time MAKEDEV runs. That allows ramdisk ksh to be pledged, without needing "dpath". We'll solve the performance issues a different way (soon). ok otto espie natano tb tobiasu rpe
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.78 |
|
30-Dec-2015 |
tedu |
rename global "e" to genv to avoid accidental shadowing and aliasing. ok millert nicm tb
|
#
1.77 |
|
27-Dec-2015 |
jca |
Tweak comment: we now always make a copy of argv.
ok halex@
|
#
1.76 |
|
27-Dec-2015 |
halex |
unconditionally duplicate the argv array on initialization, to make it resilient against being altered by a subsequent shift operation
tweak and ok semarie@
|
#
1.75 |
|
14-Dec-2015 |
tb |
Move system headers from sh.h to those files that actually need them.
ok mmcc@ a while ago
|
#
1.74 |
|
11-Nov-2015 |
deraadt |
exit() after perror() for pledge failure. Perhaps this got introduced as a test idiom, either when pledge was young or during the transition to strings.... dunno
|
#
1.73 |
|
01-Nov-2015 |
mmcc |
Add uses of areallocarray(). mksh and Bitrig ksh already have similar functions. With help from Theo Buehler.
ok nicm@
|
#
1.72 |
|
30-Oct-2015 |
guenther |
'fc -e -' is deprecated in favor of 'fc -s', so update the built-in alias
ok millert@
|
#
1.71 |
|
22-Oct-2015 |
mmcc |
Final removal of EXTERN.
ok nicm@
|
#
1.70 |
|
21-Oct-2015 |
mmcc |
Penultimate commit to remove EXTERN.
ok nicm@
|
#
1.69 |
|
19-Oct-2015 |
mmcc |
Move string.h include from sh.h to the files that use it.
ok nicm@
|
#
1.68 |
|
19-Oct-2015 |
mmcc |
More removal of EXTERN.
ok nicm@
|
#
1.67 |
|
19-Oct-2015 |
mmcc |
Apply style(9) to header includes.
ok nicm@
|
#
1.66 |
|
18-Oct-2015 |
mmcc |
Move more EXTERN-defined globals from sh.h.
ok nicm@
|
#
1.65 |
|
17-Oct-2015 |
mmcc |
Move a system header include from the global header (sh.h) into the files that need it. No binary change.
"This looks fine" -nicm@
|
#
1.64 |
|
16-Oct-2015 |
deraadt |
wrap a long line
|
#
1.63 |
|
16-Oct-2015 |
millert |
Implement real "flock" request and add it to userland programs that use pledge and file locking. OK deraadt@
|
#
1.62 |
|
10-Oct-2015 |
deraadt |
normalize a few more tame request orderings, to help review
|
#
1.61 |
|
10-Oct-2015 |
deraadt |
ksh can run with pledge "stdio rpath wpath cpath getpw fattr proc exec tty" if the mknod builtin is disabled. It looks like a lot of abilities, but hey, this is a shell. can't open sockets or do other nasty stuff though. (we'll leave the mknod builtin enabled on the install media for now; there is work happening to regain the MAKEDEV performance in a different way) discussions with otto & millert in particular
|
#
1.60 |
|
18-Sep-2015 |
nicm |
Last of the (thing *)0 -> NULL, from Michael McConville. No binary change.
|
#
1.59 |
|
17-Sep-2015 |
nicm |
Remove unnecessary casts, from Michael McConville. No binary change.
|
#
1.58 |
|
15-Sep-2015 |
tedu |
correct spelling of NULL from (char *)0. from Michael McConville. ok md5
|
#
1.57 |
|
10-Sep-2015 |
nicm |
Replace newline and space defines by "\n" and " " directly, from Michael McConville. ok millert
|
#
1.56 |
|
01-Sep-2015 |
tedu |
no need to check for null argv anymore. from Martijn van Duren ok deraadt
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.55 |
|
09-Feb-2015 |
jsg |
If we hit multiple errors while unwinding we'll end up running code that assumes a pointer is valid when it has been free'd.
This is convoluted as ksh has it's own allocator and uses long jumps. Set the pointer to NULL after the quitenv() call in unwind() in case we later hit a long jump in unwind().
Found with afl a while back.
ok tedu@ deraadt@
|
Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
|
#
1.54 |
|
28-Nov-2013 |
sobrado |
remove trailing whitespaces; use tabs instead of spaces where appropriate; no binary changes.
|
#
1.53 |
|
04-Sep-2013 |
millert |
Add a proper suspend builtin that saves/restores the tty and pgrp as needed instead of an alias that just sends SIGSTOP. Login shells may be suspended if they are not running in an orphan process group. OK guenther@ jmc@
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.52 |
|
15-Jun-2013 |
millert |
Run any pending traps before calling the EXIT or ERR traps when -e is set. Fixes a bug where we would not run the signal trap if, for example, ^C was pressed and -e was set. OK espie@
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.51 |
|
10-Sep-2012 |
tedu |
fake a sigwinch after each job, so if the terminal changes size, we'll notice and update
|
#
1.50 |
|
06-Sep-2012 |
millert |
Avoid modifying argv when building argv for $* and $@ since it will affect ps output. This can happen when command line options are specified, e.g. "sh -c command". Based on a diff from espie@ OK espie@
|
#
1.49 |
|
05-Sep-2012 |
espie |
backout, Todd's version may be cleaner, but it's also wrong.
|
#
1.48 |
|
05-Sep-2012 |
espie |
sh -c should not munge argv[]. This fixes ps -ww output.
joint work by millert@ and me@.
okay otto@, deraadt@ "feel free to commit my version" millert@
|
Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.47 |
|
07-Sep-2011 |
otto |
beter determination if the shell is restricted; from Alf Schlichting. ok jasper@ millert@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
|
#
1.46 |
|
19-May-2010 |
jasper |
properly keep track of the line number after a trap. this fixes pr 6195. diff from manuel giraud, thanks.
ok kili@
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
|
#
1.45 |
|
29-Jan-2009 |
jaredy |
pass "xerrok" status across the execution call stack to more closely match what both POSIX and ksh.1 already describe in regards to set -e/errexit's behavior in determining when to exit from nonzero return values.
specifically, the truth values tested as operands to `&&' and `||', as well as the resulting compound expression itself, along with the truth value resulting from a negated command (i.e. a pipeline prefixed `!'), should not make the shell exit when -e is in effect.
issue reported by matthieu. testing matthieu, naddy. ok miod (earlier version), otto. man page ok jmc.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.44 |
|
05-Jul-2008 |
djm |
ksh starting as root will refuse to import a PS1 prompt unless it contains a '#' character. Make it also accept the \$ PS1 sequence (which is supposed to automagically be $ or # depending on the user running the shell) unless ksh has been started in sh-compatibility mode.
pointed out by millert@ when I asked why my SUDO_PS1 was not being honoured; ok millert@
|
Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
|
#
1.43 |
|
31-May-2007 |
otto |
Only process ENV when in interactive mode as SU says. Started by tedu to fix make -j, SU thing spotted by naddy@; ok millert@ @tedu jmc@ for the man page bit.
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.42 |
|
02-Nov-2006 |
ray |
Only check if last three letters are "/sh" if string is at least three characters long.
OK moritz@.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.41 |
|
10-Apr-2006 |
jaredy |
fix lint comments, no functional changes; ok ray
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.40 |
|
11-Dec-2005 |
otto |
fix a few name clashes with libc; found by lint. ok deraadt@
|
#
1.39 |
|
11-Dec-2005 |
deraadt |
remove unused variables and functions
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.38 |
|
30-Mar-2005 |
deraadt |
lots of indentation cleanup, now ksh is readable like our other code. double checked to make sure no binaries change, and eyed by niallo
|
#
1.37 |
|
28-Mar-2005 |
deraadt |
if argv[0] not set, do not set it to "pdksh", but to "ksh"
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
21-Feb-2005 |
otto |
Set \u in prompt expansion to the right value, while avoiding getpw* calls, which might be very inconvenient when the yp server is not available.
ok deraadt@ millert@
|
#
1.35 |
|
22-Dec-2004 |
otto |
Fix a use-after-free, that causs core dumps if a shell is killed running with strict malloc.conf options. Problem spotted by hshoexer@; fix by me with some help from millert@.
ok millert@ hshoexer@ krw@ deraadt@
|
#
1.34 |
|
22-Dec-2004 |
millert |
Use stdbool.h instead of rolling our own bools.
|
#
1.33 |
|
20-Dec-2004 |
otto |
Ansification plus some minor knf. No binary change on i386 and sparc64, binary change in lex.o on macppc due to introduction of dopprompt() prototype. ok millert@
|
#
1.32 |
|
18-Dec-2004 |
millert |
deregister
|
#
1.31 |
|
18-Dec-2004 |
millert |
When invoked as sh set SH_VERSION, not KSH_VERSION like the man page says.
|
#
1.30 |
|
18-Dec-2004 |
millert |
Get rid of #ifdef KSH since we don't care about building a V7 style sh and the #ifdef KSH code is required to make a POSIX sh. From Matthias Kilian
|
#
1.29 |
|
18-Dec-2004 |
millert |
Remove unused OS dependent #ifdef blocks, #defines and macro abstraction. First step in making the ksh code easier to read. From Matthias Kilian
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.28 |
|
23-Aug-2004 |
millert |
Don't send SIGINT or SIGTERM to the entire processes group when the shell receives SIGINT/SIGTERM unless the shell is the process group leader. Fixes PR 3820. OK danh@ sturm@ miod@
|
#
1.27 |
|
07-Jun-2004 |
deraadt |
do not push ksh into stupid-random mode; leave it in arc4random() mode. oops. spotted by weerd@weirdnet.nl
|
Revision tags: OPENBSD_3_5_BASE
|
#
1.26 |
|
08-Jan-2004 |
jmc |
typo; from ray at cyth dot net (PR 3632);
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.25 |
|
26-Jun-2003 |
deraadt |
protos
|
#
1.24 |
|
04-Apr-2003 |
deraadt |
two fixes; help from tedu & tdeval
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.23 |
|
10-Mar-2003 |
david |
spelling fixes ok millert@
|
#
1.22 |
|
28-Feb-2003 |
jmc |
typos; from Brian Poole
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.21 |
|
09-Jun-2002 |
todd |
knf
|
Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE
|
#
1.20 |
|
19-Dec-2000 |
markus |
do not reset nonblock if shell is not interactive, from crossd@cs.rpi.edu (i should have commited this about 6 months ago, ok millert@).
|
Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
|
#
1.19 |
|
14-Nov-1999 |
millert |
Better fix for PR #921 (main.c rev 1.18) from the pdksh cvs tree.
|
#
1.18 |
|
14-Nov-1999 |
millert |
Fix a core dump caused by a signal race; yval@hackers.co.il
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.17 |
|
04-Aug-1999 |
millert |
Turn <tab> completion on by default for people used to bash, tcsh, etc...
|
#
1.16 |
|
15-Jul-1999 |
millert |
o Set default line edit mode to emacs (VISUAL/EDITOR or user can override) o Spell environment correctly
|
#
1.15 |
|
15-Jun-1999 |
millert |
patches from pdksh 5.2.13.11
|
#
1.14 |
|
27-Apr-1999 |
millert |
disable newgrp alias since OpenBSD doesn't have a newgrp(1)
|
Revision tags: OPENBSD_2_5_BASE
|
#
1.13 |
|
10-Jan-1999 |
millert |
sync with pdksh-unstable-5.2.13.6
|
#
1.12 |
|
08-Jan-1999 |
millert |
bug fixes from pdksh-unstable-5.2.13.5; some of which we already had.
|
#
1.11 |
|
29-Oct-1998 |
millert |
Bug fixes from pdksh-unstable-5.2.13.4, including "official" versions of some that we had already fixed locally. o typeset -f FUNC doesn't print follows command (and expression) substitutions. o when re-allocating memory, too much may be copied from old memory. o set -o printed some options sans names. o emacs mode: <esc>. in very fist command causes core dump. o pdksh dumps core after a cd command. o typeset -i reports on array elements that have no value (at&t ksh reports on array base name - no index). o ulimit -ctn unlimittttted kills shell (resource exceeded). o ". /dev/null" says access denied. o flag field in aliases incorrectly changed (all flags set instead of clearing ISSET) in exec.c(flushcom). o ${#array[*]} prints largest index instead of number of (set) elements in an array (ksh88 does the former). o sys_siglist[] doesn't always have NSIG non-null entries...
|
Revision tags: OPENBSD_2_4_BASE
|
#
1.10 |
|
25-Jun-1998 |
millert |
pdksh-5.2.13 + local changes
|
Revision tags: OPENBSD_2_3_BASE
|
#
1.9 |
|
12-Sep-1997 |
deraadt |
do not quitenv() too early, or "s" goes away due to it's temporary nature; fix found in freebsd ports tree.. original by ejc@bazzle.com
|
#
1.8 |
|
01-Sep-1997 |
deraadt |
i am bored enough to fix terminal space/tab uglies
|
#
1.7 |
|
19-Jun-1997 |
kstailey |
back out
|
#
1.6 |
|
18-Jun-1997 |
kstailey |
(foo *)0 -> NULL
|
#
1.5 |
|
02-Jan-1997 |
downsj |
Add FSH (set -o sh), initialize it if we're /bin/sh, and add the first use: don't set $_ if we're non-interactive.
|
#
1.4 |
|
21-Nov-1996 |
downsj |
Update to 5.2.12.
|
#
1.3 |
|
01-Oct-1996 |
downsj |
Integrate pdksh 5.2.9.
|
#
1.2 |
|
19-Aug-1996 |
downsj |
update to pdksh-5.2.8
|
#
1.1 |
|
14-Aug-1996 |
downsj |
branches: 1.1.1; Initial revision
|