OpenBSD CVS

CVS log for src/bin/ksh/main.c


[BACK] Up to [local] / src / bin / ksh

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.100 / (download) - annotate - [select for diffs], Sun Jul 23 23:42:03 2023 UTC (10 months, 2 weeks ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.99: +7 -1 lines
Diff to previous 1.99 (colored)

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 1.99 / (download) - annotate - [select for diffs], Wed Feb 8 17:22:10 2023 UTC (16 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.98: +9 -1 lines
Diff to previous 1.98 (colored)

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 1.98 / (download) - annotate - [select for diffs], Fri Jun 28 13:34:59 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.97: +2 -2 lines
Diff to previous 1.97 (colored)

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 1.97 / (download) - annotate - [select for diffs], Wed Feb 20 23:59:17 2019 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.96: +2 -1 lines
Diff to previous 1.96 (colored)

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@

Revision 1.96 / (download) - annotate - [select for diffs], Tue Nov 20 07:02:23 2018 UTC (5 years, 6 months ago) by martijn
Branch: MAIN
Changes since 1.95: +2 -1 lines
Diff to previous 1.95 (colored)

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@

Revision 1.95 / (download) - annotate - [select for diffs], Sat Nov 17 18:14:58 2018 UTC (5 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.94: +11 -10 lines
Diff to previous 1.94 (colored)

Use a very regular call pattern to pledge, so that we can continue to
grep and compare the use in all programs..

Revision 1.94 / (download) - annotate - [select for diffs], Fri Nov 16 06:41:58 2018 UTC (5 years, 6 months ago) by nicm
Branch: MAIN
Changes since 1.93: +10 -3 lines
Diff to previous 1.93 (colored)

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 1.93 / (download) - annotate - [select for diffs], Sat Sep 29 14:13:19 2018 UTC (5 years, 8 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.92: +2 -2 lines
Diff to previous 1.92 (colored)

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@

Revision 1.92 / (download) - annotate - [select for diffs], Fri May 18 13:25:20 2018 UTC (6 years ago) by benno
Branch: MAIN
Changes since 1.91: +1 -2 lines
Diff to previous 1.91 (colored)

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@

Revision 1.91 / (download) - annotate - [select for diffs], Mon Apr 9 17:53:36 2018 UTC (6 years, 2 months ago) by tobias
Branch: MAIN
Changes since 1.90: +2 -2 lines
Diff to previous 1.90 (colored)

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 1.90 / (download) - annotate - [select for diffs], Thu Mar 15 16:51:29 2018 UTC (6 years, 2 months ago) by anton
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.89: +3 -3 lines
Diff to previous 1.89 (colored)

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@

Revision 1.89 / (download) - annotate - [select for diffs], Tue Jan 16 22:52:32 2018 UTC (6 years, 4 months ago) by jca
Branch: MAIN
Changes since 1.88: +3 -3 lines
Diff to previous 1.88 (colored)

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@

Revision 1.88 / (download) - annotate - [select for diffs], Mon Jan 15 14:58:05 2018 UTC (6 years, 4 months ago) by jca
Branch: MAIN
Changes since 1.87: +5 -11 lines
Diff to previous 1.87 (colored)

Stop pretending we support building ksh without EDIT/HISTORY support

ok anton@

Revision 1.87 / (download) - annotate - [select for diffs], Sun Jan 14 16:04:21 2018 UTC (6 years, 4 months ago) by anton
Branch: MAIN
Changes since 1.86: +1 -3 lines
Diff to previous 1.86 (colored)

unifdef BRACE_EXPAND; ok jca@

Revision 1.86 / (download) - annotate - [select for diffs], Fri Jan 5 15:44:31 2018 UTC (6 years, 5 months ago) by jca
Branch: MAIN
Changes since 1.85: +1 -3 lines
Diff to previous 1.85 (colored)

unifdef JOBS support

Prompted by a mail from Klemens Nanni, who also had the same diff.
ok deraadt@ millert@

Revision 1.85 / (download) - annotate - [select for diffs], Tue Dec 12 00:18:58 2017 UTC (6 years, 6 months ago) by tb
Branch: MAIN
Changes since 1.84: +2 -2 lines
Diff to previous 1.84 (colored)

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

Revision 1.84 / (download) - annotate - [select for diffs], Thu Dec 7 01:54:33 2017 UTC (6 years, 6 months ago) by tb
Branch: MAIN
Changes since 1.83: +2 -2 lines
Diff to previous 1.83 (colored)

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 1.83 / (download) - annotate - [select for diffs], Fri Aug 11 23:10:55 2017 UTC (6 years, 10 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.82: +4 -7 lines
Diff to previous 1.82 (colored)

Retire old behavior of requiring root prompt to contain # or \!

Requested by akoshibe and phessler
ok phessler@ anton@ jca@

Revision 1.82 / (download) - annotate - [select for diffs], Mon Oct 17 17:44:47 2016 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.81: +1 -4 lines
Diff to previous 1.81 (colored)

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@.

Revision 1.81 / (download) - annotate - [select for diffs], Tue Oct 11 19:52:54 2016 UTC (7 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.80: +4 -1 lines
Diff to previous 1.80 (colored)

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@.

Revision 1.80 / (download) - annotate - [select for diffs], Thu Sep 8 15:51:54 2016 UTC (7 years, 9 months ago) by millert
Branch: MAIN
Changes since 1.79: +2 -2 lines
Diff to previous 1.79 (colored)

Mark PPID read-only as per the manual.  From Anthony Coulter.

Revision 1.79 / (download) - annotate - [select for diffs], Fri Mar 4 15:11:06 2016 UTC (8 years, 3 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.78: +1 -3 lines
Diff to previous 1.78 (colored)

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 1.78 / (download) - annotate - [select for diffs], Wed Dec 30 09:07:00 2015 UTC (8 years, 5 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.77: +28 -28 lines
Diff to previous 1.77 (colored)

rename global "e" to genv to avoid accidental shadowing and aliasing.
ok millert nicm tb

Revision 1.77 / (download) - annotate - [select for diffs], Sun Dec 27 19:33:26 2015 UTC (8 years, 5 months ago) by jca
Branch: MAIN
Changes since 1.76: +3 -3 lines
Diff to previous 1.76 (colored)

Tweak comment: we now always make a copy of argv.

ok halex@

Revision 1.76 / (download) - annotate - [select for diffs], Sun Dec 27 09:24:00 2015 UTC (8 years, 5 months ago) by halex
Branch: MAIN
Changes since 1.75: +7 -9 lines
Diff to previous 1.75 (colored)

unconditionally duplicate the argv array on initialization, to make it
resilient against being altered by a subsequent shift operation

tweak and ok semarie@

Revision 1.75 / (download) - annotate - [select for diffs], Mon Dec 14 13:59:42 2015 UTC (8 years, 5 months ago) by tb
Branch: MAIN
Changes since 1.74: +6 -1 lines
Diff to previous 1.74 (colored)

Move system headers from sh.h to those files that actually need them.

ok mmcc@ a while ago

Revision 1.74 / (download) - annotate - [select for diffs], Wed Nov 11 02:52:46 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.73: +4 -2 lines
Diff to previous 1.73 (colored)

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

Revision 1.73 / (download) - annotate - [select for diffs], Sun Nov 1 15:38:53 2015 UTC (8 years, 7 months ago) by mmcc
Branch: MAIN
Changes since 1.72: +2 -2 lines
Diff to previous 1.72 (colored)

Add uses of areallocarray(). mksh and Bitrig ksh already have similar
functions. With help from Theo Buehler.

ok nicm@

Revision 1.72 / (download) - annotate - [select for diffs], Fri Oct 30 03:13:52 2015 UTC (8 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.71: +2 -2 lines
Diff to previous 1.71 (colored)

'fc -e -' is deprecated in favor of 'fc -s', so update the built-in alias

ok millert@

Revision 1.71 / (download) - annotate - [select for diffs], Thu Oct 22 15:37:04 2015 UTC (8 years, 7 months ago) by mmcc
Branch: MAIN
Changes since 1.70: +14 -3 lines
Diff to previous 1.70 (colored)

Final removal of EXTERN.

ok nicm@

Revision 1.70 / (download) - annotate - [select for diffs], Wed Oct 21 14:30:43 2015 UTC (8 years, 7 months ago) by mmcc
Branch: MAIN
Changes since 1.69: +19 -1 lines
Diff to previous 1.69 (colored)

Penultimate commit to remove EXTERN.

ok nicm@

Revision 1.69 / (download) - annotate - [select for diffs], Mon Oct 19 14:42:16 2015 UTC (8 years, 7 months ago) by mmcc
Branch: MAIN
Changes since 1.68: +2 -1 lines
Diff to previous 1.68 (colored)

Move string.h include from sh.h to the files that use it.

ok nicm@

Revision 1.68 / (download) - annotate - [select for diffs], Mon Oct 19 14:01:37 2015 UTC (8 years, 7 months ago) by mmcc
Branch: MAIN
Changes since 1.67: +7 -1 lines
Diff to previous 1.67 (colored)

More removal of EXTERN.

ok nicm@

Revision 1.67 / (download) - annotate - [select for diffs], Mon Oct 19 02:15:45 2015 UTC (8 years, 7 months ago) by mmcc
Branch: MAIN
Changes since 1.66: +5 -3 lines
Diff to previous 1.66 (colored)

Apply style(9) to header includes.

ok nicm@

Revision 1.66 / (download) - annotate - [select for diffs], Sun Oct 18 18:05:35 2015 UTC (8 years, 7 months ago) by mmcc
Branch: MAIN
Changes since 1.65: +9 -1 lines
Diff to previous 1.65 (colored)

Move more EXTERN-defined globals from sh.h.

ok nicm@

Revision 1.65 / (download) - annotate - [select for diffs], Sat Oct 17 18:26:24 2015 UTC (8 years, 7 months ago) by mmcc
Branch: MAIN
Changes since 1.64: +2 -1 lines
Diff to previous 1.64 (colored)

Move a system header include from the global header (sh.h) into the
files that need it. No binary change.

"This looks fine" -nicm@

Revision 1.64 / (download) - annotate - [select for diffs], Fri Oct 16 14:45:16 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.63: +3 -2 lines
Diff to previous 1.63 (colored)

wrap a long line

Revision 1.63 / (download) - annotate - [select for diffs], Fri Oct 16 13:37:43 2015 UTC (8 years, 7 months ago) by millert
Branch: MAIN
Changes since 1.62: +2 -2 lines
Diff to previous 1.62 (colored)

Implement real "flock" request and add it to userland programs that
use pledge and file locking.  OK deraadt@

Revision 1.62 / (download) - annotate - [select for diffs], Sat Oct 10 20:35:00 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.61: +2 -2 lines
Diff to previous 1.61 (colored)

normalize a few more tame request orderings, to help review

Revision 1.61 / (download) - annotate - [select for diffs], Sat Oct 10 00:10:07 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.60: +6 -1 lines
Diff to previous 1.60 (colored)

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

Revision 1.60 / (download) - annotate - [select for diffs], Fri Sep 18 07:28:24 2015 UTC (8 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.59: +10 -12 lines
Diff to previous 1.59 (colored)

Last of the (thing *)0 -> NULL, from Michael McConville. No binary
change.

Revision 1.59 / (download) - annotate - [select for diffs], Thu Sep 17 14:21:33 2015 UTC (8 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.58: +2 -2 lines
Diff to previous 1.58 (colored)

Remove unnecessary casts, from Michael McConville. No binary change.

Revision 1.58 / (download) - annotate - [select for diffs], Tue Sep 15 18:15:05 2015 UTC (8 years, 8 months ago) by tedu
Branch: MAIN
Changes since 1.57: +5 -5 lines
Diff to previous 1.57 (colored)

correct spelling of NULL from (char *)0. from Michael McConville.
ok md5

Revision 1.57 / (download) - annotate - [select for diffs], Thu Sep 10 22:48:58 2015 UTC (8 years, 9 months ago) by nicm
Branch: MAIN
Changes since 1.56: +2 -2 lines
Diff to previous 1.56 (colored)

Replace newline and space defines by "\n" and " " directly, from Michael
McConville. ok millert

Revision 1.56 / (download) - annotate - [select for diffs], Tue Sep 1 17:46:31 2015 UTC (8 years, 9 months ago) by tedu
Branch: MAIN
Changes since 1.55: +2 -11 lines
Diff to previous 1.55 (colored)

no need to check for null argv anymore. from Martijn van Duren
ok deraadt

Revision 1.55 / (download) - annotate - [select for diffs], Mon Feb 9 09:09:30 2015 UTC (9 years, 4 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.54: +8 -1 lines
Diff to previous 1.54 (colored)

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 1.54 / (download) - annotate - [select for diffs], Thu Nov 28 10:33:37 2013 UTC (10 years, 6 months ago) by sobrado
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.53: +2 -2 lines
Diff to previous 1.53 (colored)

remove trailing whitespaces; use tabs instead of spaces where appropriate;
no binary changes.

Revision 1.53 / (download) - annotate - [select for diffs], Wed Sep 4 15:49:19 2013 UTC (10 years, 9 months ago) by millert
Branch: MAIN
Changes since 1.52: +1 -2 lines
Diff to previous 1.52 (colored)

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 1.52 / (download) - annotate - [select for diffs], Sat Jun 15 17:25:19 2013 UTC (10 years, 11 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.51: +5 -1 lines
Diff to previous 1.51 (colored)

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 1.51 / (download) - annotate - [select for diffs], Mon Sep 10 01:25:30 2012 UTC (11 years, 9 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.50: +2 -1 lines
Diff to previous 1.50 (colored)

fake a sigwinch after each job, so if the terminal changes size,
we'll notice and update

Revision 1.50 / (download) - annotate - [select for diffs], Thu Sep 6 18:04:34 2012 UTC (11 years, 9 months ago) by millert
Branch: MAIN
Changes since 1.49: +24 -3 lines
Diff to previous 1.49 (colored)

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@

Revision 1.49 / (download) - annotate - [select for diffs], Wed Sep 5 22:20:25 2012 UTC (11 years, 9 months ago) by espie
Branch: MAIN
Changes since 1.48: +2 -18 lines
Diff to previous 1.48 (colored)

backout, Todd's version may be cleaner, but it's also wrong.

Revision 1.48 / (download) - annotate - [select for diffs], Wed Sep 5 22:15:29 2012 UTC (11 years, 9 months ago) by espie
Branch: MAIN
Changes since 1.47: +19 -3 lines
Diff to previous 1.47 (colored)

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 1.47 / (download) - annotate - [select for diffs], Wed Sep 7 11:33:25 2011 UTC (12 years, 9 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.46: +11 -4 lines
Diff to previous 1.46 (colored)

beter determination if the shell is restricted; from Alf Schlichting.
ok jasper@ millert@

Revision 1.46 / (download) - annotate - [select for diffs], Wed May 19 17:36:08 2010 UTC (14 years ago) by jasper
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.45: +7 -2 lines
Diff to previous 1.45 (colored)

properly keep track of the line number after a trap.
this fixes pr 6195. diff from manuel giraud, thanks.

ok kili@

Revision 1.45 / (download) - annotate - [select for diffs], Thu Jan 29 23:27:26 2009 UTC (15 years, 4 months ago) by jaredy
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.44: +2 -2 lines
Diff to previous 1.44 (colored)

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 1.44 / (download) - annotate - [select for diffs], Sat Jul 5 07:25:18 2008 UTC (15 years, 11 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.43: +4 -3 lines
Diff to previous 1.43 (colored)

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 1.43 / (download) - annotate - [select for diffs], Thu May 31 20:47:44 2007 UTC (17 years ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored)

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 1.42 / (download) - annotate - [select for diffs], Thu Nov 2 18:21:20 2006 UTC (17 years, 7 months ago) by ray
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.41: +4 -3 lines
Diff to previous 1.41 (colored)

Only check if last three letters are "/sh" if string is at least
three characters long.

OK moritz@.

Revision 1.41 / (download) - annotate - [select for diffs], Mon Apr 10 14:38:59 2006 UTC (18 years, 2 months ago) by jaredy
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.40: +9 -9 lines
Diff to previous 1.40 (colored)

fix lint comments, no functional changes; ok ray

Revision 1.40 / (download) - annotate - [select for diffs], Sun Dec 11 20:31:21 2005 UTC (18 years, 6 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.39: +5 -5 lines
Diff to previous 1.39 (colored)

fix a few name clashes with libc; found by lint. ok deraadt@

Revision 1.39 / (download) - annotate - [select for diffs], Sun Dec 11 18:53:51 2005 UTC (18 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.38: +1 -9 lines
Diff to previous 1.38 (colored)

remove unused variables and functions

Revision 1.38 / (download) - annotate - [select for diffs], Wed Mar 30 17:16:37 2005 UTC (19 years, 2 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.37: +45 -47 lines
Diff to previous 1.37 (colored)

lots of indentation cleanup, now ksh is readable like our other code.
double checked to make sure no binaries change, and eyed by niallo

Revision 1.37 / (download) - annotate - [select for diffs], Mon Mar 28 21:33:01 2005 UTC (19 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.36: +4 -4 lines
Diff to previous 1.36 (colored)

if argv[0] not set, do not set it to "pdksh", but to "ksh"

Revision 1.36 / (download) - annotate - [select for diffs], Mon Feb 21 16:01:58 2005 UTC (19 years, 3 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.35: +20 -1 lines
Diff to previous 1.35 (colored)

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@

Revision 1.35 / (download) - annotate - [select for diffs], Wed Dec 22 18:57:28 2004 UTC (19 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.34: +14 -12 lines
Diff to previous 1.34 (colored)

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@

Revision 1.34 / (download) - annotate - [select for diffs], Wed Dec 22 17:14:34 2004 UTC (19 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.33: +5 -5 lines
Diff to previous 1.33 (colored)

Use stdbool.h instead of rolling our own bools.

Revision 1.33 / (download) - annotate - [select for diffs], Mon Dec 20 11:34:26 2004 UTC (19 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.32: +13 -26 lines
Diff to previous 1.32 (colored)

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@

Revision 1.32 / (download) - annotate - [select for diffs], Sat Dec 18 21:25:44 2004 UTC (19 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.31: +7 -7 lines
Diff to previous 1.31 (colored)

deregister

Revision 1.31 / (download) - annotate - [select for diffs], Sat Dec 18 21:08:44 2004 UTC (19 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.30: +8 -6 lines
Diff to previous 1.30 (colored)

When invoked as sh set SH_VERSION, not KSH_VERSION like the man page says.

Revision 1.30 / (download) - annotate - [select for diffs], Sat Dec 18 21:04:52 2004 UTC (19 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.29: +4 -27 lines
Diff to previous 1.29 (colored)

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

Revision 1.29 / (download) - annotate - [select for diffs], Sat Dec 18 20:55:52 2004 UTC (19 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.28: +11 -103 lines
Diff to previous 1.28 (colored)

Remove unused OS dependent #ifdef blocks, #defines and macro abstraction.
First step in making the ksh code easier to read.  From Matthias Kilian

Revision 1.28 / (download) - annotate - [select for diffs], Mon Aug 23 14:56:32 2004 UTC (19 years, 9 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.27: +3 -2 lines
Diff to previous 1.27 (colored)

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@

Revision 1.27 / (download) - annotate - [select for diffs], Mon Jun 7 23:20:46 2004 UTC (20 years ago) by deraadt
Branch: MAIN
Changes since 1.26: +2 -2 lines
Diff to previous 1.26 (colored)

do not push ksh into stupid-random mode; leave it in arc4random() mode.
oops.  spotted by weerd@weirdnet.nl

Revision 1.26 / (download) - annotate - [select for diffs], Thu Jan 8 05:43:14 2004 UTC (20 years, 5 months ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

typo; from ray at cyth dot net (PR 3632);

Revision 1.25 / (download) - annotate - [select for diffs], Thu Jun 26 00:09:45 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.24: +2 -4 lines
Diff to previous 1.24 (colored)

protos

Revision 1.24 / (download) - annotate - [select for diffs], Fri Apr 4 23:12:02 2003 UTC (21 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored)

two fixes; help from tedu & tdeval

Revision 1.23 / (download) - annotate - [select for diffs], Mon Mar 10 03:48:16 2003 UTC (21 years, 3 months ago) by david
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored)

spelling fixes
ok millert@

Revision 1.22 / (download) - annotate - [select for diffs], Fri Feb 28 09:45:09 2003 UTC (21 years, 3 months ago) by jmc
Branch: MAIN
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

typos; from Brian Poole

Revision 1.21 / (download) - annotate - [select for diffs], Sun Jun 9 05:47:27 2002 UTC (22 years ago) by todd
Branch: MAIN
CVS Tags: OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.20: +2 -2 lines
Diff to previous 1.20 (colored)

knf

Revision 1.20 / (download) - annotate - [select for diffs], Tue Dec 19 21:48:54 2000 UTC (23 years, 5 months ago) by markus
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1, OPENBSD_3_0_BASE, OPENBSD_3_0, OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.19: +3 -2 lines
Diff to previous 1.19 (colored)

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 1.19 / (download) - annotate - [select for diffs], Sun Nov 14 18:18:39 1999 UTC (24 years, 7 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.18: +8 -12 lines
Diff to previous 1.18 (colored)

Better fix for PR #921 (main.c rev 1.18) from the pdksh cvs tree.

Revision 1.18 / (download) - annotate - [select for diffs], Sun Nov 14 17:56:47 1999 UTC (24 years, 7 months ago) by millert
Branch: MAIN
Changes since 1.17: +7 -2 lines
Diff to previous 1.17 (colored)

Fix a core dump caused by a signal race; yval@hackers.co.il

Revision 1.17 / (download) - annotate - [select for diffs], Wed Aug 4 19:11:13 1999 UTC (24 years, 10 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6
Changes since 1.16: +6 -2 lines
Diff to previous 1.16 (colored)

Turn <tab> completion on by default for people used to bash, tcsh, etc...

Revision 1.16 / (download) - annotate - [select for diffs], Thu Jul 15 20:39:40 1999 UTC (24 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.15: +10 -4 lines
Diff to previous 1.15 (colored)

o Set default line edit mode to emacs (VISUAL/EDITOR or user can override)
o Spell environment correctly

Revision 1.15 / (download) - annotate - [select for diffs], Tue Jun 15 01:18:35 1999 UTC (25 years ago) by millert
Branch: MAIN
Changes since 1.14: +52 -58 lines
Diff to previous 1.14 (colored)

patches from pdksh 5.2.13.11

Revision 1.14 / (download) - annotate - [select for diffs], Tue Apr 27 18:18:19 1999 UTC (25 years, 1 month ago) by millert
Branch: MAIN
Changes since 1.13: +3 -1 lines
Diff to previous 1.13 (colored)

disable newgrp alias since OpenBSD doesn't have a newgrp(1)

Revision 1.13 / (download) - annotate - [select for diffs], Sun Jan 10 17:55:03 1999 UTC (25 years, 5 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5
Changes since 1.12: +7 -2 lines
Diff to previous 1.12 (colored)

sync with pdksh-unstable-5.2.13.6

Revision 1.12 / (download) - annotate - [select for diffs], Fri Jan 8 20:25:00 1999 UTC (25 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.11: +18 -6 lines
Diff to previous 1.11 (colored)

bug fixes from pdksh-unstable-5.2.13.5; some of which we already had.

Revision 1.11 / (download) - annotate - [select for diffs], Thu Oct 29 04:09:21 1998 UTC (25 years, 7 months ago) by millert
Branch: MAIN
Changes since 1.10: +3 -1 lines
Diff to previous 1.10 (colored)

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 1.10 / (download) - annotate - [select for diffs], Thu Jun 25 19:02:10 1998 UTC (25 years, 11 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_4_BASE, OPENBSD_2_4
Changes since 1.9: +31 -15 lines
Diff to previous 1.9 (colored)

pdksh-5.2.13 + local changes

Revision 1.9 / (download) - annotate - [select for diffs], Fri Sep 12 00:32:53 1997 UTC (26 years, 9 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_3_BASE, OPENBSD_2_3
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

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

Revision 1.8 / (download) - annotate - [select for diffs], Mon Sep 1 18:30:09 1997 UTC (26 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)

i am bored enough to fix terminal space/tab uglies

Revision 1.7 / (download) - annotate - [select for diffs], Thu Jun 19 13:58:45 1997 UTC (26 years, 11 months ago) by kstailey
Branch: MAIN
Changes since 1.6: +25 -20 lines
Diff to previous 1.6 (colored)

back out

Revision 1.6 / (download) - annotate - [select for diffs], Wed Jun 18 22:42:40 1997 UTC (26 years, 11 months ago) by kstailey
Branch: MAIN
Changes since 1.5: +21 -26 lines
Diff to previous 1.5 (colored)

(foo *)0 -> NULL

Revision 1.5 / (download) - annotate - [select for diffs], Thu Jan 2 09:34:03 1997 UTC (27 years, 5 months ago) by downsj
Branch: MAIN
Changes since 1.4: +6 -1 lines
Diff to previous 1.4 (colored)

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.

Revision 1.4 / (download) - annotate - [select for diffs], Thu Nov 21 07:59:33 1996 UTC (27 years, 6 months ago) by downsj
Branch: MAIN
Changes since 1.3: +48 -21 lines
Diff to previous 1.3 (colored)

Update to 5.2.12.

Revision 1.3 / (download) - annotate - [select for diffs], Tue Oct 1 02:05:45 1996 UTC (27 years, 8 months ago) by downsj
Branch: MAIN
Changes since 1.2: +4 -2 lines
Diff to previous 1.2 (colored)

Integrate pdksh 5.2.9.

Revision 1.2 / (download) - annotate - [select for diffs], Mon Aug 19 20:08:56 1996 UTC (27 years, 9 months ago) by downsj
Branch: MAIN
Changes since 1.1: +8 -4 lines
Diff to previous 1.1 (colored)

update to pdksh-5.2.8

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Aug 14 06:19:11 1996 UTC (27 years, 10 months ago) by downsj
Branch: pdksh
CVS Tags: pdksh-527
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

Import pdksh 5.2.7.

Revision 1.1 / (download) - annotate - [select for diffs], Wed Aug 14 06:19:11 1996 UTC (27 years, 10 months ago) by downsj
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.