Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Red Hat Linux (http://www.linux-archive.org/red-hat-linux/)
-   -   Ignore duplicate opening of installed rpm package file (#506361). (http://www.linux-archive.org/red-hat-linux/597035-ignore-duplicate-opening-installed-rpm-package-file-506361-a.html)

Radek Vykydal 11-11-2011 08:55 AM

Ignore duplicate opening of installed rpm package file (#506361).
 
This is second take on the fix, the first one broke some other
methods of installation (bug #752507)
The patch is relative to 5.7 not to the previous take.

Yum calls open file callback twice when installing some packages which
makes our callback try second download and fail in specific
case of nfs: method and http: additional repository.

The fail is caused by self.method.unlinkFilename(fn) in
RPMCALLBACK_INST_CLOSE_FILE being driven by method (i.e. do nothing
for nfs, remove rpm file from cache for http), not by repo in question.
In the problematic case the package of additional http repository
is not removed from cache because the install method is nfs.
As a consequence, in the second call of RPMCALLBACK_INST_OPEN_FILE
repo.getPackage(po) fails to download the package.

The second call of the OPEN_FILE callback is a bug in yum.

Resolves: rhbz#506361
---
yuminstall.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/yuminstall.py b/yuminstall.py
index 209a8d6..6d2b670 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -134,6 +134,10 @@ class simpleCallback:

nvra = "%s" %(po,)
self.instLog.write(self.modeText % (nvra,))
+ if nvra in self.files:
+ fn = self.files[nvra].name
+ else:
+ fn = None

self.instLog.flush()
self.files[nvra] = None
@@ -142,8 +146,8 @@ class simpleCallback:

while self.files[nvra] == None:
try:
- fn = repo.getPackage(po)
-
+ if not (fn and os.path.exists(fn)):
+ fn = repo.getPackage(po)
f = open(fn, 'r')
self.files[nvra] = f
except NoMoreMirrorsRepoError:
--
1.7.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

"Brian C. Lane" 11-14-2011 04:44 PM

Ignore duplicate opening of installed rpm package file (#506361).
 
On Fri, Nov 11, 2011 at 10:55:09AM +0100, Radek Vykydal wrote:
> This is second take on the fix, the first one broke some other
> methods of installation (bug #752507)
> The patch is relative to 5.7 not to the previous take.
>
> Yum calls open file callback twice when installing some packages which
> makes our callback try second download and fail in specific
> case of nfs: method and http: additional repository.
>
> The fail is caused by self.method.unlinkFilename(fn) in
> RPMCALLBACK_INST_CLOSE_FILE being driven by method (i.e. do nothing
> for nfs, remove rpm file from cache for http), not by repo in question.
> In the problematic case the package of additional http repository
> is not removed from cache because the install method is nfs.
> As a consequence, in the second call of RPMCALLBACK_INST_OPEN_FILE
> repo.getPackage(po) fails to download the package.
>
> The second call of the OPEN_FILE callback is a bug in yum.

This looks good to me.

--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

Panu Matilainen 11-14-2011 05:39 PM

Ignore duplicate opening of installed rpm package file (#506361).
 
On 11/14/2011 07:44 PM, Brian C. Lane wrote:

On Fri, Nov 11, 2011 at 10:55:09AM +0100, Radek Vykydal wrote:

This is second take on the fix, the first one broke some other
methods of installation (bug #752507)
The patch is relative to 5.7 not to the previous take.

Yum calls open file callback twice when installing some packages which
makes our callback try second download and fail in specific
case of nfs: method and http: additional repository.

The fail is caused by self.method.unlinkFilename(fn) in
RPMCALLBACK_INST_CLOSE_FILE being driven by method (i.e. do nothing
for nfs, remove rpm file from cache for http), not by repo in question.
In the problematic case the package of additional http repository
is not removed from cache because the install method is nfs.
As a consequence, in the second call of RPMCALLBACK_INST_OPEN_FILE
repo.getPackage(po) fails to download the package.

The second call of the OPEN_FILE callback is a bug in yum.


This looks good to me.


Um, I might be missing some background / details here, but just in case...

Yum does not issue RPMCALLBACK_INST_OPEN_FILE, rpm does. And when it
does, it really needs the file: OPEN_FILE can get called a total of
three times (in RHEL-5) for a given package during a transaction: once
for %pretrans, once for actual install and once at %posttrans. If
anaconda wont hand an open file back as requested, the rpm operation
will fail.


Of those reopens %posttrans is the silly one, rpm already has installed
the package but yet insists on reopening it from disk. Newer rpm
versions use the already installed header from rpmdb instead to avoid
requiring packages to be kept around in download cache, but in RHEL-5
packages which have %posttrans scripts need to be kept around until the
whole transaction has been completed.


- Panu -

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

Radek Vykydal 11-15-2011 08:49 AM

Ignore duplicate opening of installed rpm package file (#506361).
 
On 11/14/2011 07:39 PM, Panu Matilainen wrote:

On 11/14/2011 07:44 PM, Brian C. Lane wrote:

On Fri, Nov 11, 2011 at 10:55:09AM +0100, Radek Vykydal wrote:

This is second take on the fix, the first one broke some other
methods of installation (bug #752507)
The patch is relative to 5.7 not to the previous take.

Yum calls open file callback twice when installing some packages which
makes our callback try second download and fail in specific
case of nfs: method and http: additional repository.

The fail is caused by self.method.unlinkFilename(fn) in
RPMCALLBACK_INST_CLOSE_FILE being driven by method (i.e. do nothing
for nfs, remove rpm file from cache for http), not by repo in question.
In the problematic case the package of additional http repository
is not removed from cache because the install method is nfs.
As a consequence, in the second call of RPMCALLBACK_INST_OPEN_FILE
repo.getPackage(po) fails to download the package.

The second call of the OPEN_FILE callback is a bug in yum.


This looks good to me.


Um, I might be missing some background / details here, but just in
case...


Yum does not issue RPMCALLBACK_INST_OPEN_FILE, rpm does. And when it
does, it really needs the file: OPEN_FILE can get called a total of
three times (in RHEL-5) for a given package during a transaction: once
for %pretrans, once for actual install and once at %posttrans. If
anaconda wont hand an open file back as requested, the rpm operation
will fail.


Of those reopens %posttrans is the silly one, rpm already has
installed the package but yet insists on reopening it from disk. Newer
rpm versions use the already installed header from rpmdb instead to
avoid requiring packages to be kept around in download cache, but in
RHEL-5 packages which have %posttrans scripts need to be kept around
until the whole transaction has been completed.


- Panu -



Thanks a lot for making it clear, I was mislead by the fact that the
posttrans call (I wasn't aware of) happened with exactly one package for
a transaction in both of my test cases and it went away in rhel 6, so it
smelled like a bug to me. I only asked yum for info, should have gone
also to rpm. Anyway, the fix in anaconda seems appropriate.


Radek


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

Panu Matilainen 11-15-2011 01:30 PM

Ignore duplicate opening of installed rpm package file (#506361).
 
On 11/15/2011 11:49 AM, Radek Vykydal wrote:

On 11/14/2011 07:39 PM, Panu Matilainen wrote:

On 11/14/2011 07:44 PM, Brian C. Lane wrote:

On Fri, Nov 11, 2011 at 10:55:09AM +0100, Radek Vykydal wrote:

This is second take on the fix, the first one broke some other
methods of installation (bug #752507)
The patch is relative to 5.7 not to the previous take.

Yum calls open file callback twice when installing some packages which
makes our callback try second download and fail in specific
case of nfs: method and http: additional repository.

The fail is caused by self.method.unlinkFilename(fn) in
RPMCALLBACK_INST_CLOSE_FILE being driven by method (i.e. do nothing
for nfs, remove rpm file from cache for http), not by repo in question.
In the problematic case the package of additional http repository
is not removed from cache because the install method is nfs.
As a consequence, in the second call of RPMCALLBACK_INST_OPEN_FILE
repo.getPackage(po) fails to download the package.

The second call of the OPEN_FILE callback is a bug in yum.


This looks good to me.


Um, I might be missing some background / details here, but just in
case...

Yum does not issue RPMCALLBACK_INST_OPEN_FILE, rpm does. And when it
does, it really needs the file: OPEN_FILE can get called a total of
three times (in RHEL-5) for a given package during a transaction: once
for %pretrans, once for actual install and once at %posttrans. If
anaconda wont hand an open file back as requested, the rpm operation
will fail.

Of those reopens %posttrans is the silly one, rpm already has
installed the package but yet insists on reopening it from disk. Newer
rpm versions use the already installed header from rpmdb instead to
avoid requiring packages to be kept around in download cache, but in
RHEL-5 packages which have %posttrans scripts need to be kept around
until the whole transaction has been completed.

- Panu -



Thanks a lot for making it clear, I was mislead by the fact that the
posttrans call (I wasn't aware of) happened with exactly one package for
a transaction in both of my test cases and it went away in rhel 6, so it
smelled like a bug to me. I only asked yum for info, should have gone
also to rpm. Anyway, the fix in anaconda seems appropriate.


Yup, looking a bit closer the patch appears to do the right thing (apart
from logging a complaint on what's a legitimate situation), it was just
the headline of "ignoring duplicate opens" that rang alarm bells in my
head :)


- Panu -

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 07:39 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.