rpm/rpm-5.4.5-only-generate-devel-deps-for-symlinks-start-with-lib.patch
2012-03-10 04:58:42 +04:00

45 lines
1.3 KiB
Diff

--- rpm-5.4.5/lib/rpmds.c.req_devel~ 2012-03-08 00:02:26.255074546 +0100
+++ rpm-5.4.5/lib/rpmds.c 2012-03-09 04:37:31.993839729 +0100
@@ -3524,7 +3524,7 @@ int rpmdsSymlink(const char * fn, int fl
int cnt;
int i;
char buf[BUFSIZ];
- const char * s;
+ const char * s, * bn;
int is_executable;
int is_symlink;
const char * soname = NULL;
@@ -3548,8 +3548,10 @@ int rpmdsSymlink(const char * fn, int fl
"libresolv.so", "librt.so", "libutil.so", "libthread_db.so"};
ARGV_t deps = NULL;
+ bn = basename((char*)fn);
+
/* Filename must end with ".so" to be devel(...) dependency. */
- if ((s = strrchr(fn, '.')) && strcmp(s, ".so"))
+ if (!(!strncmp(bn, "lib", sizeof("lib")-1) && (s = strchr(bn, '.')) && !strcmp(s, ".so")))
return 0;
/*@-castfcnptr@*/
@@ -3566,14 +3568,19 @@ fprintf(stderr, "*** rpmdsELF(%s, %d, %p
}
if (is_symlink) {
-#ifdef NOT_YET
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
+ */
+ if (strncmp(bn, basename(path), (size_t)(strchr(bn, '.') - bn)))
+ return 0;
+
} else {
FILE *fp = fopen(fn, "r");
char buf[BUFSIZ];