Update to sysvinit 2.90

OBS-URL: https://build.opensuse.org/package/show/Base:System/sysvinit?expand=0&rev=227
This commit is contained in:
Dr. Werner Fink 2018-08-06 13:25:01 +00:00 committed by Git OBS Bridge
parent e8c16acbde
commit f9102b3f93
9 changed files with 48 additions and 195 deletions

View File

@ -1,38 +0,0 @@
Index: src/killall5.c
===================================================================
--- src/killall5.c (revision 114)
+++ src/killall5.c (working copy)
@@ -638,8 +638,32 @@ int readproc(int do_stat)
if ((p->nfs = check4nfs(path, buf)))
goto link;
case DO_STAT:
- if (stat(path, &st) != 0)
+ if (stat(path, &st) != 0) {
+ char * ptr;
+
+ len = readlink(path, buf, PATH_MAX);
+ if (len <= 0)
+ break;
+ buf[len] = '\0';
+
+ ptr = strstr(buf, " (deleted)");
+ if (!ptr)
+ break;
+ *ptr = '\0';
+ len -= strlen(" (deleted)");
+
+ if (stat(buf, &st) != 0)
+ break;
+ p->dev = st.st_dev;
+ p->ino = st.st_ino;
+ p->pathname = (char *)xmalloc(len + 1);
+ memcpy(p->pathname, buf, len);
+ p->pathname[len] = '\0';
+
+ /* All done */
break;
+ }
+
p->dev = st.st_dev;
p->ino = st.st_ino;

View File

