Commit: 1d8617c28581adee41859414a2b1ddda82e0f2cd
Parent: fb02526ae703029b58f1ca92b918a6251dd45b6b
Author: Randy Palamar
Date: Sun, 12 Jul 2026 12:36:41 -0700
oksh: import 7.9
Diffstat:
9 files changed, 115 insertions(+), 0 deletions(-)
diff --git a/.gitmodules b/.gitmodules
@@ -57,6 +57,10 @@
path = pkg/netbsd-curses/src
url = https://github.com/oasislinux/netbsd-curses.git
ignore = all
+[submodule "pkg/oksh/src"]
+ path = pkg/oksh/src
+ url = https://github.com/ibara/oksh.git
+ ignore = all
[submodule "pkg/pax/src"]
path = pkg/pax/src
url = https://git.sr.ht/~mcf/pax
diff --git a/pkg/gen.lua b/pkg/gen.lua
@@ -24,6 +24,7 @@ subgen('md4c')
subgen('msmtp')
subgen('muon')
subgen('netbsd-curses')
+subgen('oksh')
subgen('openbsd')
subgen('optipng')
subgen('pax')
diff --git a/pkg/oksh/README.md b/pkg/oksh/README.md
@@ -0,0 +1,9 @@
+# oksh
+
+## config.h
+Generated with
+
+```sh
+ ./configure \
+ --enable-small
+```
diff --git a/pkg/oksh/gen.lua b/pkg/oksh/gen.lua
@@ -0,0 +1,20 @@
+cflags{
+ '-D _GNU_SOURCE',
+ '-D EMACS',
+ '-D SMALL',
+ '-D VI',
+ '-I $dir',
+}
+
+exe('ksh', [[
+ alloc.c asprintf.c c_ksh.c c_sh.c c_test.c c_ulimit.c edit.c
+ emacs.c eval.c exec.c expr.c history.c io.c jobs.c lex.c mail.c
+ main.c misc.c path.c shf.c syn.c table.c trap.c tree.c tty.c var.c
+ version.c vi.c confstr.c reallocarray.c siglist.c signame.c
+ strlcat.c strlcpy.c strtonum.c unvis.c vis.c issetugid.c
+]])
+file('bin/ksh', '755', '$outdir/ksh')
+sym('bin/sh', 'ksh')
+man{'ksh.1', 'sh.1'}
+
+fetch 'git'
diff --git a/pkg/oksh/patch/0001-oksh-Avoid-implicit-parameter-conversion-to-char.patch b/pkg/oksh/patch/0001-oksh-Avoid-implicit-parameter-conversion-to-char.patch
@@ -0,0 +1,63 @@
+From 537b64d1d0b49c4e74c66e2de98ce2dee51a1905 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Thu, 2 Apr 2026 17:24:45 -0700
+Subject: [PATCH] oksh: Avoid implicit parameter conversion to char *
+
+kb_entry.seq is always used with string functions, so make it a
+char * instead.
+---
+ emacs.c | 4 ++--
+ misc.c | 6 +++---
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/emacs.c b/emacs.c
+index 78ac2e4..b2c7ab2 100644
+--- a/emacs.c
++++ b/emacs.c
+@@ -78,7 +78,7 @@ typedef enum {
+ /* keybindings */
+ struct kb_entry {
+ TAILQ_ENTRY(kb_entry) entry;
+- unsigned char *seq;
++ char *seq;
+ int len;
+ struct x_ftab *ftab;
+ void *args;
+@@ -1343,7 +1343,7 @@ kb_add_string(kb_func func, void *args, char *str)
+ count = strlen(str);
+
+ k = alloc(sizeof *k + count + 1, AEDIT);
+- k->seq = (unsigned char *)(k + 1);
++ k->seq = (char *)(k + 1);
+ k->len = count;
+ k->ftab = xf;
+ k->args = args ? strdup(args) : NULL;
+diff --git a/misc.c b/misc.c
+index 428f183..9696230 100644
+--- a/misc.c
++++ b/misc.c
+@@ -714,10 +714,10 @@ do_gmatch(const unsigned char *s, const unsigned char *se,
+ }
+
+ static int
+-posix_cclass(const unsigned char *pattern, int test, const unsigned char **ep)
++posix_cclass(const char *pattern, int test, const unsigned char **ep)
+ {
+ const struct cclass *cc;
+- const unsigned char *colon;
++ const char *colon;
+ size_t len;
+ int rval = 0;
+
+@@ -754,7 +754,7 @@ cclass(const unsigned char *p, int sub)
+ if ((p[0] == MAGIC && p[1] == '[' && p[2] == ':') ||
+ (p[0] == '[' && p[1] == ':')) {
+ do {
+- const char *pp = p + (*p == MAGIC) + 2;
++ const char *pp = (char *)p + (*p == MAGIC) + 2;
+ rv = posix_cclass(pp, sub, &p);
+ switch (rv) {
+ case 1:
+--
+2.49.0
+
diff --git a/pkg/oksh/pconfig.h b/pkg/oksh/pconfig.h
@@ -0,0 +1,15 @@
+#define __dead _Noreturn
+#define HAVE_ASPRINTF
+#define HAVE_CONFSTR
+#define NO_CURSES
+#define HAVE_ISSETUGID
+#define HAVE_REALLOCARRAY
+#define HAVE_SETRESGID
+#define HAVE_SETRESUID
+#define HAVE_SIG_T
+#define HAVE_ST_MTIM
+#define HAVE_STRLCAT
+#define HAVE_STRLCPY
+#define HAVE_TIMERADD
+#define HAVE_TIMERCLEAR
+#define HAVE_TIMERSUB
diff --git a/pkg/oksh/src b/pkg/oksh/src
@@ -0,0 +1 @@
+Subproject commit 15f69e430e27eebee4dd9eb5c1fd570804ab15bd
diff --git a/pkg/oksh/ver b/pkg/oksh/ver
@@ -0,0 +1 @@
+7.9 r0
diff --git a/sets.lua b/sets.lua
@@ -14,6 +14,7 @@ S.bin = {
'md4c',
'msmtp',
'muon',
+ 'oksh',
'openbsd',
'optipng',
'pax',