Compare commits

...

No commits in common. "c9s" and "c8" have entirely different histories.
c9s ... c8

21 changed files with 22 additions and 730 deletions

1
.chkconfig.metadata Normal file
View File

@ -0,0 +1 @@
44374e1bde4f7d7db25ac1309ec713d9e1a73039 SOURCES/chkconfig-1.19.2.tar.gz

21
.gitignore vendored
View File

@ -1,20 +1 @@
/chkconfig-1.3.59.tar.bz2 SOURCES/chkconfig-1.19.2.tar.gz
/chkconfig-1.3.60.tar.bz2
/chkconfig-1.3.61.tar.bz2
/chkconfig-1.3.62.tar.bz2
/chkconfig-1.3.63.tar.bz2
/chkconfig-1.4.tar.bz2
/chkconfig-1.5.tar.bz2
/chkconfig-1.6.tar.bz2
/chkconfig-1.7.tar.bz2
/chkconfig-1.8.tar.bz2
/chkconfig-1.9.tar.gz
/chkconfig-1.10.tar.gz
/chkconfig-1.11.tar.gz
/chkconfig-1.14.tar.gz
/chkconfig-1.15.tar.gz
/chkconfig-1.16.tar.gz
/chkconfig-1.17.tar.gz
/chkconfig-1.18.tar.gz
/chkconfig-1.20.tar.gz
/chkconfig-1.24.tar.gz

View File

