rpm/rpm-4.7.1-rpmfc-data.patch

44 lines
1.6 KiB
Diff

commit fa9fcc89146f08bce3b51d96d0ec9d4175db6978
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Thu Nov 26 10:22:41 2009 +0200
Dont fail build on unrecognized non-executable files (ticket #105)
- Generally only executable files are critical for dependency extraction,
whereas oddball application data files can cause unnecessary build
failure due to libmagic misdetections etc, so just let non-executables
pass with a warning and mark them as unknown data
(cherry picked from commit cfcd1f9bd98d5d0fc46a84931984efec3b9d47e2)
diff --git a/build/rpmfc.c b/build/rpmfc.c
index bcb5383..e4ba6b2 100644
--- a/build/rpmfc.c
+++ b/build/rpmfc.c
@@ -1245,6 +1245,7 @@ rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, rpm_mode_t * fmode)
for (fc->ix = 0; fc->ix < fc->nfiles; fc->ix++) {
const char * ftype;
rpm_mode_t mode = (fmode ? fmode[fc->ix] : 0);
+ int is_executable = (mode & (S_IXUSR|S_IXGRP|S_IXOTH));
s = argv[fc->ix];
slen = strlen(s);
@@ -1277,11 +1278,16 @@ rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, rpm_mode_t * fmode)
ftype = magic_file(ms, s);
if (ftype == NULL) {
- rpmlog(RPMLOG_ERR,
+ rpmlog(is_executable ? RPMLOG_ERR : RPMLOG_WARNING,
_("Recognition of file \"%s\" failed: mode %06o %s\n"),
s, mode, magic_error(ms));
- magic_close(ms);
- return RPMRC_FAIL;
+ /* only executable files are critical to dep extraction */
+ if (is_executable) {
+ magic_close(ms);
+ return RPMRC_FAIL;
+ }
+ /* unrecognized non-executables get treated as "data" */
+ ftype = "data";
}
}