Bug 1317597

Summary: When masters do not share all slaves, the unshared slaves are unlinked
Product: Red Hat Enterprise Linux 7 Reporter: jiri vanek <jvanek>
Component: chkconfigAssignee: Lukáš Nykrýn <lnykryn>
Status: CLOSED ERRATA QA Contact: Jan Ščotka <jscotka>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: jscotka, jvanek
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: chkconfig-1.7.2-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1371146 (view as bug list) Environment:
Last Closed: 2016-11-04 06:56:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1312019, 1371146    

Description jiri vanek 2016-03-14 15:57:01 UTC
Description of problem:
Consider scenario:
 master link x /path1 /
  -slave link/a /path1/a
  -slave link/b /path1/b

 master link y /path2
  -slave link/a /path2/a
  -slave link/c /path2/c

When you select master X  both links a and b will be valid.
When you select master Y  both links a and c will be valid, but b will disappear. I agree that it is disputable, but this behaviour can be considered as bug. When  Y is selected, then  both a and c should point to path2, but b should keep  pointing to path1 

When the example enriches to three candidates, then it may end in state when each slave is poinitng to different implementation. And it really can be confusing. But when you look into real life example (see how to reproduce) you can realize that 99% of slaves is aligned, but the remaining one... Would be nice to have them alive instead of missing.

Version-Release number of selected component (if applicable):
all

How reproducible:
always

Steps to Reproduce:
1. install java-1.8.0-openjdk
2. install java-1.7.0-openjdk
3. switch between them several times

jdk8 is providing - in addition to jdk7 jjs (and jdk9 will come with jshell)
Currently, when jdk7 i selected, /usr/bin/jjs do not exists, although it is installed via jdk8

There is one more issue hidden if this will be fixed. (you can see it now in fedora with jdk9) 
you ionstall jdk8 - no jshell
Then you install jdk9 - but because it have lower priority then jdk8 it do not set alternatrives to "itself"  If this bug will be fixed, then even  in this case, the jshell slave should be set.


As I told, this do not need to be considered as bug,  but worthy to think about.

Comment 2 Lukáš Nykrýn 2016-04-05 12:31:28 UTC
I finally got to this one and I don't think that this is a bug. Basically you have chosen a different implementation of something and it does not provide whole functionality. I could imagine that leaving the old link (for example in the case of MTAs) could sometimes break things.

Comment 3 Lukáš Nykrýn 2016-04-05 12:40:56 UTC
On the other hand, this could be a new functionality wit a new switch (something like like --preserve-missing), would that help in your use-cases?

Comment 4 jiri vanek 2016-04-05 13:09:40 UTC
Indeed. This would help.  But isnt the cost higher then benefit?

Still, "fixing" this, is the only way I come up to fix the https://bugzilla.redhat.com/show_bug.cgi?id=1312019

Comment 6 jiri vanek 2016-06-23 10:10:12 UTC
There are rpms with experimental fix in:
https://jvanek.fedorapeople.org/chkconfig/perists%20and%20family%20in%20config%20and%20set/v1/


Currently there is no real package supporting this, but I will add it to experimental branch of openjdk8 Thanx!

Comment 7 jiri vanek 2016-06-23 11:30:37 UTC
(In reply to jiri vanek from comment #5)
> See
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1344059#c40
> https://bugzilla.redhat.com/show_bug.cgi?id=1344059#c41

Hello! The fix is in a bit different meter Then I though. Although it is alos posible workaround (benefit is that there is no need to configure existing packages, and that user is doing this intentionally )

What I had in mind was:

 alternatives \\
   --install %{_bindir}/java java %{jrebindir %%1}/java $PRIORITY  --family %{name}.%{_arch} \\
   --slave %{_jvmdir}/jre jre %{_jvmdir}/%{jredir %%1} \\
   --slave %{_jvmjardir}/jre jre_exports %{_jvmjardir}/%{jrelnk %%1} \\
-  --slave %{_bindir}/jjs jjs %{jrebindir %%1}/jjs \\
+  --slave %{_bindir}/jjs jjs %{jrebindir %%1}/jjs  --persists \\
   --slave %{_bindir}/keytool keytool %{jrebindir %%1}/keytool \\

And then the slave of jjs will be handled as you do in  --keep-missing 
The advantage of this is that only special, expected slaves are kept. Another benefitis that it works over --config or already existing tools like system-switch-java

However I like your approach. It is more safe. What about combination?

alternatives  --keep-missing --set TEST /tmp/tmp.CuACTutoSW/link_a/main

 - will keep all missing slaves - no meter of status of --persists

alternatives  --remove-missing --set TEST /tmp/tmp.CuACTutoSW/link_a/main

 - will remove all missing slaves - no meter of status of --persists (backward comaptibility)

alternatives --set TEST /tmp/tmp.CuACTutoSW/link_a/main  OR   alternatives --config TEST

 - will keep only slaves with --persists  flag


I'm a bit afraid f genral usage of --keep-missing  - on one side is really good that it is user-intentional.  On second there are java-vendor specific bninaries, whih may be really unexpected to persists.

Thoughts?

Comment 8 jiri vanek 2016-06-23 11:38:21 UTC
Lukas, thnak you for the initial version. the testing is much more compfrtbale.
Also lukas, do you mind to elaborate on devel/qa+?  I hope to ack  1312019.

Comment 10 jiri vanek 2016-06-23 12:21:31 UTC
For record - I think that even wit simple --keep-missing I can provie /usr/bin/jjs  so I can proceed with original bug.

As --persists is affecting alternatives config files, it will be subject of another discussion later, once plumbers have more time.

Comment 11 jiri vanek 2016-06-24 14:28:32 UTC
The inclusion of --persists have one more usecase:

Lets say I have jdk7 installed, and alternatives are manually on it.
So I install jdk8. It will notget selected (although it have higher priority, but I Have 7 manually)
But jjs have --persists flag. In this case. the persisting slave should be set.

It leads to cornercase:
Lets say I have jdk7 and 9 installed, and alternatives are manually on it.
I had 9 selected. It provides jjs. I switch to jdk7. It do not. But considering any of approaches in this bug implemented, I switched to 7, so 9's jjs stayed linked.
Now I install 8 as in first paragraph. jjs should switch according to priority.
if newly come jdk8's master of jjs priority is higher then the one of jdk9, it should switch. Else jjs from jdk9 should stay selected.

Comment 12 Lukáš Nykrýn 2016-06-29 13:16:36 UTC
So for now we will just go with the new --keep-missing option.

Comment 16 errata-xmlrpc 2016-11-04 06:56:53 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://rhn.redhat.com/errata/RHBA-2016-2467.html