Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1414793 - numeric priority expected error seen for alternatives after chkconfig downgrade
numeric priority expected error seen for alternatives after chkconfig downgrade
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: chkconfig (Show other bugs)
7.3
x86_64 Linux
urgent Severity high
: rc
: ---
Assigned To: Lukáš Nykrýn
Robin Hack
: Reopened, ZStream
Depends On:
Blocks: 1448444
  Show dependency treegraph
 
Reported: 2017-01-19 08:07 EST by Deepu K S
Modified: 2017-08-01 15:35 EDT (History)
5 users (show)

See Also:
Fixed In Version: chkconfig-1.7.3-1.el7
Doc Type: Bug Fix
Doc Text:
Cause: There was a feature in alternatives that changed the format of alternative state files. This change was not forward-compatible, which means that you can't use a state file modified with new alternatives with old alternatives binary. Consequence: This is a problem during the downgrade of alternatives. The new version changed the file and after downgrade the old version is not able to read them. Fix: During downgrade of new version we alter the state files to match the old format. Result: Working downgrade.
Story Points: ---
Clone Of:
: 1448444 (view as bug list)
Environment:
Last Closed: 2017-08-01 15:35:25 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2164 normal SHIPPED_LIVE chkconfig bug fix update 2017-08-01 14:17:46 EDT

  None (edit)
Description Deepu K S 2017-01-19 08:07:50 EST
Description of problem:
After downgrading chkconfig to RHEL 7.2 version [chkconfig-1.3.61-5.el7.x86_64], alternatives commands fail with "numeric priority expected" error.

# alternatives --display java
numeric priority expected in /var/lib/alternatives/java
unexpected line in /var/lib/alternatives/java: @java-1.8.0-openjdk.x86_64@1800111

Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux 7.3
chkconfig-1.7.2-1.el7.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. # yum update java-1.8.0-openjdk
2. # yum downgrade java-1.8.0-openjdk-1.8.0.102-1.b14.el7_2.x86_64 java-1.8.0-openjdk-devel-1.8.0.102-1.b14.el7_2.x86_64 java-1.8.0-openjdk-headless-1.8.0.102-1.b14.el7_2.x86_64 chkconfig-1.3.61-5.el7.x86_64 ntsysv-1.3.61-5.el7.x86_64
3. # alternatives --display java
numeric priority expected in /var/lib/alternatives/java
unexpected line in /var/lib/alternatives/java: @java-1.8.0-openjdk.x86_64@1800111


Actual results:
The /var/lib/alternatives/* files are not rolled back to the numeric priority values.

# alternatives --display java
numeric priority expected in /var/lib/alternatives/java
unexpected line in /var/lib/alternatives/java: @java-1.8.0-openjdk.x86_64@1800111

# alternatives --config java
numeric priority expected in /var/lib/alternatives/java
unexpected line in /var/lib/alternatives/java: @java-1.8.0-openjdk.x86_64@1800111


Expected results:
At downgrade, chkconfig should strip the the @family@ part from /var/lib/alternatives/* files.

Additional info:
Comment 1 Lukáš Nykrýn 2017-01-20 06:58:14 EST
This is not something that should be done in chkconfig package. The java packages that use the --family option should have a dependency for new chkconfig and when you removed them this alternative should be removed.
Comment 3 Paulo Andrade 2017-02-01 09:05:41 EST
  My first idea of how to fix it, only in the newer java package
would be to have a:

%triggerin -- chkconfig < 1.7

followed by a scriptlet to rerun all alternatives commands, but
not using the --family option (or a really ugly 's/@[^@]+@//'
in the alternatives file).

  Do you have a different suggestion? I mean, to be able to
downgrade in the same transaction java-1.8.0-openjdk and chkconfig.
Comment 4 Lukáš Nykrýn 2017-02-06 07:55:45 EST
Ok so what we could do is to add this trigger in chkconfig spec file:

diff --git a/chkconfig.spec b/chkconfig.spec
index 4e08ff4..15eccca 100644
--- a/chkconfig.spec
+++ b/chkconfig.spec
@@ -79,6 +79,11 @@ rm -rf $RPM_BUILD_ROOT
 %{_sbindir}/ntsysv
 %{_mandir}/*/ntsysv.8*
 
+%triggerin -- chkconfig < 1.7
+for i in  /var/lib/alternatives/* ; do
+    sed -i -e 's/^@.*@\([0-9]*\)$/\1/' $i
+done
+
 %changelog
 * Wed Jun 29 2016 Lukáš Nykrýn <lnykryn@redhat.com> - 1.7.2-1
 - alternatives: introduce --keep-missing
Comment 8 Lukáš Nykrýn 2017-03-03 08:28:36 EST
Yep, devel_ack for the spec file change.
Comment 16 errata-xmlrpc 2017-08-01 15:35:25 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2164

Note You need to log in before you can comment on or make changes to this bug.