Bug 730120 - rpmdev-extract fails for multiple relative-path rpms
Summary: rpmdev-extract fails for multiple relative-path rpms
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rpmdevtools
Version: 15
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ville Skyttä
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-08-11 19:58 UTC by Josh Stone
Modified: 2011-11-14 22:25 UTC (History)
2 users (show)

Fixed In Version: rpmdevtools-8.2-1.fc16
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-11-14 22:25:44 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Josh Stone 2011-08-11 19:58:17 UTC
Description of problem:
If you invoke rpmdev-extract on multiple rpms with only a relative path, then it will extract the first and then fail to find the rest.

Version-Release number of selected component (if applicable):
rpmdevtools-8.1-1.fc15.noarch

How reproducible:
100%

Steps to Reproduce:
1. rpmdev-extract [multiple relative rpms]
  
Actual results:
$ ls -s1 rpm*.rpm
976K rpm-4.9.0-9.fc15.x86_64.rpm
116K rpmdevtools-8.1-1.fc15.noarch.rpm
$ rpmdev-extract -q rpm*.rpm
Error: file does not exist: 'rpmdevtools-8.1-1.fc15.noarch.rpm'

Expected results:
All rpms extracted, as it works with full paths, e.g.
$ rpmdev-extract -q $PWD/rpm*.rpm"

Additional info:
I believe the issue is simply that the original working directory is lost when unarch() opens an rpm.  The chain of "cd" in that case is:

    cd "$2"                # the output dir ($PWD or -Cdir)
            cd "$name"     # the rpm package's name
            cd ..          # back to the base output dir
    cd - >/dev/null 2>&1   # back to $OLDPWD, which is $name !

There are number of ways to solve this.  You could normalize all the rpm paths ahead of time, so they're always found, but I think that's not quite enough to get the output in the right place too.  You could explicitly remember and restore the starting path rather than relying on "cd -".  Or you could invoke that function in a () subshell so the main working directory is not affected, e.g. (unarch "$file" "$dir")

Comment 1 Ville Skyttä 2011-08-15 09:41:29 UTC
Thanks for the report.  I chose the prenormalization approach "upstream":
http://git.fedorahosted.org/git/?p=rpmdevtools.git;a=commitdiff;h=b7e6476fefd5e58425598ba7f6e41ad116f91618

Comment 2 Fedora Update System 2011-11-12 16:32:31 UTC
rpmdevtools-8.2-1.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/rpmdevtools-8.2-1.fc16

Comment 3 Fedora Update System 2011-11-13 05:32:40 UTC
Package rpmdevtools-8.2-1.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing rpmdevtools-8.2-1.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2011-15843
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2011-11-14 22:25:44 UTC
rpmdevtools-8.2-1.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.


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