@ -1,132 +0,0 @@
From 5352ca18294178c61c317ab9783c2183dc22aad1 Mon Sep 17 00:00:00 2001
From: Valentin Rothberg <vrothberg@redhat.com>
Date: Wed, 24 Jul 2024 11:07:41 +0200
Subject: [PATCH] ostree: move admindir to /etc/alternatives.admindir
`ostree container commit` wipes /var and thereby erases the data in
/var/lib/alternatives; the directory used to store configs/symlinks of
alternatives.
/var is not a good place for storing such configs since it won't receive
updates on bootc images either. We need to move to another location.
Hence, use /etc/alternatives.admindir when running on an ostree-based
system unless /var/lib/alternatives is already present; a user may have
worked around the problem. This way we enable alternatives to work on
ostree-based systems without breaking backwards compat.
Fixes: #9
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
(cherry picked from commit 4224f51d0212318dd0fada3976e205e8189cf4b4)
---
Makefile | 1 -
alternatives.8 | 2 ++
alternatives.c | 34 ++++++++++++++++++++++++++++++----
chkconfig.spec | 5 +++--
4 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index 0e7abd8..ea1d8dc 100644
--- a/Makefile
+++ b/Makefile
@@ -55,7 +55,6 @@ install:
[ -d $(DESTDIR)/$(SBINDIR) ] || mkdir -p $(DESTDIR)/$(SBINDIR)
[ -d $(DESTDIR)/$(MANDIR) ] || mkdir -p $(DESTDIR)/$(MANDIR)
[ -d $(DESTDIR)/$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)/$(MANDIR)/man8
- [ -d $(DESTDIR)/$(ALTDIR) ] || mkdir -p -m 755 $(DESTDIR)/$(ALTDIR)
[ -d $(DESTDIR)/$(ALTDATADIR) ] || mkdir -p -m 755 $(DESTDIR)/$(ALTDATADIR)
[ -d $(DESTDIR)/$(SYSTEMDUTILDIR) ] || mkdir -p -m 755 $(DESTDIR)/$(SYSTEMDUTILDIR)
diff --git a/alternatives.8 b/alternatives.8
index d3bbf6b..a04785e 100644
--- a/alternatives.8
+++ b/alternatives.8
@@ -214,6 +214,7 @@ A directory, by default
containing
.BR alternatives '
state information.
+/etc/alternatives.admindir on OSTree-based systems.
.TP
link group
A set of related symlinks, intended to be updated as a group.
@@ -416,6 +417,7 @@ option.
.TP
.I /var/lib/alternatives/
The default administration directory.
+/etc/alternatives.admindir on OSTree-based systems.
Can be overridden by the
.B --admindir
option.
diff --git a/alternatives.c b/alternatives.c
index a2d3750..5ba6c87 100644
--- a/alternatives.c
+++ b/alternatives.c
@@ -496,6 +496,15 @@ static int fileExists(char *path) {
return !stat(path, &sbuf);
}
+static int dirExists(char *path) {
+ struct stat sbuf;
+
+ if (stat(path, &sbuf))
+ return 0;
+
+ return !!S_ISDIR(sbuf.st_mode);
+}
+
static int facilityBelongsToUs(char *facility, const char *altDir) {
char buf[PATH_MAX];
if (readlink(facility, buf, sizeof(buf)) <= 0)
@@ -1248,6 +1257,10 @@ static int listServices(const char *altDir, const char *stateDir, int flags) {
return 0;
}
+static int isOSTree() {
+ return fileExists("/run/ostree-booted") || isLink("/ostree");
+}
+
int main(int argc, const char **argv) {
const char **nextArg;
char *end;
@@ -1256,8 +1269,7 @@ int main(int argc, const char **argv) {
struct alternative newAlt = {-1, {NULL, NULL, NULL}, NULL, NULL, 0, NULL};
int flags = 0;
char *altDir = "/etc/alternatives";
- char *stateDir = "/var/lib/alternatives";
- struct stat sb;
+ char *stateDir= NULL;
struct linkSet newSet = {NULL, NULL, NULL};
setlocale(LC_ALL, "");
@@ -1379,12 +1391,26 @@ int main(int argc, const char **argv) {
}
}
- if (stat(altDir, &sb) || !S_ISDIR(sb.st_mode) || access(altDir, F_OK)) {
+ if (!dirExists(altDir)) {
fprintf(stderr, _("altdir %s invalid\n"), altDir);
return (2);
}
- if (stat(stateDir, &sb) || !S_ISDIR(sb.st_mode) || access(stateDir, F_OK)) {
+ // if the stateDir is not explicitly set, we will use /var/lib/alternatives on normal systems
+ // and /etc/alternatives-admindir on OSTree systems, if the dir does not exist, we will create it
+ // if the stateDir is explicitly set, we will *not* try to create the dir and fail immediately if it does not exist
+ if (!stateDir) {
+ stateDir = "/var/lib/alternatives";
+ if (!dirExists(stateDir)) {
+ if (isOSTree())
+ stateDir = "/etc/alternatives-admindir";
+
+ if (mkdir(stateDir, 0755) < 0 && errno != EEXIST) {
+ fprintf(stderr, _("failed to create admindir: %s\n"), strerror(errno));
+ exit(2);
+ }
+ }
+ } else if (!dirExists(stateDir)) {
fprintf(stderr, _("admindir %s invalid\n"), stateDir);
return (2);
}
--
2.46.0

View File

@ -1,17 +1,15 @@
Summary: A system tool for maintaining the /etc/rc*.d hierarchy Summary: A system tool for maintaining the /etc/rc*.d hierarchy
Name: chkconfig Name: chkconfig
Version: 1.24 Version: 1.19.2
Release: 2%{?dist} Release: 1%{?dist}
License: GPL-2.0-only License: GPLv2
URL: https://github.com/fedora-sysv/chkconfig URL: https://github.com/fedora-sysv/chkconfig
Source: https://github.com/fedora-sysv/chkconfig/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz Source: https://github.com/fedora-sysv/chkconfig/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch001: 001-ostree-move-admindir-to-etc-alternatives.admindir.patch
BuildRequires: newt-devel gettext popt-devel libselinux-devel beakerlib gcc systemd-devel make BuildRequires: newt-devel gettext popt-devel libselinux-devel beakerlib gcc systemd-devel make
Conflicts: initscripts <= 5.30-1 Conflicts: initscripts <= 5.30-1
Provides: /sbin/chkconfig Provides: /sbin/chkconfig
Provides: alternatives = %{version}-%{release}
%description %description
Chkconfig is a basic system utility. It updates and queries runlevel Chkconfig is a basic system utility. It updates and queries runlevel
@ -30,17 +28,8 @@ manipulating the numerous symbolic links in /etc/rc.d). Unless you
specify a runlevel or runlevels on the command line (see the man specify a runlevel or runlevels on the command line (see the man
page), ntsysv configures the current runlevel (5 if you're using X). 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
%description -n alternatives
alternatives creates, removes, maintains and displays information about the
symbolic links comprising the alternatives system. It is possible for several
programs fulfilling the same or similar functions to be installed on a single
system at the same time.
%prep %prep
%autosetup %setup -q
%build %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"
@ -66,14 +55,20 @@ mkdir -p $RPM_BUILD_ROOT/etc/chkconfig.d
%defattr(-,root,root) %defattr(-,root,root)
%{!?_licensedir:%global license %%doc} %{!?_licensedir:%global license %%doc}
%license COPYING %license COPYING
%dir /etc/alternatives
%{_sbindir}/chkconfig %{_sbindir}/chkconfig
%{_sbindir}/update-alternatives
%{_sbindir}/alternatives
%{_sysconfdir}/chkconfig.d %{_sysconfdir}/chkconfig.d
%{_sysconfdir}/init.d %{_sysconfdir}/init.d
%{_sysconfdir}/rc.d %{_sysconfdir}/rc.d
%{_sysconfdir}/rc.d/init.d %{_sysconfdir}/rc.d/init.d
%{_sysconfdir}/rc[0-6].d %{_sysconfdir}/rc[0-6].d
%{_sysconfdir}/rc.d/rc[0-6].d %{_sysconfdir}/rc.d/rc[0-6].d
%dir /var/lib/alternatives
%{_mandir}/*/chkconfig* %{_mandir}/*/chkconfig*
%{_mandir}/*/update-alternatives*
%{_mandir}/*/alternatives*
%{_prefix}/lib/systemd/systemd-sysv-install %{_prefix}/lib/systemd/systemd-sysv-install
%files -n ntsysv %files -n ntsysv
@ -81,97 +76,14 @@ mkdir -p $RPM_BUILD_ROOT/etc/chkconfig.d
%{_sbindir}/ntsysv %{_sbindir}/ntsysv
%{_mandir}/*/ntsysv.8* %{_mandir}/*/ntsysv.8*
%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*
%changelog %changelog
* Wed Sep 04 2024 Jan Macku <jamacku@redhat.com> - 1.24-2 * Mon May 15 2023 Jan Macku <jamacku@redhat.com> - 1.19.2-1
- ostree: move admindir to /etc/alternatives.admindir (RHEL-57665)
* Thu May 04 2023 Jan Macku <jamacku@redhat.com> - 1.24-1
- ci: fix `NEXT_VERSION` in Makefile
- revert: releng: Enable Packit to handle Fedora updates
- revert: releng: Convert to rpmautospec
* Thu May 04 2023 Jan Macku <jamacku@redhat.com> - 1.23-1
- Translated using Weblate (Korean)
- Translated using Weblate (English (United Kingdom))
- alternatives: --keep-foreign incorrectly handles non-existent files - alternatives: --keep-foreign incorrectly handles non-existent files
- alternatives: isLink should return 0 in case of lstat error - alternatives: isLink should return 0 in case of lstat error
- Translated using Weblate (Swedish) - spec: Replace not working awk command with sed (#63)
- Translated using Weblate (Korean)
- Translated using Weblate (Georgian)
- Translated using Weblate (Finnish)
- Translated using Weblate (Ukrainian)
- Translated using Weblate (Polish)
- Update translation files
- Translated using Weblate (German)
- doc: update translations
- spec: remote changelog
* Thu Mar 23 2023 Jan Macku <jamacku@redhat.com> - 1.22-1 * Tue Jul 27 2021 Jan Macku <jamacku@redhat.com> - 1.19.1-1
- migrate to SPDX license - spec: Revert changes introduced in Fedora (#61)
- Translated using Weblate (English (United Kingdom))
- Translated using Weblate (Japanese)
- ci: Add locale linter
- ci: update workflows
- test: fix ShellCheck error[SC2070]
- Bump redhat-plumbers-in-action/differential-shellcheck from 3 to 4 (#94)
- releng: Packit remove extra job trigger
- releng: Enable Packit to handle Fedora updates
- releng: Convert to rpmautospec
* Wed Oct 05 2022 Jan Macku <jamacku@redhat.com> - 1.21-1
- ci: Add CodeQL to replace LGTM
- alternatives: replace master/slave with leader/follower
- chkconfig: use correct cmp function
- Bump redhat-plumbers-in-action/differential-shellcheck from 2 to 3
- ci: Add Shell linter - Differential ShellCheck
- ci: Use more inclusive terminology in workflows
- ci: Update workflows, packit and dependabot
- Translated using Weblate (Friulian)
- Translated using Weblate (Swedish)
- Translated using Weblate (Estonian)
- Translated using Weblate (Georgian)
- Translated using Weblate (Polish)
- Translated using Weblate (Korean)
- Translated using Weblate (Czech)
- Translations update from Fedora Weblate (#77)
- Translations update from Fedora Weblate (#75)
- Translations update from Fedora Weblate (#74)
- Translations update from Fedora Weblate (#73)
- Translated using Weblate (Ukrainian)
- Update translation files
- Family mentioned for --set in both man and help
- Translated using Weblate (French)
- build-sys: Ensure `systemd-sysv-install` symlink does not have `//`
- Translated using Weblate (German)
- Add LGTM badges to README
- Merge remote-tracking branch 'weblate/master'
- Translated using Weblate (Indonesian)
- Translated using Weblate (Finnish)
- Translated using Weblate (Korean)
- Translated using Weblate (Ukrainian)
- Translated using Weblate (Turkish)
- Translated using Weblate (Polish)
- Translated using Weblate (Norwegian Nynorsk)
- Update translation files
- Translated using Weblate (Finnish)
- Translated using Weblate (Czech)
- Translated using Weblate (Swedish)
- Translated using Weblate (Italian)
- Translated using Weblate (Spanish)
- Translated using Weblate (Chinese (Simplified))
* Wed Jul 28 2021 Jan Macku <jamacku@redhat.com> - 1.20-1
- spec: Replace not working awk command with sed (#62)
* Fri Jul 23 2021 Jan Macku <jamacku@redhat.com> - 1.19-1 * Fri Jul 23 2021 Jan Macku <jamacku@redhat.com> - 1.19-1
- spec: Add Provides /sbin/chkconfig in order to stay backwards compatible (#60) - spec: Add Provides /sbin/chkconfig in order to stay backwards compatible (#60)
@ -206,6 +118,9 @@ mkdir -p $RPM_BUILD_ROOT/etc/chkconfig.d
- Fix spelling of SELinux - Fix spelling of SELinux
- Remove hardcoded systemd path - Remove hardcoded systemd path
* Fri Apr 17 2020 Jan Macku <jamacku@redhat.com> - 1.13-2
- Package onboarded to gating
* Tue Apr 14 2020 Jan Macku <jamacku@redhat.com> - 1.13-1 * Tue Apr 14 2020 Jan Macku <jamacku@redhat.com> - 1.13-1
- fix typo in translations and fix bogus dates in changelog - fix typo in translations and fix bogus dates in changelog

View File

@ -1,7 +0,0 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

View File

@ -1,9 +0,0 @@
#!/bin/bash
set -e
curl https://raw.githubusercontent.com/fedora-sysv/chkconfig/master/chkconfig.spec -o chkconfig.spec
git add chkconfig.spec
spectool -g chkconfig.spec
fedpkg new-sources $(basename $(spectool -S -l chkconfig.spec | awk '{print $2;}'))
git commit -m $(grep Version chkconfig.spec | awk '{print $2;}')

View File

@ -1 +0,0 @@
SHA512 (chkconfig-1.24.tar.gz) = 9f0dad18289fb518a50a65b0c2663a7e2c1e48167b2fddd76c3bda3932346fa584ebb151e0b804267659604b534068747abb6349d808c32a7d9dfac91aed7b0c

View File

@ -1,62 +0,0 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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 <jscotka@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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 <jscotka@redhat.com>" > $(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)

View File

@ -1,5 +0,0 @@
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 <jscotka@redhat.com>
Bug summary: alternatives doesn't update slave links with --install in manual mode
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1347541

View File

@ -1,50 +0,0 @@
#!/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 <jscotka@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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

View File

@ -1,63 +0,0 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/chkconfig/Sanity/backport-family-option-from-upstream
# Description: Test for BZ#1291340 (Backport --family option from upstream)
# Author: Jan Scotka <jscotka@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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 <jscotka@redhat.com>" > $(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)

View File

@ -1,5 +0,0 @@
PURPOSE of /CoreOS/chkconfig/Sanity/backport-family-option-from-upstream
Description: Test for BZ#1291340 (Backport --family option from upstream)
Author: Jan Scotka <jscotka@redhat.com>
Bug summary: Backport --family option from upstream
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1291340

View File

@ -1,58 +0,0 @@
#!/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 <jscotka@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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

View File

@ -1,61 +0,0 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/chkconfig/Regression/chkconfig-prioritory-set-inconsistently
# Description: chkconfig-prioritory-set-inconsistently
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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 <mcermak@redhat.com>" > $(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)

View File

@ -1,5 +0,0 @@
PURPOSE of /CoreOS/chkconfig/Regression/chkconfig-prioritory-set-inconsistently
Description: chkconfig-prioritory-set-inconsistently
Author: Martin Cermak <mcermak@redhat.com>
Bug summary: chkconfig S## prioritory set inconsistently for initscript with Requires-Start: $network
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=771455

View File

@ -1,82 +0,0 @@
#!/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 <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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

View File

@ -1,17 +0,0 @@
#!/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

View File

@ -1,16 +0,0 @@
#!/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

View File

@ -1,16 +0,0 @@
#!/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

View File

@ -1 +0,0 @@
localhost

View File

@ -1,15 +0,0 @@
---
# 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