diff --git a/backport-Allow-paths-with-usr-sbin-and-usr-bin-as-equivalent.patch b/backport-Allow-paths-with-usr-sbin-and-usr-bin-as-equivalent.patch deleted file mode 100644 index afd0fa0d6a989d6993e0569e6a800e3ea7fbe443..0000000000000000000000000000000000000000 --- a/backport-Allow-paths-with-usr-sbin-and-usr-bin-as-equivalent.patch +++ /dev/null @@ -1,156 +0,0 @@ -From f476624a138c9f8703605f00506c834a2b249e8b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Wed, 12 Mar 2025 15:54:30 +0100 -Subject: [PATCH] Allow paths with /usr/sbin and /usr/bin as equivalent - -... and for completeness, /bin and /sbin. - -After https://fedoraproject.org/wiki/Changes/Unify_bin_and_sbin, -all four paths are equivalent: /bin/foo, /sbin/foo, /usr/sbin/foo, -and /usr/bin/foo. They all point to /usr/bin/foo. - -Various rpms change paths from /usr/sbin to /usr/bin, and they -scriptlets they call may use e.g. %_sbindir/foo, causing alternatives -to return an error like: ->>> Non-critical error in post-install scriptlet: iptables-legacy-0:1.8.11-3.fc42.x86_64 ->>> Scriptlet output: ->>> the primary link for iptables must be /usr/sbin/iptables -Since systems with merged-sbin are still new, make this opt-in. -If we're built in an environment where %_sbindir==%_bindir, treat -all four prefixes as equivalent. - -Tested by reverting the patch to move paths in iptables-legacy -back to /usr/sbin [1]. The subsequent rpm installs fine both when -/usr/sbin is a symlink (new installs) and a directory (upgrades). - -This approach seems quite safe, because it doesn't change the stored -data in any way, it just relaxes two consistency checks. - -[1] https://src.fedoraproject.org/rpms/iptables/c/43696a4be35ecb64b596d1db368cb736a91316e8 - -Co-authored-by: Lukas Nykryn ---- - Makefile | 4 +++- - alternatives.c | 41 ++++++++++++++++++++++++++++++++++++++--- - chkconfig.spec | 6 ++++-- - 3 files changed, 45 insertions(+), 6 deletions(-) - -diff --git a/Makefile b/Makefile -index eada102..b01563e 100644 ---- a/Makefile -+++ b/Makefile -@@ -16,6 +16,8 @@ SUBDIRS = po - OBJS = chkconfig.o leveldb.o - NTOBJS = ntsysv.o leveldb.o - -+MERGED_SBIN ?= 0 -+ - all: subdirs $(PROG) ntsysv alternatives - - subdirs: -@@ -36,7 +38,7 @@ chkconfig.o: chkconfig.c leveldb.h - $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c chkconfig.c - - alternatives.o: alternatives.c -- $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c alternatives.c -+ $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -DMERGED_SBIN=$(MERGED_SBIN) -c alternatives.c - - ntsysv.o: ntsysv.c leveldb.h - $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c ntsysv.c -diff --git a/alternatives.c b/alternatives.c -index c573e0f..baf4382 100644 ---- a/alternatives.c -+++ b/alternatives.c -@@ -164,6 +164,41 @@ int streq(const char *a, const char *b) { - return 0; - } - -+int is_bin_or_sbin(const char *path, char **rest) { -+ if (!path) -+ return 0; -+ -+ if (strncmp(path, "/usr/bin/", strlen("/usr/bin/")) == 0) { -+ *rest = (char *)path + strlen("/usr/bin/"); -+ return 1; -+ } else if (strncmp(path, "/usr/sbin/", strlen("/usr/sbin/")) == 0) { -+ *rest = (char *)path + strlen("/usr/sbin/"); -+ return 1; -+ } else if (strncmp(path, "/bin/", strlen("/bin/")) == 0) { -+ *rest = (char *)path + strlen("/bin/"); -+ return 1; -+ } else if (strncmp(path, "/sbin/", strlen("/sbin/")) == 0) { -+ *rest = (char *)path + strlen("/sbin/"); -+ return 1; -+ } -+ -+ return 0; -+} -+ -+int streq_bin(const char *a, const char *b) { -+ if (streq(a, b)) -+ return 1; -+ -+ if (MERGED_SBIN && a && b) { -+ char *rest_a = NULL; -+ char *rest_b = NULL; -+ if (is_bin_or_sbin(a, &rest_a) && is_bin_or_sbin(b, &rest_b)) -+ return streq(rest_a, rest_b); -+ } -+ -+ return 0; -+} -+ - char * strsteal(char **ptr) { - char *ret = *ptr; - *ptr = NULL; -@@ -852,8 +887,8 @@ static int matchFollowers(struct alternativeSet *set, - /* check if the follower in alternatives exist they have same name - * and link*/ - if (i < set->alts[k].numFollowers) { -- if (strcmp(set->alts[k].followers[i].facility, -- template.followers[j].facility)) { -+ if (!streq_bin(set->alts[k].followers[i].facility, -+ template.followers[j].facility)) { - fprintf( - stderr, _("link %s incorrect for follower %s (%s %s)\n"), - set->alts[k].followers[i].facility, -@@ -1005,7 +1040,7 @@ static int addService(struct alternative newAlt, const char *altDir, - return 2; - - if (set.numAlts) { -- if (strcmp(newAlt.leader.facility, set.alts[0].leader.facility)) { -+ if (!streq_bin(newAlt.leader.facility, set.alts[0].leader.facility)) { - fprintf(stderr, _("the primary link for %s must be %s\n"), - set.alts[0].leader.title, set.alts[0].leader.facility); - return 2; -diff --git a/chkconfig.spec b/chkconfig.spec -index 07c1570..083e2dc 100644 ---- a/chkconfig.spec -+++ b/chkconfig.spec -@@ -12,6 +12,8 @@ BuildRequires: gcc gettext libselinux-devel make newt-devel popt-devel pkgconfig - BuildRequires: beakerlib - %endif - -+%global merged_sbin %["%{_sbindir}" == "%{_bindir}"] -+ - Conflicts: initscripts <= 5.30-1 - - Provides: /sbin/chkconfig -@@ -35,7 +37,7 @@ page), ntsysv configures the current runlevel (5 if you're using X). - - %package -n alternatives - Summary: A tool to maintain symbolic links determining default commands --%if "%{_sbindir}" == "%{_bindir}" -+%if %{merged_sbin} - Provides: /usr/sbin/alternatives - Provides: /usr/sbin/update-alternatives - Requires: filesystem(unmerged-sbin-symlinks) -@@ -51,7 +53,7 @@ system at the same time. - %setup -q - - %build --%make_build RPM_OPT_FLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" -+%make_build RPM_OPT_FLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" MERGED_SBIN=%{merged_sbin} - - # tests are executed using tmt and tf on CentOS Stream and RHEL - %if 0%{?fedora} diff --git a/chkconfig-1.30.tar.gz b/chkconfig-1.30.tar.gz deleted file mode 100644 index 793bd7b2dfbb3e8b72d8f923cbb44dd5c0fe5f1a..0000000000000000000000000000000000000000 Binary files a/chkconfig-1.30.tar.gz and /dev/null differ diff --git a/chkconfig-1.32.tar.gz b/chkconfig-1.32.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..36a42118ab14632e96de6d87257b4f3c5e3d467c Binary files /dev/null and b/chkconfig-1.32.tar.gz differ diff --git a/chkconfig.spec b/chkconfig.spec index 4cc6285202f0df26b854eaf614126201a3484fdf..d1f1e7a1588a35dd206cdeaa38c908d8f5b0b783 100644 --- a/chkconfig.spec +++ b/chkconfig.spec @@ -2,8 +2,8 @@ Summary: A system tool for maintaining the /etc/rc*.d hierarchy Name: chkconfig -Version: 1.30 -Release: 2 +Version: 1.32 +Release: 1 License: GPL-2.0-only URL: https://github.com/fedora-sysv/chkconfig Source: https://github.com/fedora-sysv/chkconfig/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz @@ -16,7 +16,6 @@ Obsoletes: alternatives < %{version}-%{release} Provides: /sbin/chkconfig Patch0: fix-coredump-while-parseServiceInfo-return-1.patch -Patch1: backport-Allow-paths-with-usr-sbin-and-usr-bin-as-equivalent.patch %description Chkconfig is a basic system utility. It updates and queries runlevel @@ -68,6 +67,9 @@ mkdir -p $RPM_BUILD_ROOT/etc/chkconfig.d %{_mandir}/man8/* %changelog +* Mon Sep 1 2025 hanjinpeng - 1.32-1 +- update to 1.32 + * Tue Jul 15 2025 liuzhilin - 1.30-2 - backport Allow paths with /usr/sbin and /usr/bin as equivalent