diff --git a/.fmf/version b/.fmf/version deleted file mode 100644 index d00491f..0000000 --- a/.fmf/version +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/.gitignore b/.gitignore index 47386f8..605e281 100644 --- a/.gitignore +++ b/.gitignore @@ -17,14 +17,6 @@ /chkconfig-1.19.tar.gz /chkconfig-1.21.tar.gz /chkconfig-1.22.tar.gz -/chkconfig-1.23.tar.gz /chkconfig-1.24.tar.gz /chkconfig-1.25.tar.gz /chkconfig-1.26.tar.gz -/chkconfig-1.27.tar.gz -/chkconfig-1.28.tar.gz -/chkconfig-1.29.tar.gz -/chkconfig-1.30.tar.gz -/chkconfig-1.31.tar.gz -/chkconfig-1.32.tar.gz -/chkconfig-1.33.tar.gz diff --git a/0001-Ignore-alternatives-that-are-binary-identical-to-exi.patch b/0001-Ignore-alternatives-that-are-binary-identical-to-exi.patch deleted file mode 100644 index 4cfbccc..0000000 --- a/0001-Ignore-alternatives-that-are-binary-identical-to-exi.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 1cdf46d6c5d0fa094f46ecef7e4294144d956988 Mon Sep 17 00:00:00 2001 -From: Adam Williamson -Date: Fri, 24 Oct 2025 12:05:00 -0700 -Subject: [PATCH] Ignore alternatives that are binary-identical to existing - ones - -In https://bugzilla.redhat.com/show_bug.cgi?id=2363937 we found -a problem that is ultimately triggered by alternatives configs -having multiple entries that point to the same binary, or the -same *effective* binary after /usr and /sbin merges (which is -what streq_bin handles). I can't see a reason why we'd ever want -to support this as a real thing, so when reading the config, -let's just skip ingesting any alternative whose leader target is -the same effective binary as an alternative we've already read. - -Signed-off-by: Adam Williamson ---- - alternatives.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/alternatives.c b/alternatives.c -index 61a95ad..75d3a54 100644 ---- a/alternatives.c -+++ b/alternatives.c -@@ -520,6 +520,12 @@ static int readConfig(struct alternativeSet *set, const char *title, - newAlt.followers[i - 1].target = (line && strlen(line)) ? strsteal(&line) : NULL; - } - -+ for (i = 0; i < set->numAlts; i++) { -+ if (streq_bin(newAlt.leader.target, set->alts[i].leader.target)) { -+ goto nextalt; -+ } -+ } -+ - set->alts = realloc(set->alts, (set->numAlts + 1) * sizeof(*set->alts)); - set->alts[set->numAlts] = newAlt; - -@@ -527,7 +533,7 @@ static int readConfig(struct alternativeSet *set, const char *title, - set->best = set->numAlts; - - set->numAlts++; -- -+nextalt: - memset(&newAlt, 0, sizeof(struct alternative)); - - nextLine(&buf, &line); --- -2.51.0 - diff --git a/chkconfig.spec b/chkconfig.spec index 97d30f8..d28466f 100644 --- a/chkconfig.spec +++ b/chkconfig.spec @@ -1,25 +1,17 @@ Summary: A system tool for maintaining the /etc/rc*.d hierarchy Name: chkconfig -Version: 1.33 -Release: 3%{?dist} +Version: 1.26 +Release: 1%{?dist} License: GPL-2.0-only URL: https://github.com/fedora-sysv/chkconfig Source: https://github.com/fedora-sysv/chkconfig/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz -# https://github.com/fedora-sysv/chkconfig/pull/157 -# https://bugzilla.redhat.com/show_bug.cgi?id=2363937 -# ignore 'duplicate' entries in config file (same effective binary) -# avoids issue where package install/update disables service -Patch: 0001-Ignore-alternatives-that-are-binary-identical-to-exi.patch - -BuildRequires: gcc gettext libselinux-devel make newt-devel popt-devel pkgconfig(systemd) +BuildRequires: gcc gettext libselinux-devel make newt-devel popt-devel systemd-devel # beakerlib might not be available on CentOS Stream any more %if 0%{?fedora} BuildRequires: beakerlib %endif -%global merged_sbin %["%{_sbindir}" == "%{_bindir}"] - Conflicts: initscripts <= 5.30-1 Provides: /sbin/chkconfig @@ -27,7 +19,7 @@ Provides: /sbin/chkconfig %description Chkconfig is a basic system utility. It updates and queries runlevel information for system services. Chkconfig manipulates the numerous -symbolic links in /etc/rc.d, to relieve system administrators of some +symbolic links in /etc/rc.d, to relieve system administrators of some of the drudgery of manually editing the symbolic links. %package -n ntsysv @@ -43,11 +35,6 @@ 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 %{merged_sbin} -Provides: /usr/sbin/alternatives -Provides: /usr/sbin/update-alternatives -Requires: filesystem(unmerged-sbin-symlinks) -%endif %description -n alternatives alternatives creates, removes, maintains and displays information about the @@ -56,10 +43,10 @@ programs fulfilling the same or similar functions to be installed on a single system at the same time. %prep -%autosetup -p1 +%setup -q %build -%make_build RPM_OPT_FLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" MERGED_SBIN=%{merged_sbin} +%make_build RPM_OPT_FLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" # tests are executed using tmt and tf on CentOS Stream and RHEL %if 0%{?fedora} @@ -103,96 +90,13 @@ mkdir -p $RPM_BUILD_ROOT/etc/chkconfig.d %files -n alternatives %license COPYING %dir /etc/alternatives -%ghost %dir %attr(755, root, root) /etc/alternatives.admindir -%ghost %dir %attr(755, root, root) /var/lib/alternatives %{_sbindir}/update-alternatives %{_sbindir}/alternatives %{_mandir}/*/update-alternatives* %{_mandir}/*/alternatives* +%dir /var/lib/alternatives %changelog -* Fri Oct 24 2025 Adam Williamson - 1.33-3 -- Backport PR #157 to fix MTA service disablement on package update (#2363937) - -* Wed Jul 23 2025 Fedora Release Engineering - 1.33-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild - -* Fri May 09 2025 Lukas Nykryn - 1.33-1 -- alternatives: ignore all bin/sbin differences on systems with merged bin/sbin - -* Thu Mar 13 2025 Jan Macku - 1.32-1 -- Allow paths with /usr/sbin and /usr/bin as equivalent -- mkosi: update conf to match latest mkosi version -- Translated using Weblate (Italian) - -* Sun Jan 12 2025 Zbigniew Jędrzejewski-Szmek - 1.31-2 -- Rebuilt for the bin-sbin merge (2nd attempt) - -* Wed Dec 18 2024 Jan Macku - 1.31-1 -- Translated using Weblate (Ukrainian) -- Translated using Weblate (Ukrainian) -- Translated using Weblate (French) -- Update translation files -- Translated using Weblate (Turkish) - -* Wed Aug 07 2024 Jan Macku - 1.30-1 -- ostree: move admindir to /etc/alternatives.admindir -- update po/chkconfig.pot - -* Tue Jul 30 2024 Jan Macku - 1.29-1 -- add basic mkosi config -- remove not used directory from makefile -- ntsysv: fix leaks -- leveldb: security_context_t is deprecated -- leveldb: fix leak -- leveldb: fix leak -- leveldb: fix leak -- leveldb: fix leak -- leveldb: fix leak -- chkconfig: fix leak -- chkconfig: fix leak -- chkconfig: fix memory leak when deleting a service -- leveldb: add destructors for service -- leveldb: fix memory leak -- leveldb.c: fix memory leak -- chkconfig: fix leak -- leveldb: fix memory leak -- alternatives: ensure the current alt. is freed if parsing fails -- alternatives: ensure the current group is freed -- Translated using Weblate (English (United Kingdom)) -- Translated using Weblate (Turkish) - -* Fri Jun 21 2024 Jan Macku - 1.28-1 -- Prepare for bin-sbin merge -- tests: fix integration with github actions - -* Tue May 14 2024 Jan Macku - 1.27-1 -- alternatives: properly handle chars with const in normalize_path -- alternatives: use exit in main instead of return for critical failures -- alternatives: fix leak -- alternatives: fix leak -- alternatives: fix possible overrun -- alternatives: fix all the leaks of groups in readConfig -- alternatives: fix all the leaks of read line in readConfig -- alternatives: fix leak -- alternatives: fix memory leak -- alternatives: fix memory leak -- alternatives: initialize parameters in main to NULL -- alternatives: fix memory leak -- Translated using Weblate (Korean) -- Translated using Weblate (English (United Kingdom)) -- Translated using Weblate (Finnish) -- Translated using Weblate (Finnish) -- Translated using Weblate (Japanese) -- Translated using Weblate (Swedish) -- Translated using Weblate (Japanese) -- Translated using Weblate (Polish) -- Translated using Weblate (Korean) -- Translated using Weblate (Georgian) -- Update translation files -- Translated using Weblate (Japanese) -- Fix systemd dependency - * Wed Jan 17 2024 Jan Macku - 1.26-1 - fix(test): dot't call `basename` with empty string - spec: sort BuildRequires alphabetically diff --git a/plans/public.fmf b/plans/public.fmf deleted file mode 100644 index d8892fe..0000000 --- a/plans/public.fmf +++ /dev/null @@ -1,9 +0,0 @@ -summary: Public (upstream) beakerlib tests - -discover: - - name: fedora - how: fmf - url: https://github.com/fedora-sysv/chkconfig.git - -execute: - how: tmt diff --git a/sources b/sources index 5ae2b15..4cd5cd8 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (chkconfig-1.33.tar.gz) = 82a7a5e7d62537843cd81fa0c29a0f481ff8fe2798e0143fc409c028f02f01585b6c5d60faf5ce4a4c6dea11c4bba766dbd28e29978447f56708def65421739d +SHA512 (chkconfig-1.26.tar.gz) = e4e4ca07c93f571b93290bf010d86ab2f5bc74a2a76e6b18843b24c1212653a6e204eb4657aa0f9b7c738ba23653b456be8cd4393a04a5651ef1669ee95cbe80 diff --git a/tests/alternatives-doesn-t-update-slave-links-with/Makefile b/tests/alternatives-doesn-t-update-slave-links-with/Makefile new file mode 100644 index 0000000..b8f453d --- /dev/null +++ b/tests/alternatives-doesn-t-update-slave-links-with/Makefile @@ -0,0 +1,62 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/chkconfig/Regression/alternatives-doesn-t-update-slave-links-with +# Description: Test for BZ#1347541 (alternatives doesn't update slave links with) +# Author: Jan Scotka +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2016 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/chkconfig/Regression/alternatives-doesn-t-update-slave-links-with +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + +$(METADATA): Makefile + @echo "Owner: Jan Scotka " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test for BZ#1347541 (alternatives doesn't update slave links with)" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 10m" >> $(METADATA) + @echo "RunFor: chkconfig" >> $(METADATA) + @echo "Requires: chkconfig" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 1347541" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/alternatives-doesn-t-update-slave-links-with/PURPOSE b/tests/alternatives-doesn-t-update-slave-links-with/PURPOSE new file mode 100644 index 0000000..3c06b15 --- /dev/null +++ b/tests/alternatives-doesn-t-update-slave-links-with/PURPOSE @@ -0,0 +1,5 @@ +PURPOSE of /CoreOS/chkconfig/Regression/alternatives-doesn-t-update-slave-links-with +Description: Test for BZ#1347541 (alternatives doesn't update slave links with) +Author: Jan Scotka +Bug summary: alternatives doesn't update slave links with --install in manual mode +Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1347541 diff --git a/tests/alternatives-doesn-t-update-slave-links-with/runtest.sh b/tests/alternatives-doesn-t-update-slave-links-with/runtest.sh new file mode 100755 index 0000000..2c04dcc --- /dev/null +++ b/tests/alternatives-doesn-t-update-slave-links-with/runtest.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/chkconfig/Regression/alternatives-doesn-t-update-slave-links-with +# Description: Test for BZ#1347541 (alternatives doesn't update slave links with) +# Author: Jan Scotka +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2016 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="chkconfig" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlPhaseEnd + rlPhaseStartTest + + rlRun "alternatives --install /usr/bin/xxx xxx /usr/bin/true 1 --slave /usr/bin/yyy yyy /usr/bin/true" + rlRun "alternatives --set xxx /usr/bin/true" + rlRun "alternatives --install /usr/bin/xxx xxx /usr/bin/true 1 --slave /usr/bin/yyy yyy /usr/bin/false" + rlRun "readlink /etc/alternatives/yyy | grep /usr/bin/false" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "update-alternatives --remove xxx /usr/bin/true" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/backport-family-option-from-upstream/Makefile b/tests/backport-family-option-from-upstream/Makefile new file mode 100644 index 0000000..7eca1e2 --- /dev/null +++ b/tests/backport-family-option-from-upstream/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/chkconfig/Sanity/backport-family-option-from-upstream +# Description: Test for BZ#1291340 (Backport --family option from upstream) +# Author: Jan Scotka +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2016 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/chkconfig/Sanity/backport-family-option-from-upstream +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +$(METADATA): Makefile + @echo "Owner: Jan Scotka " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test for BZ#1291340 (Backport --family option from upstream)" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 10m" >> $(METADATA) + @echo "RunFor: chkconfig" >> $(METADATA) + @echo "Requires: chkconfig" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 1291340" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/backport-family-option-from-upstream/PURPOSE b/tests/backport-family-option-from-upstream/PURPOSE new file mode 100644 index 0000000..2b0fc3b --- /dev/null +++ b/tests/backport-family-option-from-upstream/PURPOSE @@ -0,0 +1,5 @@ +PURPOSE of /CoreOS/chkconfig/Sanity/backport-family-option-from-upstream +Description: Test for BZ#1291340 (Backport --family option from upstream) +Author: Jan Scotka +Bug summary: Backport --family option from upstream +Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1291340 diff --git a/tests/backport-family-option-from-upstream/runtest.sh b/tests/backport-family-option-from-upstream/runtest.sh new file mode 100755 index 0000000..d70cd8a --- /dev/null +++ b/tests/backport-family-option-from-upstream/runtest.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/chkconfig/Sanity/backport-family-option-from-upstream +# Description: Test for BZ#1291340 (Backport --family option from upstream) +# Author: Jan Scotka +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2016 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="chkconfig" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "touch $TmpDir/a" + rlRun "touch $TmpDir/b" + rlRun "ln -s $TmpDir/a $TmpDir/link" + rlPhaseEnd + + rlPhaseStartTest + rlRun "alternatives --install $TmpDir/link testname $TmpDir/a 1 --family testfamily" + rlRun "alternatives --install $TmpDir/link testname $TmpDir/b 2 --family testfamily" + rlRun "alternatives --display testname |grep 'link.*$TmpDir/b'" + rlRun "alternatives --display testname |grep 'link.*$TmpDir/a'" 1 + rlRun "alternatives --display testname |grep '$TmpDir/a.*testfamily priority 1'" + rlRun "alternatives --list | grep 'testname.*$TmpDir/b'" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun " alternatives --remove testname $TmpDir/a" + rlRun " alternatives --remove testname $TmpDir/b" + rlRun "rm -rf $TmpDir" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/chkconfig-prioritory-set-inconsistently/Makefile b/tests/chkconfig-prioritory-set-inconsistently/Makefile new file mode 100644 index 0000000..846e4c4 --- /dev/null +++ b/tests/chkconfig-prioritory-set-inconsistently/Makefile @@ -0,0 +1,61 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/chkconfig/Regression/chkconfig-prioritory-set-inconsistently +# Description: chkconfig-prioritory-set-inconsistently +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2012 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/chkconfig/Regression/chkconfig-prioritory-set-inconsistently +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE service-a-fake service-b-fake service-c-fake + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + +$(METADATA): Makefile + @echo "Owner: Martin Cermak " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: chkconfig-prioritory-set-inconsistently" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: chkconfig" >> $(METADATA) + @echo "Requires: chkconfig" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 771455" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/chkconfig-prioritory-set-inconsistently/PURPOSE b/tests/chkconfig-prioritory-set-inconsistently/PURPOSE new file mode 100644 index 0000000..35babfd --- /dev/null +++ b/tests/chkconfig-prioritory-set-inconsistently/PURPOSE @@ -0,0 +1,5 @@ +PURPOSE of /CoreOS/chkconfig/Regression/chkconfig-prioritory-set-inconsistently +Description: chkconfig-prioritory-set-inconsistently +Author: Martin Cermak +Bug summary: chkconfig S## prioritory set inconsistently for initscript with Requires-Start: $network +Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=771455 diff --git a/tests/chkconfig-prioritory-set-inconsistently/runtest.sh b/tests/chkconfig-prioritory-set-inconsistently/runtest.sh new file mode 100755 index 0000000..f8ff7c0 --- /dev/null +++ b/tests/chkconfig-prioritory-set-inconsistently/runtest.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/chkconfig/Regression/chkconfig-prioritory-set-inconsistently +# Description: chkconfig-prioritory-set-inconsistently +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2012 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/lib/beakerlib/beakerlib.sh + +PACKAGE="chkconfig" + +myGetPriority() { + SERVICE=$1 + basename $( ls /etc/rc.d/rc3.d/S[0-9][0-9]$SERVICE ) | tr -d "[a-zA-Z\-]" +} + +# Test scenario: +# https://bugzilla.redhat.com/show_bug.cgi?id=771455#c0 + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "cp service-{a,b,c}-fake /etc/rc.d/init.d/" + + # A has Required-Start on B or C, thus the reversed order: + rlRun "/usr/lib/lsb/install_initd service-c-fake" + rlRun "/usr/lib/lsb/install_initd service-b-fake" + rlRun "/usr/lib/lsb/install_initd service-a-fake" + + rlRun "chkconfig service-a-fake off" + rlRun "chkconfig service-b-fake off" + rlRun "chkconfig service-c-fake off" + rlPhaseEnd + + rlPhaseStartTest + rlRun "chkconfig service-b-fake on" + rlRun "chkconfig service-a-fake on" + rlRun "PRIO=$( myGetPriority service-a-fake )" + # now, the priority of A should be >= 40 (should be = 40 in ideal world) + # and hopefully it is < 80 + rlRun "[ $PRIO -ge 40 ]" + rlRun "[ $PRIO -lt 80 ]" + + rlRun "chkconfig service-c-fake on" + rlRun "PRIO=$( myGetPriority service-a-fake )" + # MAIN TEST: + # right after enabling C, A should raise its priority above 80 + # this should fail with unpatched package (e.g. chkconfig-1.3.47-1.el6) + # ... and pass with patched one (e.g. chkconfig-1.3.49.3-2.el6) + rlRun "[ $PRIO -gt 80 ]" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "/usr/lib/lsb/remove_initd service-a-fake" + rlRun "/usr/lib/lsb/remove_initd service-b-fake" + rlRun "/usr/lib/lsb/remove_initd service-c-fake" + rlRun "rm -rf /etc/rc.d/init.d/service-{a,b,c}-fake" + rlPhaseEnd +#rlJournalPrintText +rlJournalEnd diff --git a/tests/chkconfig-prioritory-set-inconsistently/service-a-fake b/tests/chkconfig-prioritory-set-inconsistently/service-a-fake new file mode 100755 index 0000000..a58fc46 --- /dev/null +++ b/tests/chkconfig-prioritory-set-inconsistently/service-a-fake @@ -0,0 +1,17 @@ +#!/bin/sh +# +# service-a-fake + +# chkconfig: 2345 40 89 +# description: Fake service a +# +### BEGIN INIT INFO +# Provides: service-a-fake +# Default-Start: 2 3 4 5 +# Default-Stop: 0 6 +# Required-Start: bz771455fakeservice +# Short-Description: Fake service a +# Description: Fake service a +### END INIT INFO + + diff --git a/tests/chkconfig-prioritory-set-inconsistently/service-b-fake b/tests/chkconfig-prioritory-set-inconsistently/service-b-fake new file mode 100755 index 0000000..c89d665 --- /dev/null +++ b/tests/chkconfig-prioritory-set-inconsistently/service-b-fake @@ -0,0 +1,16 @@ +#!/bin/sh +# +# service-b-fake + +# chkconfig: 2345 14 89 +# description: Fake service b +# +### BEGIN INIT INFO +# Provides: bz771455fakeservice +# Default-Start: 2 3 4 5 +# Default-Stop: 0 6 +# Short-Description: Fake service b +# Description: Fake service b +### END INIT INFO + + diff --git a/tests/chkconfig-prioritory-set-inconsistently/service-c-fake b/tests/chkconfig-prioritory-set-inconsistently/service-c-fake new file mode 100755 index 0000000..7ee6216 --- /dev/null +++ b/tests/chkconfig-prioritory-set-inconsistently/service-c-fake @@ -0,0 +1,16 @@ +#!/bin/sh +# +# service-c-fake + +# chkconfig: 2345 80 89 +# description: Fake service c +# +### BEGIN INIT INFO +# Provides: bz771455fakeservice +# Default-Start: 2 3 4 5 +# Default-Stop: 0 6 +# Short-Description: Fake service c +# Description: Fake service c +### END INIT INFO + + diff --git a/tests/tests.retry b/tests/tests.retry new file mode 100644 index 0000000..2fbb50c --- /dev/null +++ b/tests/tests.retry @@ -0,0 +1 @@ +localhost diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..61bf9b4 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,15 @@ +--- +# This first play always runs on the local staging system +- hosts: localhost + roles: + - role: standard-test-beakerlib + tags: + - classic + - container + tests: + - alternatives-doesn-t-update-slave-links-with + - backport-family-option-from-upstream + - chkconfig-prioritory-set-inconsistently + required_packages: + - chkconfig + - lsb