|
|
3791cf |
commit c707ab26362e795d3f9dba4eb87dc7ed99a28bcb
|
|
|
3791cf |
Author: Robin Lee <cheeselee@fedoraproject.org>
|
|
|
3791cf |
Date: Sat Apr 8 21:21:39 2017 +0800
|
|
|
3791cf |
|
|
|
3791cf |
Fix non-standard inherented modes of directories in debuginfo
|
|
|
3791cf |
|
|
|
3791cf |
In case that binary compiled from source generated in /tmp, a
|
|
|
3791cf |
/usr/src/debug/tmp directory will be created with the same mode as
|
|
|
3791cf |
/tmp, a.k.a 777, which should be avoided.
|
|
|
3791cf |
|
|
|
3791cf |
Fixes: rhbz#641022
|
|
|
3791cf |
|
|
|
3791cf |
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
|
|
|
3791cf |
old mode 100644
|
|
|
3791cf |
new mode 100755
|
|
|
3791cf |
index 547dbd9..6f38e19
|
|
|
3791cf |
--- a/scripts/find-debuginfo.sh
|
|
|
3791cf |
+++ b/scripts/find-debuginfo.sh
|
|
|
3791cf |
@@ -396,9 +396,10 @@
|
|
|
3791cf |
mkdir -p "${RPM_BUILD_ROOT}/usr/src/debug"
|
|
|
3791cf |
LC_ALL=C sort -z -u "$SOURCEFILE" | grep -E -v -z '(<internal>|<built-in>)$' |
|
|
|
3791cf |
(cd "$RPM_BUILD_DIR"; cpio -pd0mL "${RPM_BUILD_ROOT}/usr/src/debug")
|
|
|
3791cf |
- # stupid cpio creates new directories in mode 0700, fixup
|
|
|
3791cf |
+ # stupid cpio creates new directories in mode 0700,
|
|
|
3791cf |
+ # and non-standard modes may be inherented from original directories, fixup
|
|
|
3791cf |
find "${RPM_BUILD_ROOT}/usr/src/debug" -type d -print0 |
|
|
|
3791cf |
- xargs --no-run-if-empty -0 chmod a+rx
|
|
|
3791cf |
+ xargs --no-run-if-empty -0 chmod 0755
|
|
|
3791cf |
fi
|
|
|
3791cf |
|
|
|
3791cf |
if [ -d "${RPM_BUILD_ROOT}/usr/lib" -o -d "${RPM_BUILD_ROOT}/usr/src" ]; then
|
|
|
3791cf |
|
|
|
3791cf |
commit e795899780337dea751d85db8f381eff3fe75275
|
|
|
3791cf |
Author: Mark Wielaard <mark@klomp.org>
|
|
|
3791cf |
Date: Fri Apr 21 17:33:26 2017 +0200
|
|
|
3791cf |
|
|
|
3791cf |
debugedit: Only output comp_dir under build dir (once).
|
|
|
3791cf |
|
|
|
3791cf |
The fix for rhbz#444310 (commit c1a5eb - Include empty CU current dirs)
|
|
|
3791cf |
was a little greedy. It would also include comp_dirs outside the build
|
|
|
3791cf |
root. Those are unnecessary and we don't have a good way to store them.
|
|
|
3791cf |
Such dirs (e.g. /tmp) would then show up at the root of /usr/src/debug.
|
|
|
3791cf |
|
|
|
3791cf |
Fix this by including only comp_dirs under base_dir. Also only output
|
|
|
3791cf |
all dirs once (during phase zero) and don't output empty dirs (which
|
|
|
3791cf |
was harmless but would produce a warning from cpio).
|
|
|
3791cf |
|
|
|
3791cf |
This still includes all empty dirs from the original rhbz#444310
|
|
|
3791cf |
nodir testcase and it is an alternative fix for rhbz#641022
|
|
|
3791cf |
(commit c707ab).
|
|
|
3791cf |
|
|
|
3791cf |
Both fixes are necessary in case of an unexpected mode for a directory
|
|
|
3791cf |
actually in the build root that we want to include in the source list.
|
|
|
3791cf |
|
|
|
3791cf |
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
3791cf |
|
|
|
3791cf |
diff --git a/tools/debugedit.c b/tools/debugedit.c
|
|
|
3791cf |
index 8444e03..bf11513 100644
|
|
|
3791cf |
--- a/tools/debugedit.c
|
|
|
3791cf |
+++ b/tools/debugedit.c
|
|
|
3791cf |
@@ -926,27 +926,27 @@
|
|
|
3791cf |
/* Ensure the CU current directory will exist even if only empty. Source
|
|
|
3791cf |
filenames possibly located in its parent directories refer relatively to
|
|
|
3791cf |
it and the debugger (GDB) cannot safely optimize out the missing
|
|
|
3791cf |
- CU current dir subdirectories. */
|
|
|
3791cf |
- if (comp_dir && list_file_fd != -1)
|
|
|
3791cf |
+ CU current dir subdirectories. Only do this once in phase one. And
|
|
|
3791cf |
+ only do this for dirs under our build/base_dir. Don't output the
|
|
|
3791cf |
+ empty string (in case the comp_dir == base_dir). */
|
|
|
3791cf |
+ if (phase == 0 && base_dir && comp_dir && list_file_fd != -1)
|
|
|
3791cf |
{
|
|
|
3791cf |
- char *p;
|
|
|
3791cf |
- size_t size;
|
|
|
3791cf |
|
|
|
3791cf |
- if (base_dir && has_prefix (comp_dir, base_dir))
|
|
|
3791cf |
- p = comp_dir + strlen (base_dir);
|
|
|
3791cf |
- else if (dest_dir && has_prefix (comp_dir, dest_dir))
|
|
|
3791cf |
- p = comp_dir + strlen (dest_dir);
|
|
|
3791cf |
- else
|
|
|
3791cf |
- p = comp_dir;
|
|
|
3791cf |
-
|
|
|
3791cf |
- size = strlen (p) + 1;
|
|
|
3791cf |
- while (size > 0)
|
|
|
3791cf |
+ if (has_prefix (comp_dir, base_dir))
|
|
|
3791cf |
{
|
|
|
3791cf |
- ssize_t ret = write (list_file_fd, p, size);
|
|
|
3791cf |
- if (ret == -1)
|
|
|
3791cf |
- break;
|
|
|
3791cf |
- size -= ret;
|
|
|
3791cf |
- p += ret;
|
|
|
3791cf |
+ char *p = comp_dir + strlen (base_dir);
|
|
|
3791cf |
+ if (p[0] != '\0')
|
|
|
3791cf |
+ {
|
|
|
3791cf |
+ size_t size = strlen (p) + 1;
|
|
|
3791cf |
+ while (size > 0)
|
|
|
3791cf |
+ {
|
|
|
3791cf |
+ ssize_t ret = write (list_file_fd, p, size);
|
|
|
3791cf |
+ if (ret == -1)
|
|
|
3791cf |
+ break;
|
|
|
3791cf |
+ size -= ret;
|
|
|
3791cf |
+ p += ret;
|
|
|
3791cf |
+ }
|
|
|
3791cf |
+ }
|
|
|
3791cf |
}
|
|
|
3791cf |
}
|
|
|
3791cf |
|