sortix-mirror/ports/dash/dash.patch
Jonas 'Sortie' Termansen 9588b0d3db Add ports to the Sortix repository.
This change imports the ports collection from the former porttix and srctix
repositories and converts them to port(5) files with metadata pointing to
the upstream release tarballs with patches checked into this repository.
Ports are now developed and versioned along with the operating system and
are automatically built per the PACKAGES environment variable. The patches
are licensed under the same license as the relevant ports.

Tix has gained support for the new port(5) format. tix-port(8) is the new
high level ports build even point that handles downloading pstream releases
into the new mirror cache directory, applying the patches, building the port
with the lower-level tix-build(8), and finally installing the binary
package. The new tix-vars(8) program parses port(5) files and the new
tix-rmdiff(8) program produces input for tix-rmpatch(8).

The old doc/ directory is discontinued in favor of manual pages documenting
the new ports system.

The obsolete porttix-create(8) and srctix-create(8) programs are removed.
2022-06-13 22:29:53 +02:00

219 lines
5 KiB
Diff

diff -Paur --no-dereference -- dash.upstream/src/cd.c dash/src/cd.c
--- dash.upstream/src/cd.c
+++ dash/src/cd.c
@@ -252,7 +252,7 @@
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
}
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>
@@ -207,7 +206,7 @@
mflag = on = 0;
goto close;
}
- if (pgrp == getpgrp())
+ if (pgrp == getpgid(0))
break;
killpg(0, SIGTTIN);
} while (1);
@@ -457,7 +456,7 @@
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;
}
@@ -470,7 +469,7 @@
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;
@@ -490,7 +489,7 @@
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(
@@ -1136,7 +1135,7 @@
do {
gotsigchld = 0;
- err = wait3(status, flags, NULL);
+ err = waitpid(-1, status, flags);
if (err || !block)
break;
diff -Paur --no-dereference -- dash.upstream/src/Makefile.in dash/src/Makefile.in
--- dash.upstream/src/Makefile.in
+++ dash/src/Makefile.in
@@ -170,9 +170,9 @@
AM_CFLAGS = $(COMMON_CFLAGS)
AM_CPPFLAGS = $(COMMON_CPPFLAGS)
AM_CFLAGS_FOR_BUILD = -g -O2 $(COMMON_CFLAGS)
-AM_CPPFLAGS_FOR_BUILD = $(COMMON_CPPFLAGS)
+AM_CPPFLAGS_FOR_BUILD = -DBSD=1 -DSHELL -DIFS_BROKEN
COMPILE_FOR_BUILD = \
- $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS_FOR_BUILD) \
+ unset HOST_SYSTEM_ROOT && $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS_FOR_BUILD) \
$(CPPFLAGS_FOR_BUILD) \
$(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
@@ -542,7 +542,11 @@
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
@@ -32,10 +32,6 @@
* SUCH DAMAGE.
*/
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
#include <stdlib.h>
#include "shell.h"
@@ -1090,10 +1086,12 @@
if (len) {
char *str;
- str = alloca(len + 1);
+ str = ckmalloc(len + 1);
*(char *)mempcpy(str, p, len) = 0;
pushstring(str, NULL);
+
+ ckfree(str);
}
}
}
@@ -1300,7 +1298,7 @@
str = NULL;
savelen = out - (char *)stackblock();
if (savelen > 0) {
- str = alloca(savelen);
+ str = ckmalloc(savelen);
memcpy(str, stackblock(), savelen);
}
if (oldstyle) {
@@ -1400,6 +1398,7 @@
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