[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.
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().
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.
Yup, --excludepath is broke. *** This bug has been marked as a duplicate of 19666 ***