2022-06-13 20:29:53 +00:00
|
|
|
diff -Paur --no-dereference -- dash.upstream/src/cd.c dash/src/cd.c
|
|
|
|
--- dash.upstream/src/cd.c
|
|
|
|
+++ dash/src/cd.c
|
2022-08-03 19:21:36 +00:00
|
|
|
@@ -268,7 +268,7 @@
|
2022-06-13 20:29:53 +00:00
|
|
|
STATIC char *
|
|
|
|
getpwd()
|
|
|
|
{
|
|
|
|
-#ifdef __GLIBC__
|
|
|
|
+#if defined(__GLIBC__) || defined(__sortix__)
|
|
|
|
char *dir = getcwd(0, 0);
|
|
|
|
|
|
|
|
if (dir)
|
|
|
|
diff -Paur --no-dereference -- dash.upstream/src/exec.c dash/src/exec.c
|
|
|
|
--- dash.upstream/src/exec.c
|
|
|
|
+++ dash/src/exec.c
|
|
|
|
@@ -151,6 +151,9 @@
|
|
|
|
STATIC void
|
|
|
|
tryexec(char *cmd, char **argv, char **envp)
|
|
|
|
{
|
|
|
|
+#if defined(__sortix__)
|
|
|
|
+ execvpe((const char*) cmd, argv, envp);
|
|
|
|
+#else
|
|
|
|
char *const path_bshell = _PATH_BSHELL;
|
|
|
|
|
|
|
|
repeat:
|
|
|
|
@@ -166,6 +169,7 @@
|
|
|
|
*argv = cmd = path_bshell;
|
|
|
|
goto repeat;
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
2022-08-03 19:21:36 +00:00
|
|
|
static const char *legal_pathopt(const char *opt, const char *term, int magic)
|
|
|
|
diff -Paur --no-dereference -- dash.upstream/src/expand.c dash/src/expand.c
|
|
|
|
--- dash.upstream/src/expand.c
|
|
|
|
+++ dash/src/expand.c
|
|
|
|
@@ -44,6 +44,13 @@
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <limits.h>
|
|
|
|
+/* PATCH: Sortix does not currently have maximum filename or path length */
|
|
|
|
+#ifndef PATH_MAX
|
|
|
|
+#define PATH_MAX 4096
|
|
|
|
+#endif
|
|
|
|
+#ifndef NAME_MAX
|
|
|
|
+#define NAME_MAX 255
|
|
|
|
+#endif
|
|
|
|
#include <string.h>
|
|
|
|
#ifdef HAVE_FNMATCH
|
|
|
|
#include <fnmatch.h>
|
2022-06-13 20:29:53 +00:00
|
|
|
diff -Paur --no-dereference -- dash.upstream/src/histedit.c dash/src/histedit.c
|
|
|
|
--- dash.upstream/src/histedit.c
|
|
|
|
+++ dash/src/histedit.c
|
|
|
|
@@ -32,7 +32,6 @@
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
-#include <sys/param.h>
|
|
|
|
#ifdef HAVE_PATHS_H
|
|
|
|
#include <paths.h>
|
|
|
|
#endif
|
|
|
|
diff -Paur --no-dereference -- dash.upstream/src/jobs.c dash/src/jobs.c
|
|
|
|
--- dash.upstream/src/jobs.c
|
|
|
|
+++ dash/src/jobs.c
|
|
|
|
@@ -40,7 +40,6 @@
|
|
|
|
#include <paths.h>
|
|
|
|
#endif
|
|
|
|
#include <sys/types.h>
|
|
|
|
-#include <sys/param.h>
|
|
|
|
#ifdef BSD
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <sys/time.h>
|
2022-08-03 19:21:36 +00:00
|
|
|
@@ -212,7 +211,7 @@
|
2022-06-13 20:29:53 +00:00
|
|
|
mflag = on = 0;
|
|
|
|
goto close;
|
|
|
|
}
|
|
|
|
- if (pgrp == getpgrp())
|
|
|
|
+ if (pgrp == getpgid(0))
|
|
|
|
break;
|
|
|
|
killpg(0, SIGTTIN);
|
|
|
|
} while (1);
|
2022-08-03 19:21:36 +00:00
|
|
|
@@ -461,7 +460,7 @@
|
2022-06-13 20:29:53 +00:00
|
|
|
|
|
|
|
if (mode & SHOW_PGID) {
|
|
|
|
/* just output process (group) id of pipeline */
|
|
|
|
- outfmt(out, "%d\n", ps->pid);
|
|
|
|
+ outfmt(out, "%jd\n", (intmax_t) ps->pid);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-08-03 19:21:36 +00:00
|
|
|
@@ -474,7 +473,7 @@
|
2022-06-13 20:29:53 +00:00
|
|
|
s[col - 2] = '-';
|
|
|
|
|
|
|
|
if (mode & SHOW_PID)
|
|
|
|
- col += fmtstr(s + col, 16, "%d ", ps->pid);
|
|
|
|
+ col += fmtstr(s + col, 16, "%jd ", (intmax_t) ps->pid);
|
|
|
|
|
|
|
|
psend = ps + jp->nprocs;
|
|
|
|
|
2022-08-03 19:21:36 +00:00
|
|
|
@@ -494,7 +493,7 @@
|
2022-06-13 20:29:53 +00:00
|
|
|
|
|
|
|
do {
|
|
|
|
/* for each process */
|
|
|
|
- col = fmtstr(s, 48, " |\n%*c%d ", indent, ' ', ps->pid) - 3;
|
|
|
|
+ col = fmtstr(s, 48, " |\n%*c%jd ", indent, ' ', (intmax_t) ps->pid) - 3;
|
|
|
|
|
|
|
|
start:
|
|
|
|
outfmt(
|
2022-08-03 19:21:36 +00:00
|
|
|
@@ -971,7 +970,7 @@
|
|
|
|
sigblockall(NULL);
|
|
|
|
vforked++;
|
|
|
|
|
|
|
|
- pid = vfork();
|
|
|
|
+ pid = fork();
|
2022-06-13 20:29:53 +00:00
|
|
|
|
2022-08-03 19:21:36 +00:00
|
|
|
if (!pid) {
|
|
|
|
forkchild(jp, n, FORK_FG);
|
|
|
|
@@ -1179,7 +1178,7 @@
|
2022-06-13 20:29:53 +00:00
|
|
|
do {
|
|
|
|
gotsigchld = 0;
|
2022-08-03 19:21:36 +00:00
|
|
|
do
|
|
|
|
- err = wait3(status, flags, NULL);
|
|
|
|
+ err = waitpid(-1, status, flags);
|
|
|
|
while (err < 0 && errno == EINTR);
|
2022-06-13 20:29:53 +00:00
|
|
|
|
2022-08-03 19:21:36 +00:00
|
|
|
if (err || (err = -!block))
|
2022-06-13 20:29:53 +00:00
|
|
|
diff -Paur --no-dereference -- dash.upstream/src/Makefile.in dash/src/Makefile.in
|
|
|
|
--- dash.upstream/src/Makefile.in
|
|
|
|
+++ dash/src/Makefile.in
|
2022-08-03 19:21:36 +00:00
|
|
|
@@ -669,12 +669,14 @@
|
|
|
|
-rm -f ./$(DEPDIR)/alias.Po
|
|
|
|
-rm -f ./$(DEPDIR)/arith_yacc.Po
|
|
|
|
-rm -f ./$(DEPDIR)/arith_yylex.Po
|
|
|
|
+ -rm -f ./$(DEPDIR)/builtins.Po
|
|
|
|
-rm -f ./$(DEPDIR)/cd.Po
|
|
|
|
-rm -f ./$(DEPDIR)/error.Po
|
|
|
|
-rm -f ./$(DEPDIR)/eval.Po
|
|
|
|
-rm -f ./$(DEPDIR)/exec.Po
|
|
|
|
-rm -f ./$(DEPDIR)/expand.Po
|
|
|
|
-rm -f ./$(DEPDIR)/histedit.Po
|
|
|
|
+ -rm -f ./$(DEPDIR)/init.Po
|
|
|
|
-rm -f ./$(DEPDIR)/input.Po
|
|
|
|
-rm -f ./$(DEPDIR)/jobs.Po
|
|
|
|
-rm -f ./$(DEPDIR)/mail.Po
|
|
|
|
@@ -682,11 +684,14 @@
|
|
|
|
-rm -f ./$(DEPDIR)/memalloc.Po
|
|
|
|
-rm -f ./$(DEPDIR)/miscbltin.Po
|
|
|
|
-rm -f ./$(DEPDIR)/mystring.Po
|
|
|
|
+ -rm -f ./$(DEPDIR)/nodes.Po
|
|
|
|
-rm -f ./$(DEPDIR)/options.Po
|
|
|
|
-rm -f ./$(DEPDIR)/output.Po
|
|
|
|
-rm -f ./$(DEPDIR)/parser.Po
|
|
|
|
-rm -f ./$(DEPDIR)/redir.Po
|
|
|
|
-rm -f ./$(DEPDIR)/show.Po
|
|
|
|
+ -rm -f ./$(DEPDIR)/signames.Po
|
|
|
|
+ -rm -f ./$(DEPDIR)/syntax.Po
|
|
|
|
-rm -f ./$(DEPDIR)/system.Po
|
|
|
|
-rm -f ./$(DEPDIR)/trap.Po
|
|
|
|
-rm -f ./$(DEPDIR)/var.Po
|
|
|
|
@@ -709,7 +714,11 @@
|
2022-06-13 20:29:53 +00:00
|
|
|
|
|
|
|
info-am:
|
|
|
|
|
|
|
|
-install-data-am: install-man
|
|
|
|
+install-data-am: install-man install-proper-shells
|
|
|
|
+
|
|
|
|
+install-proper-shells:
|
|
|
|
+ mkdir -p "$(DESTDIR)$(sysconfdir)/proper-shells"
|
|
|
|
+ echo dash > "$(DESTDIR)$(sysconfdir)/proper-shells/dash"
|
|
|
|
|
|
|
|
install-dvi: install-dvi-am
|
|
|
|
|
|
|
|
diff -Paur --no-dereference -- dash.upstream/src/miscbltin.c dash/src/miscbltin.c
|
|
|
|
--- dash.upstream/src/miscbltin.c
|
|
|
|
+++ dash/src/miscbltin.c
|
|
|
|
@@ -37,7 +37,6 @@
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/types.h> /* quad_t */
|
|
|
|
-#include <sys/param.h> /* BSD4_4 */
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/resource.h>
|
|
|
|
diff -Paur --no-dereference -- dash.upstream/src/output.c dash/src/output.c
|
|
|
|
--- dash.upstream/src/output.c
|
|
|
|
+++ dash/src/output.c
|
|
|
|
@@ -44,7 +44,6 @@
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/types.h> /* quad_t */
|
|
|
|
-#include <sys/param.h> /* BSD4_4 */
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
|
|
|
|
#include <stdio.h> /* defines BUFSIZ */
|
|
|
|
diff -Paur --no-dereference -- dash.upstream/src/parser.c dash/src/parser.c
|
|
|
|
--- dash.upstream/src/parser.c
|
|
|
|
+++ dash/src/parser.c
|
2022-08-03 19:21:36 +00:00
|
|
|
@@ -32,10 +32,7 @@
|
2022-06-13 20:29:53 +00:00
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
-#if HAVE_ALLOCA_H
|
2022-08-03 19:21:36 +00:00
|
|
|
#include <alloca.h>
|
2022-06-13 20:29:53 +00:00
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "shell.h"
|
2022-08-03 19:21:36 +00:00
|
|
|
@@ -1137,10 +1134,12 @@
|
2022-06-13 20:29:53 +00:00
|
|
|
if (len) {
|
|
|
|
char *str;
|
|
|
|
|
|
|
|
- str = alloca(len + 1);
|
|
|
|
+ str = ckmalloc(len + 1);
|
|
|
|
*(char *)mempcpy(str, p, len) = 0;
|
|
|
|
|
|
|
|
pushstring(str, NULL);
|
|
|
|
+
|
|
|
|
+ ckfree(str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-08-03 19:21:36 +00:00
|
|
|
@@ -1373,7 +1372,7 @@
|
2022-06-13 20:29:53 +00:00
|
|
|
str = NULL;
|
|
|
|
savelen = out - (char *)stackblock();
|
|
|
|
if (savelen > 0) {
|
|
|
|
- str = alloca(savelen);
|
|
|
|
+ str = ckmalloc(savelen);
|
|
|
|
memcpy(str, stackblock(), savelen);
|
|
|
|
}
|
|
|
|
if (oldstyle) {
|
2022-08-03 19:21:36 +00:00
|
|
|
@@ -1463,6 +1462,7 @@
|
2022-06-13 20:29:53 +00:00
|
|
|
if (str) {
|
|
|
|
memcpy(out, str, savelen);
|
|
|
|
STADJUST(savelen, out);
|
|
|
|
+ ckfree(str);
|
|
|
|
}
|
|
|
|
USTPUTC(CTLBACKQ, out);
|
|
|
|
if (oldstyle)
|
|
|
|
diff -Paur --no-dereference -- dash.upstream/src/redir.c dash/src/redir.c
|
|
|
|
--- dash.upstream/src/redir.c
|
|
|
|
+++ dash/src/redir.c
|
|
|
|
@@ -34,7 +34,6 @@
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
-#include <sys/param.h> /* PIPE_BUF */
|
|
|
|
#include <signal.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
diff -Paur --no-dereference -- dash.upstream/src/shell.h dash/src/shell.h
|
|
|
|
--- dash.upstream/src/shell.h
|
|
|
|
+++ dash/src/shell.h
|
|
|
|
@@ -49,8 +49,6 @@
|
|
|
|
* a quit signal will generate a core dump.
|
|
|
|
*/
|
|
|
|
|
|
|
|
-#include <sys/param.h>
|
|
|
|
-
|
|
|
|
#ifndef JOBS
|
|
|
|
#define JOBS 1
|
|
|
|
#endif
|