Bug 99304

Summary: rpm -U --relocate <old>=<new> does delete files
Product: [Retired] Red Hat Linux Reporter: Need Real Name <stefan.harms>
Component: rpmAssignee: Paul Nasrat <pnasrat>
Status: CLOSED RAWHIDE QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 9CC: jason.brittain
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-11-29 19:44:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Attachments:
Description Flags
Test case that reproduces the problem. none

Description Need Real Name 2003-07-17 11:45:05 UTC
Description of problem:
When upgrading a package with a newer version using the relocate option, RPM 
seems to delete the files installed as part of that package, and the RPM 
database says the system has the newer version.

Version-Release number of selected component (if applicable):
rpm-4.2-0.69

How reproducible:
Always

Steps to Reproduce:
1.rpm -i --relocate <defaultpath>=<newpath> <package.rpm>
2.rpm -U --relocate <defaultpath>=<newpath> <updated package.rpm>
3.rpm -q <package> returns the new version strip
4.rpm -V <package> reports all files of the package as missing    

Actual results:
all files which should be upgraded are gone

Expected results:
upgraded files

Additional info:

Comment 1 Jeff Johnson 2003-07-18 20:41:00 UTC
Can you supply an explicit test case? Otherwise, I cannot
fix anything.

Comment 2 Jason Brittain 2003-10-11 02:32:02 UTC
Created attachment 95114 [details]
Test case that reproduces the problem.

Comment 3 Jason Brittain 2003-10-11 02:34:57 UTC
Here's how to reproduce this bug on Red Hat 9:

Download my test case tar.gz file:
https://bugzilla.redhat.com/bugzilla/attachment.cgi?id=95114&action=view

Unpack the test case source in /tmp:
# cd /tmp
# tar zxvf bz-99304-testcase.tar.gz
# cd bz-99304-testcase

Build the relocateable-1.0-1.noarch.rpm package:
# ./build1.sh

Build the relocateable-1.0-2.noarch.rpm package:
# ./build2.sh

Install the relocateable-1.0-1.noarch.rpm package:
# rpm -ivh --prefix /tmp/bz-99304-testcase/test
RPMS/noarch/relocateable-1.0-1.noarch.rpm 
Preparing...                ########################################### [100%]
   1:relocateable           ########################################### [100%]

List all files installed as part of the "relocateable" package:
# rpm -ql relocateable
/tmp/bz-99304-testcase/test
/tmp/bz-99304-testcase/test/readme.txt

Query RPM to find out what package owns the test/readme.txt file:
# rpm -qf test/readme.txt 
relocateable-1.0-1
# ls -la test/readme.txt 
-rw-r--r--    1 root     root           74 Oct 10 19:01 test/readme.txt
# cat test/readme.txt 
Hi!
This file is the only file contained in the relocateable RPM package.

Looks good..

Now upgrade to the relocateable-1.0-2.noarch.rpm package, in the same
prefix in the file system:
# rpm -Uvh --prefix /tmp/bz-99304-testcase/test
RPMS/noarch/relocateable-1.0-2.noarch.rpm 
Preparing...                ########################################### [100%]
   1:relocateable           ########################################### [100%]

Now look at the packages files:
# cat test/readme.txt 
cat: test/readme.txt: No such file or directory
# ls -la test
ls: test: No such file or directory

But, RPM says it should be there.
# rpm -ql relocateable
/tmp/bz-99304-testcase/test
/tmp/bz-99304-testcase/test/readme.txt

Try upgrading it again (second upgrade attempt), just after that with --force:
# rpm -Uvh --force --prefix /tmp/bz-99304-testcase/test
RPMS/noarch/relocateable-1.0-2.noarch.rpm
Preparing...                ########################################### [100%]
   1:relocateable           ########################################### [100%]

Now look at the packages files:
# cat test/readme.txt
Hi!
This file is the only file contained in the relocateable RPM package.
# ls -la test/readme.txt 
-rw-r--r--    1 root     root           74 Oct 10 19:01 test/readme.txt

It shows back up again on the second attempt to upgrade to the same RPM.
All subsequent requests to upgrade to the same RPM work fine too, it's
just the first time you try to upgrade to a new rev ("Release") of the
package.

At least on my RH9 machine, if you don't relocate the package, upgrading
it seems to work fine.  But, I want to be able to relocate it.  :)

I was unable to reproduce this same behavior on Red Hat 7.3.

Thanks!



Comment 4 Jason Brittain 2004-02-11 17:01:03 UTC
Hi there.  This bug doesn't seem to be getting any attention.  Is
someone working on it?  It says it's assigned to (Jeff Johnson), but
that the status is still NEEDINFO.  Is that status wrong?  If not,
what info is still missing?  I'd really like this bug fixed.

Comment 5 Paul Nasrat 2005-11-29 19:44:36 UTC
Tested your case (thanks for the detailed test case) on rpm-4.4.2-9.i386
(tomorrows rawhide) and worked:

rpm -Uvh --prefix /tmp/bz-99304-testcase/test/ RPMS/relocateable-1.0-2.noarch.rpm
Preparing...                ########################################### [100%]
   1:relocateable           ########################################### [100%]

[pauln@enki bz-99304-testcase]$ cat test/readme.txt
Hi!
This file is the only file contained in the relocateable RPM package.

$ rpm -ql relocateable
/tmp/bz-99304-testcase/test
/tmp/bz-99304-testcase/test/readme.txt
$ rpm -q relocateable
relocateable-1.0-2.noarch


Comment 6 Jason Brittain 2005-12-08 06:18:23 UTC
I must say that I'm not at all surprised that it works, when you test it
more than two years later.  :)

Thanks.