Red Hat Bugzilla – Bug 1414793
numeric priority expected error seen for alternatives after chkconfig downgrade
Last modified: 2017-08-01 15:35:25 EDT
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:
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.
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.
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
Yep, devel_ack for the spec file change.
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