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