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

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