Blame SOURCES/gdb-add-index-chmod.patch

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