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