Bug 249710

Summary: RFE: Yum to understood rpms downloaded, when partial content requested
Product: Red Hat Enterprise Linux 5 Reporter: Miroslav Suchý <msuchy>
Component: yumAssignee: James Antill <james.antill>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: urgent    
Version: 5.0CC: cperry, eric.eisenhart, inode0, jhutar, jlaska
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2008-0388 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-21 14:20:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 249832    
Bug Blocks: 247327    

Comment 1 RHEL Program Management 2007-07-26 16:07:46 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 3 Máirín Duffy 2007-07-26 16:46:54 UTC
Description of problem:
If you download rpm from proxy custom channel, yum request headers of that
package and will download whole file (0-*end*).
Proxy return whole file and yum-rhn-plugin will try parse this whole file as
header, which will fail.

Version-Release number of selected component (if applicable):
yum-rhn-plugin-0.4.3-2.el5

How reproducible:
always

Steps to Reproduce:
1. see #4 of BZ 247327
2. make sure you apply patch from #9 of BZ 247327
3. register RHEL5 machine to that proxy
4. yum install <package you put in custom channel in step 1>
  

Comment 4 Miroslav Suchý 2007-07-27 09:43:47 UTC
I seems that the bug is not in yum rhn plugin. 
Problem is that in /var/cache/yum/msuchy-5server/primary.xml.gz is:
<rpm:header-range start="0" end="117644" />
so yum-rhn-plugin do as told.
This values should be filled. Probably by rhn-package-manager. Gonna try to
confirm it.

Comment 5 Miroslav Suchý 2007-07-27 12:02:31 UTC
Even with correct header_start and header_end (see BZ 249832), yum still shout.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for Global_File_System-as-IN to pack into transaction set.
dbg:http://proxy-test.englab.brq.redhat.com/XMLRPC/GET-REQ/msuchy-5server/getPackage/Global_File_System-as-IN-5.0.0-4.noarch.rpm
dbg:range - 440, 12984

dbg:filename
//var/cache/yum/msuchy-5server/headers/Global_File_System-as-IN-5.0.0-4.noarch.hdr

Global_File_System-as-IN- 100% |=========================|  12 kB    00:01
Error: failed to retrieve getPackage/Global_File_System-as-IN-5.0.0-4.noarch.rpm
from msuchy-5server
error was [Errno -1] Header is not complete.

Comment 6 Miroslav Suchý 2007-07-27 12:20:41 UTC
yum-plugin request 
Range: 440-12984
but proxy answer 
HTTP OK 200 and not 206. But this should be OK. According w3c spec, "A server
MAY ignore the Range header" and if get from server 200 client should know it
get whole file, not just requested range. 
So in previus comment it have in file
Global_File_System-as-IN-5.0.0-4.noarch.hdr range 0-12544
yum-plugin should have somewhere this code
if return code == 206:
    do_as_do_now()
else if return code == 200:
    skip header_start bytes
    do_as_do_now()
    

Comment 7 James Slagle 2007-08-06 20:14:36 UTC
The patch from bz #247327 c#9, resolves the issue for me.  Is this what is
expected?  Do we just want to make yum-rhn-plugin a little more robust so that
if requests with a Range header, but gets back 200, it still works?

Here's what I did:
1. Installed/Activated a rhn proxy 5.0 against production.
   rlx-2-04.rhndev.redhat.com
2. Registered my rhel 5 client through the proxy
   dhcp58-248.rdu.redhat.com
3. Set up a custom channel, slaglej-channel, and uploaded a package, to the
   custom channel.
   rhn-satellite-schema-5.0.0-27.noarch.rpm
4. Verified that the package will install manually using rpm on my rhel 5
   client, then rpm -e'd it.
5. Then, I:
   # yum install rhn-satellite-schema
   That prompts to download package, I hit y, then get:
   Error Downloading Packages:
  rhn-satellite-schema - 5.0.0-27.noarch: failed to retrieve
getPackage/rhn-satellite-schema-5.0.0-27.noarch.rpm from slaglej-channel
error was [Errno 14] HTTP Error 404: Not Found
6. If I apply the patch to my proxy from bz #247327 c#9, the package downloads
successfully.

Comment 8 James Slagle 2007-08-06 20:17:10 UTC
Step 6 above should say:
... the package downloads *and* installs successfully.

Comment 9 Miroslav Suchý 2007-08-07 09:05:05 UTC
Yeah, we should fix both end (proxy and yum-rhn-plugin). I fixed one end in
proxy5.0. But if users have proxy4.2, it will be broken for them (unless they
request hotfix or will wait for 4.3 [not known eta]).

Other advantage of this fix in yum-rhn-plugin can be (I think) that rhel5
clients can than work with - now not supported - older satellites, like 3.x

Comment 13 Red Hat Bugzilla 2007-10-26 00:52:59 UTC
User jslagle's account has been closed

Comment 14 Clifford Perry 2007-11-03 01:24:05 UTC
I am not certain how valid this feature change request to yum is:

Allow yum, that if it gets a complete rpm, instead of the partial rpm, header
only (as requested by a 206 Partial Content request) - to notice that it got a
complete rpm, and then gracefully parse it for the headers and use that rpm
already downloaded, then re-download the rpm. 

Cliff. 

Comment 15 RHEL Program Management 2007-11-03 01:24:36 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 16 James Antill 2007-11-06 00:22:01 UTC
 With the post RHEL-5.2 yum (3.2.7ish) we shouldn't be downloading headers, much
like Fedora doesn't. So that should solve this bug.


Comment 17 Miroslav Suchý 2007-11-06 08:57:48 UTC
And what if connection is dropped during downloading? I think yum then try to
download only rest of file. I.e. use range header. Which will couse problem too.

Comment 18 James Laska 2007-11-06 19:47:05 UTC
It sounds like the move to 3.2.7 will change the header download behavior, will
it also address comment#17?

Comment 19 James Antill 2007-11-06 20:17:23 UTC
 Well comment#17 wasn't in the feature request in comment#14 ... and this
failure mode would be much less severe, no? (You could just yum clean all, and
try again).
 However AFAIK yum doesn't currently resume package downloads, in fact the only
thing that does range requests is the header downloading function.


Comment 21 Miroslav Suchý 2007-11-07 10:54:13 UTC
I'm opening this bug again. I hope jlaska resolved it as NOTABUG by accident.
Becouse it is a bug.

Comment 22 James Laska 2007-11-07 12:19:25 UTC
msuchy: yes that was an accident, my apologies.  Thank you for catching! 

Comment 23 James Antill 2007-11-09 22:07:22 UTC
 Ok, I'm an idiot, but at least I can speak to seth ... yum doesn't do the
partial downloads because python-urlgrabber does it internally, so it looks like
the disconnected from proxy problem will still exist post 5.2 (although "yum
clean all" should fix it). 


Comment 24 James Antill 2008-01-30 13:55:29 UTC
 So the current RHEL-5.2 errata has the fix which makes it so headers aren't
downloaded anymore. This should solve most of the problem here.
 We can't fix the partial download is actually full download, easily, from
within yum ... and I think it will retry on everything apart from the (very
small) repomd.xml.

 So I'm going to add this BZ as fixed to the errata, unless you'd prefer me not
to, as I fixed everything I said I could fix.


Comment 27 Miroslav Suchý 2008-02-27 09:13:11 UTC
OK for me.

Comment 30 errata-xmlrpc 2008-05-21 14:20:50 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2008-0388.html