Bug 11979

Summary: rpm ignores excludepath on some packages
Product: [Retired] Red Hat Linux Reporter: peter.benie
Component: rpmAssignee: Jeff Johnson <jbj>
Status: CLOSED DUPLICATE QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 6.2   
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: 2000-10-04 17:33:04 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 peter.benie 2000-06-08 13:18:21 UTC
[rpm-3.0.4-0.48]

rpm --excludepath /usr/doc --excludepath /opt -ivh \
         kpackage-1.3.10-3.i386.rpm
will cause rpm to segault in relocateFileList() at line 436 of
rpm-3.0.4/lib/transaction.c:
	len = strlen(relocations[j].newPath);

When excluding a path, rpm adds the exclusion to the list of redirects:
oldPath is set to the excluded path, and newPath is set to NULL.
When installing a package, relocateFileList is called twice: once with
action!=NULL, and once with action==NULL. Line 436 is avoided when
action!=NULL due to the explicit test on lines 424-430:

  if (actions && relocations[j].newPath == NULL) {
    /* On install, a relocate to NULL means skip the path. */
    skipDirList[i] = 1;
    rpmMessage(RPMMESS_DEBUG, _("excluding directory %s\n"), 
      dirNames[i]);
   continue;
  }

When relocateFileList is called with action set to NULL, the above test
fails and the NULL pointer is dereferenced.

Comment 1 peter.benie 2000-06-08 14:23:23 UTC
If you have a package that includes /usr/doc/foo, but not /usr/doc (eg.
make-3.78.1-4.i386.rpm), then rpm ignores --excludepath /usr/doc.

The logic in rpm is a little strange. Again, this is in relocateFileList:

1) Create skipDirlist[], initialised to NULLs.

2) Interate over files, honouring skipDirList[].
   Set skipDirList[i] if the filename in an RPM exactly matches a redirect
and      is an excluded directory. (Never happens for make-3.78.1-4.)

3) Iterate over directories.
   Set skipDirList[i] if the directory is excluded.

4) Throw skipDirList[] away.

The effect is that while the debug messages from (3) say that /usr/doc/foo is
excluded, the information about which directories are excluded is thrown away
before being used.

The comments in relocateFileList() imply that (1) and (2) used to be in the
opposite order, which makes sense for skipDirList().


Comment 2 Vincent 2000-10-04 17:33:02 UTC
I have tried to use the "--excludepath /usr/share/doc" with quite a few RH7's 
packages on a new Redhat 7 system.  The rpm still install the documents in the 
/usr/share/doc directory.  If I use the "--excludepath /usr/doc", the rpm will 
install the documentations in the /usr/doc directory instead of /usr/share/doc 
directory.

Comment 3 Jeff Johnson 2001-01-08 16:04:49 UTC
Yup, --excludepath is broke.

*** This bug has been marked as a duplicate of 19666 ***