Igor Gnatenko 082d5d
From ba8f2239de528f02d272aed71599a4a560ddd238 Mon Sep 17 00:00:00 2001
Igor Gnatenko 082d5d
From: Robin Lee <cheeselee@fedoraproject.org>
Igor Gnatenko 082d5d
Date: Sat, 8 Apr 2017 21:21:39 +0800
Mark Wielaard 284dc3
Subject: [PATCH] Fix non-standard inherented modes of directories in debuginfo
Igor Gnatenko 082d5d
Igor Gnatenko 082d5d
In case that binary compiled from source generated in /tmp, a
Igor Gnatenko 082d5d
/usr/src/debug/tmp directory will be created with the same mode as
Igor Gnatenko 082d5d
/tmp, a.k.a 777, which should be avoided.
Igor Gnatenko 082d5d
Igor Gnatenko 082d5d
Fixes: rhbz#641022
Igor Gnatenko 082d5d
(cherry picked from commit c707ab26362e795d3f9dba4eb87dc7ed99a28bcb)
Igor Gnatenko 082d5d
---
Igor Gnatenko 082d5d
 scripts/find-debuginfo.sh | 5 +++--
Igor Gnatenko 082d5d
 1 file changed, 3 insertions(+), 2 deletions(-)
Igor Gnatenko 082d5d
 mode change 100644 => 100755 scripts/find-debuginfo.sh
Igor Gnatenko 082d5d
Igor Gnatenko 082d5d
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
Igor Gnatenko 082d5d
old mode 100644
Igor Gnatenko 082d5d
new mode 100755
Igor Gnatenko 082d5d
index 1d3dc0623..5087c4050
Igor Gnatenko 082d5d
--- a/scripts/find-debuginfo.sh
Igor Gnatenko 082d5d
+++ b/scripts/find-debuginfo.sh
Igor Gnatenko 082d5d
@@ -443,9 +443,10 @@ if [ -s "$SOURCEFILE" ]; then
Igor Gnatenko 082d5d
   mkdir -p "${RPM_BUILD_ROOT}${debug_dest_name}"
Igor Gnatenko 082d5d
   LC_ALL=C sort -z -u "$SOURCEFILE" | grep -E -v -z '(<internal>|<built-in>)$' |
Igor Gnatenko 082d5d
   (cd "${debug_base_name}"; cpio -pd0mL "${RPM_BUILD_ROOT}${debug_dest_name}")
Igor Gnatenko 082d5d
-  # stupid cpio creates new directories in mode 0700, fixup
Igor Gnatenko 082d5d
+  # stupid cpio creates new directories in mode 0700,
Igor Gnatenko 082d5d
+  # and non-standard modes may be inherented from original directories, fixup
Igor Gnatenko 082d5d
   find "${RPM_BUILD_ROOT}${debug_dest_name}" -type d -print0 |
Igor Gnatenko 082d5d
-  xargs --no-run-if-empty -0 chmod a+rx
Igor Gnatenko 082d5d
+  xargs --no-run-if-empty -0 chmod 0755
Igor Gnatenko 082d5d
 fi
Igor Gnatenko 082d5d
 
Igor Gnatenko 082d5d
 if [ -d "${RPM_BUILD_ROOT}/usr/lib" -o -d "${RPM_BUILD_ROOT}/usr/src" ]; then