commit: 1bcebb56c19af88f770cc04986de87d03df550bf
parent: 9b0270b8de3ce9a41c0764d56912dc02b4dd4ab0
author: Brian Callahan <bcallah@openbsd.org>
date: Sat, 6 Apr 2019 10:14:20 -0400
Update to what will likely be ksh in OpenBSD 6.5.
9 files changed, 65 insertions(+), 51 deletions(-)
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
@@ -1,4 +1,4 @@
-$OpenBSD: CONTRIBUTORS,v 1.10 2006/02/06 16:47:07 jmc Exp $
+$OpenBSD: CONTRIBUTORS,v 1.11 2019/01/25 00:19:25 millert Exp $
This is a partial history of this shell gleened from old change logs and
readmes (most of which are still in the misc directory) and the source
@@ -116,7 +116,7 @@ Other contributors:
* Theo de Raadt (<deraadt@cvs.openbsd.org>): allow ". /dev/null".
* Eric Youngdale (<ericy@datafocus.com>): flag field incorrectly changed
in exec.c(flushcom).
- * Todd. C Miller (Todd C. Miller <Todd.Miller@courtesan.com>): fix
+ * Todd. C Miller (Todd C. Miller <millert@openbsd.org>): fix
for coredump in jobs.
* Kevin Schoedel <schoedel@kw.igs.net>: fix for word location in file
completion.
diff --git a/CVS/Entries b/CVS/Entries
@@ -2,45 +2,45 @@
/io.c/1.36/Fri Jun 1 19:10:08 2018//
/tty.c/1.17/Fri Jun 1 19:10:08 2018//
/c_test.c/1.25/Sun Sep 23 17:58:57 2018//
-/emacs.c/1.85/Result of merge//
-/eval.c/1.63/Sun Sep 23 17:59:17 2018//
/exec.c/1.73/Sun Sep 23 17:58:57 2018//
/var.c/1.70/Sun Sep 23 17:59:17 2018//
-/CONTRIBUTORS/1.10/Thu Jan 10 02:43:53 2019//
-/LEGAL/1.2/Thu Jan 10 02:43:53 2019//
-/Makefile/1.39/Thu Jan 10 02:44:02 2019//
-/NOTES/1.16/Thu Jan 10 02:43:53 2019//
-/PROJECTS/1.9/Thu Jan 10 02:43:53 2019//
-/README/1.16/Thu Jan 10 02:44:02 2019//
-/alloc.c/1.19/Thu Jan 10 02:43:53 2019//
-/c_ksh.c/1.61/Thu Jan 10 02:43:53 2019//
-/c_sh.c/1.63/Thu Jan 10 02:43:53 2019//
-/c_test.h/1.4/Thu Jan 10 02:43:53 2019//
-/c_ulimit.c/1.28/Thu Jan 10 02:43:53 2019//
/edit.c/1.67/Result of merge//
-/edit.h/1.12/Thu Jan 10 02:43:53 2019//
-/expand.h/1.15/Thu Jan 10 02:43:53 2019//
-/expr.c/1.33/Thu Jan 10 02:43:53 2019//
/history.c/1.81/Result of merge//
-/jobs.c/1.60/Thu Jan 10 02:43:53 2019//
-/ksh.1/1.202/Thu Jan 10 02:44:02 2019//
-/lex.c/1.78/Thu Jan 10 02:43:53 2019//
-/lex.h/1.21/Thu Jan 10 02:43:53 2019//
-/mail.c/1.25/Thu Jan 10 02:44:02 2019//
-/main.c/1.96/Result of merge+Thu Jan 10 02:44:02 2019//
/misc.c/1.72/Result of merge//
-/path.c/1.22/Thu Jan 10 02:43:53 2019//
-/sh.1/1.151/Thu Jan 10 02:44:02 2019//
-/sh.h/1.74/Result of merge//
-/shf.c/1.33/Thu Jan 10 02:43:53 2019//
-/shf.h/1.8/Thu Jan 10 02:43:53 2019//
-/syn.c/1.39/Thu Jan 10 02:43:53 2019//
-/table.c/1.25/Thu Jan 10 02:43:53 2019//
-/table.h/1.15/Thu Jan 10 02:43:53 2019//
-/trap.c/1.33/Thu Jan 10 02:44:02 2019//
-/tree.c/1.34/Thu Jan 10 02:43:53 2019//
-/tree.h/1.12/Thu Jan 10 02:43:53 2019//
-/tty.h/1.6/Thu Jan 10 02:43:53 2019//
-/version.c/1.12/Thu Jan 10 02:43:53 2019//
-/vi.c/1.56/Thu Jan 10 02:43:53 2019//
+/CONTRIBUTORS/1.11/Sat Apr 6 14:12:34 2019//
+/LEGAL/1.2/Sat Apr 6 14:12:27 2019//
+/Makefile/1.39/Sat Apr 6 14:12:34 2019//
+/NOTES/1.16/Sat Apr 6 14:12:27 2019//
+/PROJECTS/1.9/Sat Apr 6 14:12:27 2019//
+/README/1.16/Sat Apr 6 14:12:34 2019//
+/alloc.c/1.19/Sat Apr 6 14:12:27 2019//
+/c_ksh.c/1.61/Sat Apr 6 14:12:27 2019//
+/c_sh.c/1.63/Sat Apr 6 14:12:27 2019//
+/c_test.h/1.4/Sat Apr 6 14:12:27 2019//
+/c_ulimit.c/1.28/Sat Apr 6 14:12:27 2019//
+/edit.h/1.12/Sat Apr 6 14:12:27 2019//
+/emacs.c/1.86/Result of merge//
+/eval.c/1.64/Result of merge//
+/expand.h/1.15/Sat Apr 6 14:12:27 2019//
+/expr.c/1.34/Sat Apr 6 14:12:34 2019//
+/jobs.c/1.60/Sat Apr 6 14:12:27 2019//
+/ksh.1/1.203/Sat Apr 6 14:12:34 2019//
+/lex.c/1.78/Sat Apr 6 14:12:27 2019//
+/lex.h/1.21/Sat Apr 6 14:12:27 2019//
+/mail.c/1.27/Sat Apr 6 14:12:34 2019//
+/main.c/1.97/Result of merge//
+/path.c/1.22/Sat Apr 6 14:12:27 2019//
+/sh.1/1.151/Sat Apr 6 14:12:27 2019//
+/sh.h/1.75/Result of merge//
+/shf.c/1.33/Sat Apr 6 14:12:27 2019//
+/shf.h/1.8/Sat Apr 6 14:12:27 2019//
+/syn.c/1.39/Sat Apr 6 14:12:27 2019//
+/table.c/1.25/Sat Apr 6 14:12:27 2019//
+/table.h/1.15/Sat Apr 6 14:12:27 2019//
+/trap.c/1.33/Sat Apr 6 14:12:27 2019//
+/tree.c/1.34/Sat Apr 6 14:12:27 2019//
+/tree.h/1.12/Sat Apr 6 14:12:27 2019//
+/tty.h/1.6/Sat Apr 6 14:12:27 2019//
+/version.c/1.12/Sat Apr 6 14:12:27 2019//
+/vi.c/1.56/Sat Apr 6 14:12:27 2019//
D
diff --git a/emacs.c b/emacs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: emacs.c,v 1.85 2018/06/18 17:03:58 millert Exp $ */
+/* $OpenBSD: emacs.c,v 1.86 2019/04/03 14:55:12 jca Exp $ */
/*
* Emacs-like command line editing and history
@@ -1537,7 +1537,7 @@ x_init_emacs(void)
kb_add(x_prev_histword, CTRL('['), '_', 0);
/* how to handle: quote: ^^ */
kb_add(x_literal, CTRL('^'), 0);
- kb_add(x_draw_line, CTRL('L'), 0);
+ kb_add(x_clear_screen, CTRL('L'), 0);
kb_add(x_search_char_back, CTRL('['), CTRL(']'), 0);
kb_add(x_search_char_forw, CTRL(']'), 0);
kb_add(x_search_hist, CTRL('R'), 0);
diff --git a/eval.c b/eval.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eval.c,v 1.63 2018/07/09 00:20:35 anton Exp $ */
+/* $OpenBSD: eval.c,v 1.64 2019/02/20 23:59:17 schwarze Exp $ */
/*
* Expansion - quoting, separation, substitution, globbing
@@ -66,6 +66,9 @@ substitute(const char *cp, int f)
{
struct source *s, *sold;
+ if (disable_subst)
+ return str_save(cp, ATEMP);
+
sold = source;
s = pushs(SWSTR, ATEMP);
s->start = s->str = cp;
diff --git a/expr.c b/expr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: expr.c,v 1.33 2018/04/09 17:53:36 tobias Exp $ */
+/* $OpenBSD: expr.c,v 1.34 2019/02/20 23:59:17 schwarze Exp $ */
/*
* Korn expression evaluation
@@ -170,6 +170,7 @@ v_evaluate(struct tbl *vp, const char *expr, volatile int error_ok,
struct tbl *v;
Expr_state curstate;
Expr_state * const es = &curstate;
+ int save_disable_subst;
int i;
/* save state to allow recursive calls */
@@ -180,8 +181,10 @@ v_evaluate(struct tbl *vp, const char *expr, volatile int error_ok,
curstate.val = NULL;
newenv(E_ERRH);
+ save_disable_subst = disable_subst;
i = sigsetjmp(genv->jbuf, 0);
if (i) {
+ disable_subst = save_disable_subst;
/* Clear EXPRINEVAL in of any variables we were playing with */
if (curstate.evaling)
curstate.evaling->flag &= ~EXPRINEVAL;
@@ -588,7 +591,9 @@ intvar(Expr_state *es, struct tbl *vp)
evalerr(es, ET_RECURSIVE, vp->name);
es->evaling = vp;
vp->flag |= EXPRINEVAL;
+ disable_subst++;
v_evaluate(vq, str_val(vp), KSH_UNWIND_ERROR, es->arith);
+ disable_subst--;
vp->flag &= ~EXPRINEVAL;
es->evaling = NULL;
}
diff --git a/ksh.1 b/ksh.1
@@ -1,8 +1,8 @@
-.\" $OpenBSD: ksh.1,v 1.202 2018/12/16 13:08:35 schwarze Exp $
+.\" $OpenBSD: ksh.1,v 1.203 2019/04/03 14:55:12 jca Exp $
.\"
.\" Public Domain
.\"
-.Dd $Mdocdate: December 16 2018 $
+.Dd $Mdocdate: April 3 2019 $
.Dt KSH 1
.Os
.Sh NAME
@@ -4694,7 +4694,7 @@ Moves the cursor to the beginning of the edited input line.
Uppercase the first character in the next
.Ar n
words, leaving the cursor past the end of the last word.
-.It clear-screen:
+.It clear-screen: ^L
Clears the screen if the
.Ev TERM
parameter is set and the terminal supports clearing the screen, then
@@ -4891,7 +4891,7 @@ The last
word of the previous command is inserted at the cursor.
.It quote: ^^
The following character is taken literally rather than as an editing command.
-.It redraw: ^L
+.It redraw:
Reprints the prompt string and the current input line.
.It Xo search-character-backward:
.Op Ar n
diff --git a/mail.c b/mail.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mail.c,v 1.25 2019/01/07 20:50:43 tedu Exp $ */
+/* $OpenBSD: mail.c,v 1.27 2019/01/14 08:48:16 schwarze Exp $ */
/*
* Mailbox checking code by Robert J. Gibson, adapted for PD ksh by
@@ -128,10 +128,10 @@ mpset(char *mptoparse)
/* POSIX/bourne-shell say file%message */
for (p = mpath; (mmsg = strchr(p, '%')); ) {
/* a literal percent? (POSIXism) */
- if (mmsg[-1] == '\\') {
+ if (mmsg > mpath && mmsg[-1] == '\\') {
/* use memmove() to avoid overlap problems */
memmove(mmsg - 1, mmsg, strlen(mmsg) + 1);
- p = mmsg + 1;
+ p = mmsg;
continue;
}
break;
@@ -142,7 +142,11 @@ mpset(char *mptoparse)
if (mmsg) {
*mmsg = '\0';
mmsg++;
+ if (*mmsg == '\0')
+ mmsg = NULL;
}
+ if (*mpath == '\0')
+ continue;
mbp = mballoc(mpath, mmsg);
mbp->mb_next = mplist;
mplist = mbp;
diff --git a/main.c b/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.96 2018/11/20 07:02:23 martijn Exp $ */
+/* $OpenBSD: main.c,v 1.97 2019/02/20 23:59:17 schwarze Exp $ */
/*
* startup, main loop, environments and error handling
@@ -35,6 +35,7 @@ uid_t ksheuid;
int exstat;
int subst_exstat;
const char *safe_prompt;
+int disable_subst;
Area aperm;
diff --git a/sh.h b/sh.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sh.h,v 1.74 2018/11/20 07:02:23 martijn Exp $ */
+/* $OpenBSD: sh.h,v 1.75 2019/02/20 23:59:17 schwarze Exp $ */
/*
* Public Domain Bourne/Korn shell
@@ -44,6 +44,7 @@ extern int exstat; /* exit status */
extern int subst_exstat; /* exit status of last $(..)/`..` */
extern const char *safe_prompt; /* safe prompt if PS1 substitution fails */
extern char username[]; /* username for \u prompt expansion */
+extern int disable_subst; /* disable substitution during evaluation */
/*
* Area-based allocation built on malloc/free