public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [patch] contrib/gdb-add-index.sh: chmod u+w
@ 2017-01-06 18:37 Jan Kratochvil
  2017-01-06 19:33 ` Jan Kratochvil
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2017-01-06 18:37 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

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

[-- Attachment #2: 1 --]
[-- Type: text/plain, Size: 1150 bytes --]

gdb/ChangeLog
2017-01-06  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* contrib/gdb-add-index.sh: Use chmod u+w for $file.

diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
index 0cd4ce3..5a190a0 100755
--- a/gdb/contrib/gdb-add-index.sh
+++ b/gdb/contrib/gdb-add-index.sh
@@ -38,10 +38,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" || {
@@ -58,8 +59,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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] contrib/gdb-add-index.sh: chmod u+w
  2017-01-06 18:37 [patch] contrib/gdb-add-index.sh: chmod u+w Jan Kratochvil
@ 2017-01-06 19:33 ` Jan Kratochvil
  2017-01-19 15:46   ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2017-01-06 19:33 UTC (permalink / raw)
  To: gdb-patches

On Fri, 06 Jan 2017 19:37:10 +0100, Jan Kratochvil wrote:
> 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.

The problem was in Fedora /usr/lib/rpm/find-debuginfo.sh script regression.

This GDB contrib/ patch is not required to make Fedora working.

Although I find it as a good improvement anyway so keeping it here submitted.


Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] contrib/gdb-add-index.sh: chmod u+w
  2017-01-06 19:33 ` Jan Kratochvil
@ 2017-01-19 15:46   ` Pedro Alves
  0 siblings, 0 replies; 3+ messages in thread
From: Pedro Alves @ 2017-01-19 15:46 UTC (permalink / raw)
  To: Jan Kratochvil, gdb-patches

On 01/06/2017 07:33 PM, Jan Kratochvil wrote:
> On Fri, 06 Jan 2017 19:37:10 +0100, Jan Kratochvil wrote:
>> 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.
> 
> The problem was in Fedora /usr/lib/rpm/find-debuginfo.sh script regression.
> 
> This GDB contrib/ patch is not required to make Fedora working.
> 
> Although I find it as a good improvement anyway so keeping it here submitted.

Not sure I agree; looks like a hack to me.  :-/
Since it's not needed, it seems better to me to keep the code simpler.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-19 15:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-06 18:37 [patch] contrib/gdb-add-index.sh: chmod u+w Jan Kratochvil
2017-01-06 19:33 ` Jan Kratochvil
2017-01-19 15:46   ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).