@ -1,18 +0,0 @@
Index: src/killall5.c
===================================================================
--- src/killall5.c (revision 116)
+++ src/killall5.c (working copy)
@@ -508,9 +508,11 @@
/* Read SID & statname from it. */
if ((fp = fopen(path, "r")) != NULL) {
- if (!fgets(buf, sizeof(buf), fp))
- buf[0] = '\0';
+ size_t len;
+ len = fread(buf, sizeof(char), sizeof(buf)-1, fp);
+ buf[len] = '\0';
+
if (buf[0] == '\0') {
nsyslog(LOG_ERR,
"can't read from %s\n", path);

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2856651d40e0173eedeb0ba316cad9c8ffd25b712190522fbb19e8b06c9e022e
size 107454

View File

@ -1,106 +0,0 @@
--- src/killall5.c
+++ src/killall5.c 2011-10-17 12:18:06.455147132 +0000
@@ -469,6 +469,7 @@ int readproc(int do_stat)
char *s, *q;
unsigned long startcode, endcode;
int pid, f;
+ ssize_t len;
/* Open the /proc directory. */
if (chdir("/proc") == -1) {
@@ -635,23 +636,22 @@ int readproc(int do_stat)
switch (do_stat) {
case DO_NETFS:
if ((p->nfs = check4nfs(path, buf)))
- break;
+ goto link;
case DO_STAT:
if (stat(path, &st) != 0)
break;
- else {
- char buf[PATH_MAX];
-
- f = readlink(path, buf, sizeof buf);
- if (f > 0) {
- p->pathname = (char *)xmalloc(f + 1);
- memcpy(p->pathname, buf, f);
- p->pathname[f] = '\0';
- }
- }
p->dev = st.st_dev;
p->ino = st.st_ino;
+
+ /* Fall through */
default:
+ link:
+ len = readlink(path, buf, PATH_MAX);
+ if (len > 0) {
+ p->pathname = (char *)xmalloc(len + 1);
+ memcpy(p->pathname, buf, len);
+ p->pathname[len] = '\0';
+ }
break;
}
@@ -722,6 +722,7 @@ PIDQ_HEAD *pidof(char *prog)
int dostat = 0;
int foundone = 0;
int ok = 0;
+ const int root = (getuid() == 0);
char real[PATH_MAX+1];
if (! prog)
@@ -769,16 +770,11 @@ PIDQ_HEAD *pidof(char *prog)
* network FS located binaries */
if (!foundone && nfs) {
for (p = plist; p; p = p->next) {
- char exe [PATH_MAX+1];
- char path[PATH_MAX+1];
- int len;
+ if (!p->pathname)
+ continue;
if (!p->nfs)
continue;
- snprintf(exe, sizeof(exe), "/proc/%d/exe", p->pid);
- if ((len = readlink(exe, path, PATH_MAX)) < 0)
- continue;
- path[len] = '\0';
- if (strcmp(prog, path) != 0)
+ if (strcmp(prog, p->pathname) != 0)
continue;
add_pid_to_q(q, p);
foundone++;
@@ -788,19 +784,31 @@ PIDQ_HEAD *pidof(char *prog)
/* If we didn't find a match based on dev/ino, try the name. */
if (!foundone) for (p = plist; p; p = p->next) {
if (prog[0] == '/') {
- if (!p->pathname)
- continue;
+ if (!p->pathname) {
+ if (root)
+ continue;
+ goto fallback;
+ }
if (strcmp(prog, p->pathname)) {
int len = strlen(prog);
if (strncmp(prog, p->pathname, len))
+ {
+ if (scripts_too)
+ goto fallback;
continue;
+ }
if (strcmp(" (deleted)", p->pathname + len))
+ {
+ if (scripts_too)
+ goto fallback;
continue;
+ }
}
add_pid_to_q(q, p);
continue;
}
+ fallback:
ok = 0;
/* matching nonmatching

View File

@ -1,6 +1,10 @@
---
src/killall5.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
--- src/killall5.c
+++ src/killall5.c 2011-10-17 12:11:32.000000000 +0000
@@ -454,6 +454,38 @@ int readarg(FILE *fp, char *buf, int sz)
+++ src/killall5.c 2018-08-06 12:45:03.832836347 +0000
@@ -468,6 +468,38 @@ int readarg(FILE *fp, char *buf, int sz)
}
/*
@ -39,7 +43,7 @@
* Read the proc filesystem.
* CWD must be /proc to avoid problems if / is affected by the killing (ie depend on fuse).
*/
@@ -634,6 +666,26 @@ int readproc(int do_stat)
@@ -650,6 +682,26 @@ int readproc(int do_stat)
p->nfs = 0;
switch (do_stat) {

View File

@ -1,13 +1,19 @@
--- src/Makefile.orig 2015-12-04 14:01:44.134651379 +0100
+++ src/Makefile 2015-12-04 14:01:50.735728998 +0100
@@ -9,19 +9,19 @@
---
src/Makefile | 27 +++++++++------------------
1 file changed, 9 insertions(+), 18 deletions(-)
--- src/Makefile
+++ src/Makefile 2018-08-06 12:55:51.256999853 +0000
@@ -9,7 +9,7 @@
#
CPPFLAGS =
-CFLAGS ?= -ansi -O2 -fomit-frame-pointer
-CFLAGS ?= -ansi -O2 -fomit-frame-pointer -fstack-protector-strong
+CFLAGS ?= $(RPM_OPT_FLAGS)
override CFLAGS += -W -Wall -D_GNU_SOURCE
override CFLAGS += -W -Wall -Wunreachable-code -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -D_XOPEN_SOURCE -D_GNU_SOURCE
override CFLAGS += $(shell getconf LFS_CFLAGS)
STATIC =
@@ -23,13 +23,13 @@ MNTPOINT=
# For some known distributions we do not build all programs, otherwise we do.
BIN =
@ -17,32 +23,31 @@
+USRBIN =
-MAN1 = last.1 lastb.1 mesg.1
-MAN5 = initscript.5 inittab.5
-MAN5 = initscript.5 inittab.5 initctl.5
-MAN8 = halt.8 init.8 killall5.8 pidof.8 poweroff.8 reboot.8 runlevel.8
-MAN8 += shutdown.8 telinit.8 fstab-decode.8
+MAN1 =
+MAN5 =
+MAN5 =
+MAN8 = killall5.8 pidof.8
+MAN8 += fstab-decode.8
ifeq ($(DISTRO),)
BIN += mountpoint
@@ -46,11 +46,6 @@
SBIN += sulogin bootlogd
@@ -53,10 +53,6 @@ endif
ifeq ($(DISTRO),SuSE)
CPPFLAGS+= -DUSE_SYSFS -DSANE_TIO -DSIGINT_ONLYONCE -DUSE_ONELINE
-BIN += mountpoint
-SBIN += sulogin
-USRBIN += utmpdump
-MAN1 += utmpdump.1 mountpoint.1
-MAN1 += utmpdump.1
-MAN8 += sulogin.8
MANDB :=
endif
ID = $(shell id -u)
@@ -161,13 +156,8 @@
@@ -189,13 +185,8 @@ install:
done
# $(INSTALL_DIR) $(ROOT)/etc/
# $(INSTALL_EXEC) initscript.sample $(ROOT)/etc/
# $(INSTALL_EXEC) ../doc/initscript.sample $(ROOT)/etc/
- ln -sf halt $(ROOT)/sbin/reboot
- ln -sf halt $(ROOT)/sbin/poweroff
- ln -sf init $(ROOT)/sbin/telinit

3
sysvinit-2.90.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:114cffc8ef514a38b9916de2050bb6d73b43dff7afd05aee6b09d2f6cea7664e
size 112840

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Mon Aug 6 13:21:20 UTC 2018 - werner@suse.de
- Update to sysvinit 2.90
- Remove now upstream patches
* sysvinit-2.88+dsf-dostat.patch
* sysvinit-2.88+dsf-sulogin.diff
* sysvinit-2.88+dsf.tar.bz2
* sysvinit-2.88dsf-scripts2.patch
- Port our patches
sysvinit-2.88dsf-no-kill.patch becomes sysvinit-2.90-no-kill.patch
sysvinit-2.88+dsf.dif becomes sysvinit-2.90.dif
-------------------------------------------------------------------
Wed Aug 1 14:50:54 UTC 2018 - schwab@suse.de

View File

@ -19,7 +19,7 @@
Name: sysvinit
%define KPVER 2.21
%define SCVER 1.16
%define SIVER 2.88+
%define SIVER 2.90
%define START 0.58
Version: %{SIVER}
Release: 0
@ -30,16 +30,12 @@ BuildRequires: blog-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#!BuildIgnore: sysvinit-tools
Url: http://savannah.nongnu.org/projects/sysvinit/
Source: sysvinit-%{SIVER}dsf.tar.bz2
Source: sysvinit-%{SIVER}.tar.xz
Source1: killproc-%{KPVER}.tar.bz2
Source2: startpar-%{START}.tar.bz2
Patch: %{name}-%{version}dsf.dif
Patch: %{name}-%{SIVER}.dif
Patch2: %{name}-2.88dsf-suse.patch
Patch3: %{name}-2.88dsf-scripts2.patch
Patch9: %{name}-2.88dsf-no-kill.patch
Patch11: %{name}-%{version}dsf-dostat.patch
# PATCH-FIX-UPSTREAM -- killall5: handle strange names of executables
Patch12: %{name}-%{version}dsf-sulogin.diff
Patch9: %{name}-%{SIVER}-no-kill.patch
Patch30: killproc-%{KPVER}.dif
Patch31: killproc-2.18-open_flags.dif
Patch32: killproc-sysmacros.patch
@ -67,12 +63,9 @@ to startpar, killproc and pidof. System V init specific programs are in the
sysvinit package.
%prep
%setup -n %{name}-%{SIVER}dsf -q -b 1 -b 2
%setup -n %{name}-%{SIVER} -q -b 1 -b 2
%patch2 -p0 -b .suse
%patch3 -p0 -b .scripts2
%patch9 -p0 -b .no-kill
%patch11 -p0 -b .dostat
%patch12 -p0 -b .ka5
%patch
pushd doc
mkdir killproc
@ -81,7 +74,7 @@ pushd ../killproc-%{KPVER}
%patch30
%patch31 -p0 -b .dialog
%patch32 -p1
ln -t../%{name}-%{SIVER}dsf/doc/killproc README
ln -t../%{name}-%{SIVER}/doc/killproc README
popd
pushd ../startpar-%{START}
%patch50