Bug 980502 - libguestfs is not able to be built with yum cache from multiple repos
libguestfs is not able to be built with yum cache from multiple repos
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs (Show other bugs)
6.5
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-02 10:23 EDT by Tomas Tomecek
Modified: 2013-11-20 23:45 EST (History)
5 users (show)

See Also:
Fixed In Version: libguestfs-1.20.9-7.el6
Doc Type: Bug Fix
Doc Text:
(This is a build-time problem, and does not need to be documented)
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-20 23:45:44 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Tomas Tomecek 2013-07-02 10:23:11 EDT
If yum cache at /var/cache/yum contains packages from multiple repos and there are duplicate rpms, build fails:

cp: will not overwrite just-created `repo/file-devel-5.04-15.el6.x86_64.rpm' with `/var/cache/yum/build-released/packages/file-devel-5.04-15.el6.x86_64.rpm'

Unfortunately this is happening quite often when we try to run static analysis scans on this package in mock chroot environment. We have to modify SRPM to scan it properly.

Slight modification was working for me fine (cp won't mind overwrite now):
--- a/libguestfs.spec
+++ b/libguestfs.spec
@@ -649,7 +649,9 @@ if ping -c 3 -w 20 8.8.8.8 && wget http://libguestfs.org -O /dev/null; then
   extra=
 else
   mkdir repo
-  find /var/cache/yum -type f -name '*.rpm' -print0 | xargs -0 cp -t repo
+  for package in $(find /var/cache/yum -type f -name '*.rpm') ; do
+   cp $package repo ;
+  done
   createrepo repo
   cat > yum.conf <<EOF
 [main]


RPMs we had problem with:
  libguestfs-1.16.34-2.el6
  libguestfs-1.20.9-6.el6
Comment 2 Richard W.M. Jones 2013-07-02 11:09:53 EDT
Cheers, yes this is a bug and I'll include this shortly.
Comment 3 Richard W.M. Jones 2013-07-03 10:58:28 EDT
I fixed this in a slightly different way:

--- a/libguestfs.spec
+++ b/libguestfs.spec
@@ -548,7 +548,8 @@ if ping -c 3 -w 20 8.8.8.8 && wget http://libguestfs.org -O /dev/null; then
   extra=
 else
   mkdir repo
-  find /var/cache/yum -type f -name '*.rpm' -print0 | xargs -0 cp -t repo
+  # -n 1 because of RHBZ#980502.
+  find /var/cache/yum -type f -name '*.rpm' -print0 | xargs -0 -n 1 cp -t repo
   createrepo repo
   cat > yum.conf <<EOF
 [main]
Comment 4 Tomas Tomecek 2013-07-04 08:05:36 EDT
Well, your fix is much more secure than mine. I verified it and it works very well. Thank you.
Comment 5 bfan 2013-07-30 01:55:28 EDT
Hello Tomas, 
May I know you verified this bug with developer's patch or a new build package?

If only using patch, could you please help us to verify it with libguestfs-1.20.9-7.el6, thanks
Comment 6 Tomas Tomecek 2013-07-30 04:57:36 EDT
(In reply to bfan from comment #5)
> Hello Tomas, 
> May I know you verified this bug with developer's patch or a new build
> package?
> 
> If only using patch, could you please help us to verify it with
> libguestfs-1.20.9-7.el6, thanks

I've just rebuilt it (with multiple yum repos enabled) and it passed.

This was the problematic part (no errors or even warnings anymore):

+ mkdir repo
+ find /var/cache/yum -type f -name '*.rpm' -print0
+ xargs -0 -n 1 cp -t repo 

So, I can verify that the bug is fixed.
Comment 9 Lingfei Kong 2013-10-21 01:41:37 EDT
Hello Tomas, 
As I see, this bug occurred when build the libguestfs package, I spent time to read libguestfs.spec and try to build the package,but failed.  It would be easier for you to build the libguestfs package than me, so could you help to reproduce and verify this bug with the latest version of libguestfs: libguestfs-1.20.11-2.el6 ?

Thanks & Best regards
Comment 10 Lingfei Kong 2013-10-21 01:56:37 EDT
Hello Tomas, 
As I see, this bug occurred when build the libguestfs package, I spent time to read libguestfs.spec and try to build the package,but failed.  It would be easier for you to build the libguestfs package than me, so could you help to reproduce and verify this bug with the latest version of libguestfs: libguestfs-1.20.11-2.el6 ?

Thanks & Best regards
Comment 13 Lingfei Kong 2013-10-21 20:37:41 EDT
Hello Tomas,
Thanks for your help. Also, I checked libguestfs.spec of libguestfs-1.20.11-2.el6, it have been changed like Comment 3. So, this bug is fixed.
Comment 15 errata-xmlrpc 2013-11-20 23:45:44 EST
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.

http://rhn.redhat.com/errata/RHSA-2013-1536.html

Note You need to log in before you can comment on or make changes to this bug.