Bug 1414793 - numeric priority expected error seen for alternatives after chkconfig downgrade
Summary: numeric priority expected error seen for alternatives after chkconfig downgrade
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: chkconfig
Version: 7.3
Hardware: x86_64
OS: Linux
urgent
high
Target Milestone: rc
: ---
Assignee: Lukáš Nykrýn
QA Contact: Robin Hack
URL:
Whiteboard:
Depends On:
Blocks: 1448444
TreeView+ depends on / blocked
 
Reported: 2017-01-19 13:07 UTC by Deepu K S
Modified: 2020-08-13 08:49 UTC (History)
5 users (show)

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.
Clone Of:
: 1448444 (view as bug list)
Environment:
Last Closed: 2017-08-01 19:35:25 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2164 0 normal SHIPPED_LIVE chkconfig bug fix update 2017-08-01 18:17:46 UTC

Description Deepu K S 2017-01-19 13:07:50 UTC
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 11:58:14 UTC
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 14:05:41 UTC
  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 12:55:45 UTC
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 13:28:36 UTC
Yep, devel_ack for the spec file change.

Comment 16 errata-xmlrpc 2017-08-01 19:35:25 UTC
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.