commit: 61bde591f57be7f7f5f115010a943532501bd8ff
parent 79b852ff86c40441d387b7e646935018837e201e
Author: Michael Forney <mforney@mforney.org>
Date: Tue, 22 Sep 2020 20:01:25 -0700
oksh: Update to 6.7.1
Diffstat:
4 files changed, 1 insertion(+), 208 deletions(-)
diff --git a/.gitmodules b/.gitmodules
@@ -246,7 +246,6 @@
[submodule "pkg/oksh/src"]
path = pkg/oksh/src
url = https://github.com/ibara/oksh.git
- ignore = all
[submodule "pkg/openssh/src"]
path = pkg/openssh/src
url = https://github.com/oasislinux/openssh.git
diff --git a/pkg/oksh/patch/0001-Fix-the-exit-code-when-eval-uating-a-compound-list-i.patch b/pkg/oksh/patch/0001-Fix-the-exit-code-when-eval-uating-a-compound-list-i.patch
@@ -1,46 +0,0 @@
-From ebcebe2ead4911f9e6d96f867b8736a833b5d1cb Mon Sep 17 00:00:00 2001
-From: benno <benno@openbsd.org>
-Date: Fri, 22 May 2020 07:50:07 +0000
-Subject: [PATCH] Fix the exit code when eval()uating a || compound list, it
- would terminate the shell when running under -e. See also
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=269067 and Bug reported
- including fix by Leah Neukirchen, Thanks! ok millert@
-
----
- c_sh.c | 8 +++++++-
- 1 file changed, 7 insertions(+), 1 deletion(-)
-
-diff --git a/c_sh.c b/c_sh.c
-index b051022..98f5e5e 100644
---- a/c_sh.c
-+++ b/c_sh.c
-@@ -1,4 +1,4 @@
--/* $OpenBSD: c_sh.c,v 1.63 2018/04/09 17:53:36 tobias Exp $ */
-+/* $OpenBSD: c_sh.c,v 1.64 2020/05/22 07:50:07 benno Exp $ */
-
- /*
- * built-in Bourne commands
-@@ -424,6 +424,8 @@ int
- c_eval(char **wp)
- {
- struct source *s;
-+ struct source *saves = source;
-+ int savef;
- int rv;
-
- if (ksh_getopt(wp, &builtin_opt, null) == '?')
-@@ -458,7 +460,11 @@ c_eval(char **wp)
- exstat = subst_exstat;
- }
-
-+ savef = Flag(FERREXIT);
-+ Flag(FERREXIT) = 0;
- rv = shell(s, false);
-+ Flag(FERREXIT) = savef;
-+ source = saves;
- afree(s, ATEMP);
- return (rv);
- }
---
-2.27.0
-
diff --git a/pkg/oksh/patch/0002-Add-support-for-set-o-pipefail.patch b/pkg/oksh/patch/0002-Add-support-for-set-o-pipefail.patch
@@ -1,160 +0,0 @@
-From 338e2553f39a37b3e2bd1d91cfaa4c336b85c3f0 Mon Sep 17 00:00:00 2001
-From: jca <jca@openbsd.org>
-Date: Tue, 7 Jul 2020 10:33:58 +0000
-Subject: [PATCH] Add support for set -o pipefail
-
-With the pipefail option set, the exit status of a pipeline is 0 if all
-commands succeed, or the return status of the rightmost command that
-fails. This can help stronger error checking, but is not a silver
-bullet. For example, commands will exhibit a non-zero exit status if
-they're killed by a SIGPIPE when writing to a pipe. Yet pipefail was
-considered useful enough to be included in the next POSIX standard.
-
-This implementation remembers the value of the pipefail option when
-a pipeline is started, as described as option 1) in
-
- https://www.austingroupbugs.net/view.php?id=789#c4102
-
-Requested by ajacoutot@, ok millert@
----
- jobs.c | 30 ++++++++++++++++++++++++++++--
- ksh.1 | 12 +++++++++---
- misc.c | 3 ++-
- sh.h | 3 ++-
- 4 files changed, 41 insertions(+), 7 deletions(-)
-
-diff --git a/jobs.c b/jobs.c
-index f99c9eb..121c0cf 100644
---- a/jobs.c
-+++ b/jobs.c
-@@ -1,4 +1,4 @@
--/* $OpenBSD: jobs.c,v 1.61 2019/06/28 13:34:59 deraadt Exp $ */
-+/* $OpenBSD: jobs.c,v 1.62 2020/07/07 10:33:58 jca Exp $ */
-
- /*
- * Process and job control
-@@ -70,6 +70,7 @@ struct proc {
- #define JF_REMOVE 0x200 /* flagged for removal (j_jobs()/j_notify()) */
- #define JF_USETTYMODE 0x400 /* tty mode saved if process exits normally */
- #define JF_SAVEDTTYPGRP 0x800 /* j->saved_ttypgrp is valid */
-+#define JF_PIPEFAIL 0x1000 /* pipefail on when job was started */
-
- typedef struct job Job;
- struct job {
-@@ -421,6 +422,8 @@ exchild(struct op *t, int flags, volatile int *xerrok,
- */
- j->flags = (flags & XXCOM) ? JF_XXCOM :
- ((flags & XBGND) ? 0 : (JF_FG|JF_USETTYMODE));
-+ if (Flag(FPIPEFAIL))
-+ j->flags |= JF_PIPEFAIL;
- timerclear(&j->usrtime);
- timerclear(&j->systime);
- j->state = PRUNNING;
-@@ -1084,7 +1087,30 @@ j_waitj(Job *j,
-
- j_usrtime = j->usrtime;
- j_systime = j->systime;
-- rv = j->status;
-+
-+ if (j->flags & JF_PIPEFAIL) {
-+ Proc *p;
-+ int status;
-+
-+ rv = 0;
-+ for (p = j->proc_list; p != NULL; p = p->next) {
-+ switch (p->state) {
-+ case PEXITED:
-+ status = WEXITSTATUS(p->status);
-+ break;
-+ case PSIGNALLED:
-+ status = 128 + WTERMSIG(p->status);
-+ break;
-+ default:
-+ status = 0;
-+ break;
-+ }
-+ if (status)
-+ rv = status;
-+ }
-+ } else
-+ rv = j->status;
-+
-
- if (!(flags & JW_ASYNCNOTIFY) &&
- (!Flag(FMONITOR) || j->state != PSTOPPED)) {
-diff --git a/ksh.1 b/ksh.1
-index 7330e93..a91ab51 100644
---- a/ksh.1
-+++ b/ksh.1
-@@ -1,8 +1,8 @@
--.\" $OpenBSD: ksh.1,v 1.208 2019/11/26 22:49:01 jmc Exp $
-+.\" $OpenBSD: ksh.1,v 1.209 2020/07/07 10:33:58 jca Exp $
- .\"
- .\" Public Domain
- .\"
--.Dd $Mdocdate: November 26 2019 $
-+.Dd $Mdocdate: July 7 2020 $
- .Dt KSH 1
- .Os
- .Sh NAME
-@@ -361,7 +361,9 @@ token to form pipelines, in which the standard output of each command but the
- last is piped (see
- .Xr pipe 2 )
- to the standard input of the following command.
--The exit status of a pipeline is that of its last command.
-+The exit status of a pipeline is that of its last command, unless the
-+.Ic pipefail
-+option is set.
- A pipeline may be prefixed by the
- .Ql \&!
- reserved word, which causes the exit status of the pipeline to be logically
-@@ -3664,6 +3666,10 @@ See the
- and
- .Ic pwd
- commands above for more details.
-+.It Ic pipefail
-+The exit status of a pipeline is the exit status of the rightmost
-+command in the pipeline that doesn't return 0, or 0 if all commands
-+returned a 0 exit status.
- .It Ic posix
- Enable POSIX mode.
- See
-diff --git a/misc.c b/misc.c
-index 0f8b336..c2ee2fa 100644
---- a/misc.c
-+++ b/misc.c
-@@ -1,4 +1,4 @@
--/* $OpenBSD: misc.c,v 1.73 2019/06/28 13:34:59 deraadt Exp $ */
-+/* $OpenBSD: misc.c,v 1.74 2020/07/07 10:33:58 jca Exp $ */
-
- /*
- * Miscellaneous functions
-@@ -147,6 +147,7 @@ const struct option sh_options[] = {
- { "notify", 'b', OF_ANY },
- { "nounset", 'u', OF_ANY },
- { "physical", 0, OF_ANY }, /* non-standard */
-+ { "pipefail", 0, OF_ANY }, /* non-standard */
- { "posix", 0, OF_ANY }, /* non-standard */
- { "privileged", 'p', OF_ANY },
- { "restricted", 'r', OF_CMDLINE },
-diff --git a/sh.h b/sh.h
-index f9cdd53..2d65808 100644
---- a/sh.h
-+++ b/sh.h
-@@ -1,4 +1,4 @@
--/* $OpenBSD: sh.h,v 1.75 2019/02/20 23:59:17 schwarze Exp $ */
-+/* $OpenBSD: sh.h,v 1.76 2020/07/07 10:33:58 jca Exp $ */
-
- /*
- * Public Domain Bourne/Korn shell
-@@ -158,6 +158,7 @@ enum sh_flag {
- FNOTIFY, /* -b: asynchronous job completion notification */
- FNOUNSET, /* -u: using an unset var is an error */
- FPHYSICAL, /* -o physical: don't do logical cd's/pwd's */
-+ FPIPEFAIL, /* -o pipefail: all commands in pipeline can affect $? */
- FPOSIX, /* -o posix: be posixly correct */
- FPRIVILEGED, /* -p: use suid_profile */
- FRESTRICTED, /* -r: restricted shell */
---
-2.27.0
-
diff --git a/pkg/oksh/ver b/pkg/oksh/ver
@@ -1 +1 @@
-6.7-2-gd5dc133 r1
+6.7.1 r0