|
Mark Wielaard |
e9309e |
From 13369a562f5cba34779e238b2d6ae0b683ff3b1e Mon Sep 17 00:00:00 2001
|
|
Mark Wielaard |
e9309e |
From: Mark Wielaard <mark@klomp.org>
|
|
Mark Wielaard |
e9309e |
Date: Thu, 29 Jun 2017 13:26:26 +0200
|
|
Mark Wielaard |
284dc3 |
Subject: [PATCH] Change mkattr to always create a %defattr with explicitly set
|
|
Mark Wielaard |
284dc3 |
modes.
|
|
Mark Wielaard |
e9309e |
|
|
Mark Wielaard |
e9309e |
mkattr used "-" as default mode which would pick up the mode for files
|
|
Mark Wielaard |
e9309e |
as they were on disk. This could cause files generated by rpmbuild to
|
|
Mark Wielaard |
e9309e |
use a "non-standard" mode if umask was set by the user. Explitictly
|
|
Mark Wielaard |
e9309e |
use 755 for directories and 644 for files to make builds independent
|
|
Mark Wielaard |
e9309e |
of any umask settings.
|
|
Mark Wielaard |
e9309e |
|
|
Mark Wielaard |
e9309e |
This works as is for both files and directories, so no file argument
|
|
Mark Wielaard |
e9309e |
is necessary anymore.
|
|
Mark Wielaard |
e9309e |
|
|
Mark Wielaard |
e9309e |
https://bugzilla.redhat.com/show_bug.cgi?id=1452893
|
|
Mark Wielaard |
e9309e |
https://bugzilla.redhat.com/show_bug.cgi?id=1458839
|
|
Mark Wielaard |
e9309e |
|
|
Mark Wielaard |
e9309e |
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
Mark Wielaard |
e9309e |
(cherry picked from commit 261ba91172ca1536eaa1d76e9cde58643b66c8f3)
|
|
Mark Wielaard |
e9309e |
---
|
|
Mark Wielaard |
e9309e |
build/files.c | 17 ++++++++---------
|
|
Mark Wielaard |
e9309e |
1 file changed, 8 insertions(+), 9 deletions(-)
|
|
Mark Wielaard |
e9309e |
|
|
Mark Wielaard |
e9309e |
diff --git a/build/files.c b/build/files.c
|
|
Igor Gnatenko |
3992a6 |
index e88a5d24d..29274926c 100644
|
|
Mark Wielaard |
e9309e |
--- a/build/files.c
|
|
Mark Wielaard |
e9309e |
+++ b/build/files.c
|
|
Mark Wielaard |
e9309e |
@@ -193,13 +193,12 @@ static void dupAttrRec(const AttrRec oar, AttrRec nar)
|
|
Mark Wielaard |
e9309e |
*nar = *oar; /* struct assignment */
|
|
Mark Wielaard |
e9309e |
}
|
|
Mark Wielaard |
e9309e |
|
|
Mark Wielaard |
e9309e |
-static char *mkattr(const char *fn)
|
|
Mark Wielaard |
e9309e |
+/* Creates a default $defattr string. Can be used with argvAdd().
|
|
Mark Wielaard |
e9309e |
+ Caller owns the new string which needs to be freed when done. */
|
|
Mark Wielaard |
e9309e |
+static char *mkattr(void)
|
|
Mark Wielaard |
e9309e |
{
|
|
Mark Wielaard |
e9309e |
char *s = NULL;
|
|
Mark Wielaard |
e9309e |
- if (fn)
|
|
Mark Wielaard |
e9309e |
- rasprintf(&s, "%s(-,%s,%s) %s", "%attr", "root", "root", fn);
|
|
Mark Wielaard |
e9309e |
- else
|
|
Mark Wielaard |
e9309e |
- rasprintf(&s, "%s(-,%s,%s)", "%defattr", "root", "root");
|
|
Mark Wielaard |
e9309e |
+ rasprintf(&s, "%s(644,%s,%s,755)", "%defattr", "root", "root");
|
|
Mark Wielaard |
e9309e |
return s;
|
|
Mark Wielaard |
e9309e |
}
|
|
Mark Wielaard |
e9309e |
|
|
Mark Wielaard |
e9309e |
@@ -1829,7 +1828,7 @@ static int generateBuildIDs(FileList fl, ARGV_t *files)
|
|
Mark Wielaard |
e9309e |
debugiddir = rpmGetPath(fl->buildRoot, DEBUG_ID_DIR, NULL);
|
|
Mark Wielaard |
e9309e |
|
|
Mark Wielaard |
e9309e |
/* Make sure to reset all file flags to defaults. */
|
|
Mark Wielaard |
e9309e |
- attrstr = mkattr(NULL);
|
|
Mark Wielaard |
e9309e |
+ attrstr = mkattr();
|
|
Mark Wielaard |
e9309e |
argvAdd(files, attrstr);
|
|
Mark Wielaard |
e9309e |
free (attrstr);
|
|
Mark Wielaard |
e9309e |
|
|
Mark Wielaard |
e9309e |
@@ -2783,7 +2782,7 @@ static void filterDebuginfoPackage(rpmSpec spec, Package pkg,
|
|
Mark Wielaard |
e9309e |
if (access(path, F_OK) == 0) {
|
|
Mark Wielaard |
e9309e |
/* Append the file list preamble */
|
|
Mark Wielaard |
e9309e |
if (!files) {
|
|
Mark Wielaard |
e9309e |
- char *attr = mkattr(NULL);
|
|
Mark Wielaard |
e9309e |
+ char *attr = mkattr();
|
|
Mark Wielaard |
e9309e |
argvAdd(&files, attr);
|
|
Mark Wielaard |
e9309e |
argvAddDir(&files, DEBUG_LIB_DIR);
|
|
Mark Wielaard |
e9309e |
free(attr);
|
|
Mark Wielaard |
e9309e |
@@ -2843,7 +2842,7 @@ static int addDebugDwz(Package pkg, char *buildroot)
|
|
Mark Wielaard |
e9309e |
rasprintf(&path, "%s%s", buildroot, DEBUG_DWZ_DIR);
|
|
Mark Wielaard |
e9309e |
if (lstat(path, &sbuf) == 0 && S_ISDIR(sbuf.st_mode)) {
|
|
Mark Wielaard |
e9309e |
if (!pkg->fileList) {
|
|
Mark Wielaard |
e9309e |
- char *attr = mkattr(NULL);
|
|
Mark Wielaard |
e9309e |
+ char *attr = mkattr();
|
|
Mark Wielaard |
e9309e |
argvAdd(&pkg->fileList, attr);
|
|
Mark Wielaard |
e9309e |
argvAddDir(&pkg->fileList, DEBUG_LIB_DIR);
|
|
Mark Wielaard |
e9309e |
free(attr);
|
|
Mark Wielaard |
e9309e |
@@ -2877,7 +2876,7 @@ static int addDebugSrc(Package pkg, char *buildroot)
|
|
Mark Wielaard |
e9309e |
continue;
|
|
Mark Wielaard |
e9309e |
rasprintf(&path, "%s/%s", DEBUG_SRC_DIR, de->d_name);
|
|
Mark Wielaard |
e9309e |
if (!pkg->fileList) {
|
|
Mark Wielaard |
e9309e |
- char *attr = mkattr(NULL);
|
|
Mark Wielaard |
e9309e |
+ char *attr = mkattr();
|
|
Mark Wielaard |
e9309e |
argvAdd(&pkg->fileList, attr);
|
|
Mark Wielaard |
e9309e |
free(attr);
|
|
Mark Wielaard |
e9309e |
}
|