Bug 11979 - rpm ignores excludepath on some packages
Summary: rpm ignores excludepath on some packages
Status: CLOSED DUPLICATE of bug 19666
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm   
(Show other bugs)
Version: 6.2
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2000-06-08 13:18 UTC by peter.benie
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-10-04 17:33:04 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description peter.benie 2000-06-08 13:18:21 UTC

rpm --excludepath /usr/doc --excludepath /opt -ivh \
will cause rpm to segault in relocateFileList() at line 436 of
	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"), 

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 

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 ***

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