- do not use posix_spawn as it lacks proper job handling [bsc#1224057]
OBS-URL: https://build.opensuse.org/package/show/shells/ksh?expand=0&rev=238
This commit is contained in:
parent
54b5f19bd0
commit
87465df0b5
151
ksh-qemu.patch
151
ksh-qemu.patch
@ -1,151 +0,0 @@
|
|||||||
--- src/lib/libast/features/lib
|
|
||||||
+++ src/lib/libast/features/lib
|
|
||||||
@@ -92,27 +92,6 @@
|
|
||||||
}
|
|
||||||
}end
|
|
||||||
|
|
||||||
-tst lib_poll_fd_2 note{ fd is second arg to poll() }end execute{
|
|
||||||
- #include <poll.h>
|
|
||||||
- _BEGIN_EXTERNS_
|
|
||||||
- extern int pipe _ARG_((int*));
|
|
||||||
- _END_EXTERNS_
|
|
||||||
- int
|
|
||||||
- main()
|
|
||||||
- { int rw[2];
|
|
||||||
- struct pollfd fd;
|
|
||||||
- if (pipe(rw) < 0) return 1;
|
|
||||||
- fd.fd = rw[0];
|
|
||||||
- fd.events = POLLIN;
|
|
||||||
- fd.revents = 0;
|
|
||||||
- return poll(1, &fd, 0) < 0;
|
|
||||||
- if (poll(1, &fd, 0) < 0 || fd.revents != 0) return 1;
|
|
||||||
- if (write(rw[1], "x", 1) != 1) return 1;
|
|
||||||
- if (poll(1, &fd, 0) < 0 || fd.revents == 0) return 1;
|
|
||||||
- return 0;
|
|
||||||
- }
|
|
||||||
-}end
|
|
||||||
-
|
|
||||||
exp _lib_poll _lib_poll_fd_1||_lib_poll_fd_2
|
|
||||||
|
|
||||||
tst lib_poll_notimer note{ poll with no fds ignores timeout }end execute{
|
|
||||||
@@ -241,120 +220,6 @@
|
|
||||||
}
|
|
||||||
}end
|
|
||||||
|
|
||||||
-tst lib_posix_spawn unistd.h stdlib.h spawn.h -Dfork=______fork note{ posix_spawn exists and it works and its worth using }end status{
|
|
||||||
- #include <sys/types.h>
|
|
||||||
- #include <sys/stat.h>
|
|
||||||
- #include <sys/wait.h>
|
|
||||||
- #include <spawn.h>
|
|
||||||
- #include <signal.h>
|
|
||||||
- #include <fcntl.h>
|
|
||||||
- #include <string.h>
|
|
||||||
- /* if it uses fork() why bother? */
|
|
||||||
- #undef fork
|
|
||||||
- pid_t fork _ARG_((void)) { NOTE("uses fork()"); return -1; }
|
|
||||||
- pid_t _fork _ARG_((void)) { NOTE("uses _fork()"); return -1; }
|
|
||||||
- pid_t __fork _ARG_((void)) { NOTE("uses __fork()"); return -1; }
|
|
||||||
- int
|
|
||||||
- main(argc, argv)
|
|
||||||
- int argc;
|
|
||||||
- char** argv;
|
|
||||||
- {
|
|
||||||
- char* s;
|
|
||||||
- pid_t pid;
|
|
||||||
- posix_spawnattr_t attr;
|
|
||||||
- int n;
|
|
||||||
- int status;
|
|
||||||
- char* cmd[3];
|
|
||||||
- char tmp[1024];
|
|
||||||
- if (argv[1])
|
|
||||||
- _exit(signal(SIGHUP, SIG_DFL) != SIG_IGN);
|
|
||||||
- signal(SIGHUP, SIG_IGN);
|
|
||||||
- if (posix_spawnattr_init(&attr))
|
|
||||||
- {
|
|
||||||
- NOTE("posix_spawnattr_init() FAILED");
|
|
||||||
- _exit(0);
|
|
||||||
- }
|
|
||||||
- if (posix_spawnattr_setpgroup(&attr, 0))
|
|
||||||
- {
|
|
||||||
- NOTE("posix_spawnattr_setpgroup() FAILED");
|
|
||||||
- _exit(0);
|
|
||||||
- }
|
|
||||||
- if (posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETPGROUP))
|
|
||||||
- {
|
|
||||||
- NOTE("posix_spawnattr_setflags() FAILED");
|
|
||||||
- _exit(0);
|
|
||||||
- }
|
|
||||||
- /* first try an a.out and verify that SIGHUP is ignored */
|
|
||||||
- cmd[0] = argv[0];
|
|
||||||
- cmd[1] = "test";
|
|
||||||
- cmd[2] = 0;
|
|
||||||
- if (posix_spawn(&pid, cmd[0], 0, &attr, cmd, 0))
|
|
||||||
- {
|
|
||||||
- NOTE("posix_spawn() FAILED");
|
|
||||||
- _exit(0);
|
|
||||||
- }
|
|
||||||
- status = 1;
|
|
||||||
- if (wait(&status) < 0)
|
|
||||||
- {
|
|
||||||
- NOTE("wait() FAILED");
|
|
||||||
- _exit(0);
|
|
||||||
- }
|
|
||||||
- if (status != 0)
|
|
||||||
- {
|
|
||||||
- NOTE("SIGHUP ignored in parent not ignored in child");
|
|
||||||
- _exit(0);
|
|
||||||
- }
|
|
||||||
- /* must return exec-type errors or its useless to us *unless* there is no [v]fork() */
|
|
||||||
- n = strlen(cmd[0]);
|
|
||||||
- if (n >= (sizeof(tmp) - 3))
|
|
||||||
- {
|
|
||||||
- NOTE("test executable path too long");
|
|
||||||
- _exit(0);
|
|
||||||
- }
|
|
||||||
- strcpy(tmp, cmd[0]);
|
|
||||||
- tmp[n] = '.';
|
|
||||||
- tmp[n+1] = 's';
|
|
||||||
- tmp[n+2] = 'h';
|
|
||||||
- tmp[n+3] = 0;
|
|
||||||
- if ((n = open(tmp, O_CREAT|O_WRONLY, S_IRWXU|S_IRWXG|S_IRWXO)) < 0 ||
|
|
||||||
- chmod(tmp, S_IRWXU|S_IRWXG|S_IRWXO) < 0 ||
|
|
||||||
- write(n, "exit 99\n", 8) != 8 ||
|
|
||||||
- close(n) < 0)
|
|
||||||
- {
|
|
||||||
- NOTE("test script create FAILED");
|
|
||||||
- _exit(0);
|
|
||||||
- }
|
|
||||||
- cmd[0] = tmp;
|
|
||||||
- n = 0; /* 0 means reject */
|
|
||||||
- pid = -1;
|
|
||||||
- if (posix_spawn(&pid, cmd[0], 0, &attr, cmd, 0))
|
|
||||||
- {
|
|
||||||
- n = 2;
|
|
||||||
- NOTE("ENOEXEC produces posix_spawn() error (BEST)");
|
|
||||||
- }
|
|
||||||
- else if (pid == -1)
|
|
||||||
- NOTE("ENOEXEC returns pid == -1");
|
|
||||||
- else if (wait(&status) != pid)
|
|
||||||
- NOTE("ENOEXEC produces no child process");
|
|
||||||
- else if (!WIFEXITED(status))
|
|
||||||
- NOTE("ENOEXEC produces signal exit");
|
|
||||||
- else
|
|
||||||
- {
|
|
||||||
- status = WEXITSTATUS(status);
|
|
||||||
- if (status == 127)
|
|
||||||
- {
|
|
||||||
- n = 1;
|
|
||||||
- NOTE("ENOEXEC produces exit status 127 (GOOD)");
|
|
||||||
- }
|
|
||||||
- else if (status == 99)
|
|
||||||
- NOTE("ENOEXEC invokes sh");
|
|
||||||
- else if (status == 0)
|
|
||||||
- NOTE("ENOEXEC reports no error");
|
|
||||||
- }
|
|
||||||
- _exit(n);
|
|
||||||
- }
|
|
||||||
-}end
|
|
||||||
-
|
|
||||||
tst lib_spawn_mode unistd.h stdlib.h note{ first spawn arg is mode and it works }end execute{
|
|
||||||
#include <signal.h>
|
|
||||||
#include <process.h>
|
|
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon May 13 16:38:57 CEST 2024 - mls@suse.de
|
||||||
|
|
||||||
|
- remove no longer needed qemu workaround
|
||||||
|
deleted patch: ksh-qemu.patch
|
||||||
|
- do not use posix_spawn as it lacks proper job handling [bsc#1224057]
|
||||||
|
new patch: ksh93-no-posix_spawn.dif
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Feb 22 12:41:40 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>
|
Thu Feb 22 12:41:40 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>
|
||||||
|
|
||||||
|
6
ksh.spec
6
ksh.spec
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package ksh
|
# spec file for package ksh
|
||||||
#
|
#
|
||||||
# Copyright (c) 2023 SUSE LLC
|
# Copyright (c) 2024 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -80,7 +80,7 @@ Source31: vmbalance
|
|||||||
Source42: sigexec.c
|
Source42: sigexec.c
|
||||||
Patch0: ksh93.dif
|
Patch0: ksh93.dif
|
||||||
Patch1: workaround-stupid-build-system.diff
|
Patch1: workaround-stupid-build-system.diff
|
||||||
Patch2: ksh-qemu.patch
|
Patch2: ksh93-no-posix_spawn.dif
|
||||||
Patch3: ksh93-shift_ijs.dif
|
Patch3: ksh93-shift_ijs.dif
|
||||||
Patch4: ksh93-gmt2utc.dif
|
Patch4: ksh93-gmt2utc.dif
|
||||||
Patch5: ksh93-uname.dif
|
Patch5: ksh93-uname.dif
|
||||||
@ -207,9 +207,7 @@ fi
|
|||||||
%patch -P 0
|
%patch -P 0
|
||||||
%patch -P 62
|
%patch -P 62
|
||||||
%patch -P 1
|
%patch -P 1
|
||||||
%ifarch %arm
|
|
||||||
%patch -P 2
|
%patch -P 2
|
||||||
%endif
|
|
||||||
%patch -P 3
|
%patch -P 3
|
||||||
%patch -P 4
|
%patch -P 4
|
||||||
%patch -P 5
|
%patch -P 5
|
||||||
|
11
ksh93-no-posix_spawn.dif
Normal file
11
ksh93-no-posix_spawn.dif
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
--- src/lib/libast/features/lib.orig 2024-05-13 14:35:41.921554657 +0000
|
||||||
|
+++ src/lib/libast/features/lib 2024-05-13 14:36:15.401506572 +0000
|
||||||
|
@@ -266,6 +266,8 @@ tst lib_posix_spawn unistd.h stdlib.h sp
|
||||||
|
int status;
|
||||||
|
char* cmd[3];
|
||||||
|
char tmp[1024];
|
||||||
|
+ NOTE("posix_spawn() DISABLED");
|
||||||
|
+ _exit(0);
|
||||||
|
if (argv[1])
|
||||||
|
_exit(signal(SIGHUP, SIG_DFL) != SIG_IGN);
|
||||||
|
signal(SIGHUP, SIG_IGN);
|
Loading…
Reference in New Issue
Block a user