Bug 224168

Summary: rug does not ask for cd
Product: [openSUSE] openSUSE 10.2 Reporter: Holger Sickenberg <holgi>
Component: libzyppAssignee: Duncan Mac-Vicar <dmacvicar>
Status: RESOLVED FIXED QA Contact: Stanislav Visnovsky <visnov>
Severity: Major    
Priority: P5 - None CC: aj, dmacvicar, jsrain, kkaempf, schubi, wstephenson
Version: RC 2   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Holger Sickenberg 2006-11-28 15:07:08 UTC
luna:~ # rug in xchat
Resolving Dependencies...

The following packages will be installed:
  xchat 2.6.6-23 (cd:///?devices=/dev/hda&alias=20061128-125831)


Transaction...
                                                                             0%

ERROR: Transaction failed: Can't provide /suse/x86_64/xchat-2.6.6-23.x86_64.rpm from cd:///?devices=/dev/hda
Comment 1 Klaus Kämpf 2006-11-28 15:15:18 UTC
Still non-matching callbacks ?
Comment 2 Klaus Kämpf 2006-11-28 15:27:34 UTC
Apparently, the callbacks are fine but not properly evaluated by rug
Comment 3 Klaus Kämpf 2006-11-28 15:30:06 UTC
I have these packages installed
libzypp-zmd-backend-7.1.1.0_0.4-37
rug-7.1.100.0-30
zmd-7.1.100.0-40

Running the 'transact' helper standalone does show proper output:
> sudo /usr/lib64/zmd/transact /tmp/zmd.db
0|2
10|6|SUSE LINUX (Media source cd:/// does not contain the desired media)
3|Can't provide ./suse/noarch/ttf-founder-traditional-0.20040419-7.noarch.rpm from cd:///
1|Can't provide ./suse/noarch/ttf-founder-traditional-0.20040419-7.noarch.rpm from cd:///
4

The second line (10|6|...) is requesting ZMD to ask for media #6 but this request isn't properly evaluated.
Comment 4 Guruprasad Sathyamurthy 2006-11-28 15:32:15 UTC
Jinu, please check this out.
Comment 6 Jinu Mathew Joy 2006-11-29 06:38:30 UTC
We did not see the transact helper returning '10' (Media Change) on the
RC1 setup.
we got a 
0|2
3|Can't provide /suse/i586/xchat-2.6.6-17.i586.rpm from cd:///?devices=/dev/hdc
4

Looked like the Media Change status was fixed recently (RC2). We then got the latest libzypp-backend from SuSE autobuild and that helped us reproduce the status Klaus is mentioning.. 

Working on it.. 
Comment 7 Klaus Kämpf 2006-11-29 07:18:55 UTC
Yes, RC1 was troubled with bug #223726 and did not properly report media change requests to ZMD.
RC2 is fixed, see comment #3
Comment 8 Jinu Mathew Joy 2006-11-29 09:20:09 UTC
I did get to reproduce the issue with the latest libzypp-zmd-backend 
and here is what I figured out so far.. 

I get the following messages from the transact helper on a "rug in xchat"

0|2
10|2|openSUSE (Media source cd:///?devices=/dev/hdc does not contain the desired media)
/* this is fine, this is where zmd waits for the media. */
3|Can't provide /suse/i586/xchat-2.6.6-22.i586.rpm from cd:///?devices=/dev/hdc
/* is a 3 (Failure) expected at this stage???? if I tweak the ZyppBackend (zmd
side) to ignore the 3 at this stage. rug behaves correctly.. */
4
/* Done is ok.. */

Here is the rug behaviour when I ignore the 3 (failure) immediately after 
10 (media change).. 

-----
bugz:/usr/lib # rug in xchat
Resolving Dependencies...

The following packages will be installed:
  xchat 2.6.6-22 (cd:///?devices=/dev/hdc&alias=20061127-063752)


Transaction...
Please insert openSUSE (Media source cd:///?devices=/dev/hdc does not contain the desired media), disk 2, and press Enter.    
-----

We are looking at whats making the helper to return 3 at this stage now.. 


Comment 9 Klaus Kämpf 2006-11-29 09:27:26 UTC
The helper is right to exit with "3|...".

This is how media change works

- zmd calls transact helper
- transact needs media, reports it to zmd as "10|media-nr|repository name"
  since zmd has to pass control back to rug (resp. zen-*), the transact helper exits(!) at this point
- zmd passed media request to client (rug or zen-installer or zen-updater)
- user acknowledges "insert media X of repo Y" message
- zmd restarts transact

So after transact reports "10|...", the "3|..." message just contains additional information. But zmd is supposed to continue with the transaction and not abort it.
Comment 10 Klaus Kämpf 2006-11-29 09:32:10 UTC
See http://en.opensuse.org/Libzypp/ZMD/ZMD7.1/helpers
The "3|..." message has warning level only, its not an error !
Comment 11 Jinu Mathew Joy 2006-11-29 11:20:55 UTC
*** Bug 224172 has been marked as a duplicate of this bug. ***
Comment 12 Jinu Mathew Joy 2006-11-29 11:21:26 UTC
3 is defined as an Error status in ZyppBackend. A 3 after 10 was the 
cause for the problem.

Abhi had a chat with Tambet and he also echoed the same as comment #8.
A 3 was not expected after 10.

Anyways the fix is this, we just ignore any other status once MediaChange 
is received, untill ofcourse the next transaction (0) starts.. 

Will speak to Klaus offline to see if ZyppBackend would have to treat
a 3 as warning in any other case.
Comment 13 Klaus Kämpf 2006-11-29 11:50:34 UTC
Indeed. 10.1 (resp. SLE10GA) only reported "10|" and not "10|" and "3|".

Actually, this is another bug in libzypp-zmd-backend :-(
Comment 14 Klaus Kämpf 2006-11-29 11:52:49 UTC
transact.cc has the following code:

        if (med_callback.mediaNr() != 0                 // exception due to MediaChange callback ?
            && !med_callback.description().empty())
        {
            // "4|" means 'message' to ZMD
            cerr << "4|Need media " << med_callback.mediaNr() << ": " << med_callback.description() << endl;
        }
        else {
            // "3|" is progress to stdout
            cout << "3|" << joinlines( expt_r.asUserString() ) << endl;
            // report as message ("4|" is message) to stderr
            cerr << "4|" << expt_r.asString() << endl;
        }

"4|..." is the 'transact exiting' code.
So if transact is exiting early because of a media change request, it just report "4|...", if it exits early for another reason, it reports "3|..." and then "4|...".
Comment 15 Klaus Kämpf 2006-11-29 11:54:39 UTC
It looks like the requestMedia() call from zypp doesn't fill the "description" parameter in 10.2
Comment 16 Jinu Mathew Joy 2006-11-29 14:01:32 UTC
zmd with this fix and a few other is submitted to autobuild.

on klaus's request keeping the defect open to track comment #15.

Comment 17 Andreas Jaeger 2006-11-29 17:36:03 UTC
Klaus, do we need further changes here?
Comment 18 Klaus Kämpf 2006-11-29 22:57:14 UTC
Not for 10.2 immediately. Adapting severity.

However, we should investigate the code in comment #14 and check why callback parameters have changed (description is empty now).