Bug 32517

Summary: rpm-4.0.2-7x --prefix arg gets corrupted
Product: [Retired] Red Hat Linux Reporter: Mike Pope <mpope>
Component: rpmAssignee: Jeff Johnson <jbj>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0   
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: 2001-03-28 02:42:18 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:

Description Mike Pope 2001-03-21 04:58:08 UTC
Whenever I try to use --prefix, the last significant directory-separating
slash gets dropped from the prefix directory.

[root@riesling /tmp]# mkdir /tmp/foo
[root@riesling /tmp]# rpm -Uv --prefix /tmp/foo <some-relocatable-package> 
c2man-2.41-14
error: can't unlink /tmpfoo-RPMDELETE: Is a directory
error: can't rename /tmpfoo to /tmpfoo-RPMDELETE: Is a directory
error: unpacking of archive failed on file /tmpfoo: cpio: unlink failed -
Is a directory

I can reproduce this across any combination of relocatable package and/or
choice of prefix directory.  The problem surfaced today, when I upgraded to
rpm-4.0.2-7x.

Comment 1 Jeff Johnson 2001-03-23 16:19:05 UTC
Try adding a trailing / character, as --prefix (or it's new incarnation
--reloccate <oldpath>=<newpath>) permits partial specification of paths IIRC

Comment 2 Mike Pope 2001-03-25 23:26:07 UTC
No luck, with either --prefix or --relocate, with or without trailing slash.

  [root@riesling /tmp]# rpm -Uv --test --prefix /usr/local/ zip-2.3-8.i386.rpm   
  Preparing packages for installation...
  package zip-2.3-8 is already installed
  file /usrlocal from install of zip-2.3-8 conflicts with file from package  
filesystem-2.0.7-1
  ...

(zip-2.3-8 from RH7.0, but the choice of package does not appear to matter)

Comment 3 Jeff Johnson 2001-03-26 13:44:01 UTC
But the behavior is different if you add a trailing '/'.  You can eliminate the
conflicts message by adding --nodeps. Does that install your package with
relocated
path /usr/local?

Comment 4 Mike Pope 2001-03-28 02:42:15 UTC
No, the difference was only between an install and an upgrade.  Here is a
cleaner example.

# rpm -e arpwatch
# rpm --install --prefix /tmp/foo/ arpwatch-2.1a4-29.i386.rpm 
error: can't rename /tmpfoo to /tmpfoo-RPMDELETE: Is a directory
error: unpacking of archive failed on file /tmpfoo: cpio: unlink failed - Is a
directory
# rpm --install --prefix /tmp/foo arpwatch-2.1a4-29.i386.rpm 
error: can't rename /tmpfoo to /tmpfoo-RPMDELETE: Is a directory
error: unpacking of archive failed on file /tmpfoo: cpio: unlink failed - Is a
directory
# rpm --install --relocate /usr/=/tmp/foo/ arpwatch-2.1a4-29.i386.rpm 
error: can't rename /tmpfoo to /tmpfoo-RPMDELETE: Is a directory
error: unpacking of archive failed on file /tmpfoo: cpio: unlink failed - Is a
directory
# rpm -q arpwatch
package arpwatch is not installed

The other three combinations of --relocate with trailing and non-trailing
slashes are all the same.  I am quite unconvinced the *trailing* slash (or lack
thereof) are the problem (nor should it be).

Comment 5 Jeff Johnson 2001-04-17 18:16:52 UTC
This problem is fixed in the rpm-4_0 branch in CVS, will be in rpm-4.0.3-0.5.