gdb/gdb-add-index-chmod.patch

80 lines
2.2 KiB
Diff

From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: contrib/gdb-add-index.sh: chmod u+w
FileName: gdb-add-index-chmod.patch
;; Fix gdb-add-index for 444 *.debug files.
;;=push+jan
http://sourceware.org/ml/gdb-patches/2017-01/msg00110.html
--AhhlLboLdkugWU4S
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
in Fedora 24 it still worked, in Fedora 25 it does not - *-debuginfo.rpm
no longer have the .gdb_index accelerating section now.
It happens because:
objcopy: unable to copy file 'foo.debug'; reason: Permission denied
*.debug files in Fedora were always 444 but the time gdb-add-index is run is
still before the *.debug split and in Fedora 24 the files were -rwxr-xr-x
that time while in Fedora 25 they are apparently no longer w.
OK for check-in?
Jan
--AhhlLboLdkugWU4S
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline; filename=1
gdb/ChangeLog
2017-01-06 Jan Kratochvil <jan.kratochvil@redhat.com>
* contrib/gdb-add-index.sh: Use chmod u+w for $file.
---
gdb/contrib/gdb-add-index.sh | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
index c34058d1d6..bbec184b5d 100755
--- a/gdb/contrib/gdb-add-index.sh
+++ b/gdb/contrib/gdb-add-index.sh
@@ -43,10 +43,11 @@ fi
dir="${file%/*}"
test "$dir" = "$file" && dir="."
index="${file}.gdb-index"
+mode="${file}.mode"
-rm -f $index
+rm -f $index $mode
# Ensure intermediate index file is removed when we exit.
-trap "rm -f $index" 0
+trap "rm -f $index $mode" 0
$GDB --batch -nx -iex 'set auto-load no' \
-ex "file $file" -ex "save gdb-index $dir" || {
@@ -63,8 +64,13 @@ $GDB --batch -nx -iex 'set auto-load no' \
status=0
if test -f "$index"; then
+ touch "$mode"
+ chmod --reference="$file" "$mode"
+ # objcopy: unable to copy file 'foo.debug'; reason: Permission denied
+ chmod u+w "$file"
$OBJCOPY --add-section .gdb_index="$index" \
--set-section-flags .gdb_index=readonly "$file" "$file"
+ chmod --reference="$mode" "$file"
status=$?
else
echo "$myname: No index was created for $file" 1>&2
--
2.14.3