rpm/rpm-5.4.7-only-generate-devel-deps-for-symlinks-start-with-lib.patch
2012-08-01 14:59:23 +04:00

44 lines
1.4 KiB
Diff

--- rpm-5.4.7/lib/rpmds.c.req_devel~ 2012-03-16 19:48:32.709515656 +0100
+++ rpm-5.4.7/lib/rpmds.c 2012-03-16 19:53:14.181863892 +0100
@@ -3547,10 +3547,15 @@ int rpmdsSymlink(const char * fn, int fl
"libnss_hesiod.so", "libnss_nis.so", "libnss_nisplus.so", "libpthread.so",
"libresolv.so", "librt.so", "libutil.so", "libthread_db.so"};
ARGV_t deps = NULL;
-
+ miRE mire;
+
+ mire = mireNew(RPMMIRE_REGEX, RPMTAG_FILEPATHS);
/* Filename must end with ".so" to be devel(...) dependency. */
- if ((s = strrchr(fn, '.')) && strcmp(s, ".so"))
- return 0;
+ if (!mireRegcomp(mire, "^.*/(|usr/)lib(|64)/lib.*\\.so$"))
+ xx = mireRegexec(mire, fn, (size_t) 0);
+ mire = mireFree(mire);
+ if (xx < 0)
+ return 0;
/*@-castfcnptr@*/
if (_rpmds_debug < 0)
@@ -3566,14 +3571,20 @@ fprintf(stderr, "*** rpmdsELF(%s, %d, %p
}
if (is_symlink) {
-#ifdef NOT_YET
+ const char *bn;
if ((lnklen = readlink(fn, path, MAXPATHLEN - 1)) == -1) {
warn("%s", fn);
return -1;
}
/* XXX: unused, path should expand to absolute path... */
path[lnklen] = '\0';
-#endif
+
+ /* if filename of library linked to isn't consistent with symlink
+ * filename, then we skip it
+ */
+ bn = basename((char*)fn);
+ if (strncmp(bn, basename(path), (size_t)(strstr(bn, ".so") - bn)))
+ return 0;
} else {
FILE *fp = fopen(fn, "r");
char buf[BUFSIZ];