Add fix to reset buildid file attributes. (#1432372)

This commit is contained in:
Mark Wielaard 2017-03-15 20:11:39 +01:00
parent 1a7230a63a
commit 3e1463c90d
2 changed files with 62 additions and 1 deletions

View File

@ -0,0 +1,57 @@
diff --git a/build/files.c b/build/files.c
index 6021643..9479e6e 100644
--- a/build/files.c
+++ b/build/files.c
@@ -1797,6 +1797,7 @@ static int generateBuildIDs(FileList fl)
char *mainiddir = NULL;
char *debugiddir = NULL;
if (rc == 0) {
+ char *attrstr;
/* Add .build-id directories to hold the subdirs/symlinks. */
#define BUILD_ID_DIR "/usr/lib/.build-id"
#define DEBUG_ID_DIR "/usr/lib/debug/.build-id"
@@ -1804,6 +1805,18 @@ static int generateBuildIDs(FileList fl)
mainiddir = rpmGetPath(fl->buildRoot, BUILD_ID_DIR, NULL);
debugiddir = rpmGetPath(fl->buildRoot, DEBUG_ID_DIR, NULL);
+ /* Make sure to reset all file flags to defaults.
+ Uses parseForAttr to reset ar, arFlags, and specdFlags.
+ Note that parseForAttr pokes at the attrstr, so we cannot
+ just pass a static string. */
+ fl->def.verifyFlags = RPMVERIFY_ALL;
+ fl->cur.verifyFlags = RPMVERIFY_ALL;
+ fl->def.specdFlags |= SPECD_VERIFY;
+ fl->cur.specdFlags |= SPECD_VERIFY;
+ attrstr = xstrdup ("%defattr(-,root,root)");
+ parseForAttr(fl->pool, attrstr, 1, &fl->def);
+ free (attrstr);
+
/* Supported, but questionable. */
if (needMain && needDbg)
rpmlog(RPMLOG_WARNING,
@@ -1813,8 +1826,12 @@ static int generateBuildIDs(FileList fl)
if ((rc = rpmioMkpath(mainiddir, 0755, -1, -1)) != 0) {
rpmlog(RPMLOG_ERR, "%s %s: %m\n", errdir, mainiddir);
} else {
+ rasprintf (&attrstr, "%s %s", "%attr(-,root,root) ",
+ mainiddir);
+ parseForAttr(fl->pool, attrstr, 0, &fl->cur);
fl->cur.isDir = 1;
rc = addFile(fl, mainiddir, NULL);
+ free (attrstr);
}
}
@@ -1822,8 +1839,12 @@ static int generateBuildIDs(FileList fl)
if ((rc = rpmioMkpath(debugiddir, 0755, -1, -1)) != 0) {
rpmlog(RPMLOG_ERR, "%s %s: %m\n", errdir, debugiddir);
} else {
+ rasprintf (&attrstr, "%s %s", "%attr(-,root,root) ",
+ debugiddir);
+ parseForAttr(fl->pool, attrstr, 0, &fl->cur);
fl->cur.isDir = 1;
rc = addFile(fl, debugiddir, NULL);
+ free (attrstr);
}
}
}

View File

@ -29,7 +29,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
Release: %{?snapver:0.%{snapver}.}7%{?dist}
Release: %{?snapver:0.%{snapver}.}8%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/%{srcdir}/%{name}-%{srcver}.tar.bz2
@ -86,6 +86,7 @@ Patch260: 0011-Add-option-to-have-unique-debug-source-dirs-across-v.patch
Patch261: 0012-generateBuildIDs-Don-t-warn-or-error-for-object-file.patch
Patch262: 0013-missing_build_ids_terminate_build.patch
Patch263: 0014-generateBuildIDs-Fix-error-handling.patch
Patch264: 0015-reset-buildid-file-attrs.patch
# These are not yet upstream
Patch302: rpm-4.7.1-geode-i686.patch
@ -587,6 +588,9 @@ exit 0
%doc doc/librpm/html/*
%changelog
* Wed Mar 15 2017 Mark Wielaard <mjw@redhat.com> - 4.13.0.1-8
- Add fix to reset buildid file attributes (#1432372)
* Fri Mar 10 2017 Mark Wielaard <mjw@redhat.com> - 4.13.0.1-7
- Add fixup fix for build-id warnings on object files (#1430587)