gdb 7.5.91 resolves symbolic links when passing argv[0]

2013-04-28 Thread David Kastrup

I've reported this to the Ubuntu bug tracker, but judging from the
package files, I can't find proof that it has been introduced
downstream.

The Ubuntu problem description is at
https://bugs.launchpad.net/ubuntu/+source/gdb/+bug/1173562>.  I
copy the description and example here:

Calling gdb on an executable that is a symbolic link will pass the
target of the symbolic link rather than the specified link as
argv[0] to the program.

As a result, if the program relies on the contents of argv[0] (for
example, for figuring out paths relative to the executable or making
decisions based on the name the executable has been called under),
debugging fails.

Here is an example for a program relying on its argv[0] name:
/usr/bin/latex is a symbolic link to /usr/bin/pdftex, and pdftex loads a
format depending on the name under which it has been called. As a
result,

latex '\stop'

will load the latex.fmt format and finish processing while the same will
fail under gdb since argv[0] is being passed as /usr/bin/pdftex instead
of /usr/bin/latex:

dak@lola:/tmp$ latex '\stop'
This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2011/06/27>
Babel  and hyphenation patterns for english, dumylang, nohyphenation, bu
lgarian, ukrainian, russian, loaded.
No pages of output.
Transcript written on texput.log.

dak@lola:/tmp$ gdb latex
GNU gdb (GDB) 7.5.91.20130417-cvs-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/pdftex...(no debugging symbols found)...done.
(gdb) run '\stop'
Starting program: /usr/bin/pdftex '\stop'
This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian)
 restricted \write18 enabled.
entering extended mode
! Undefined control sequence.
 
<*> \stop

?


Thanks for caring!

-- 
David Kastrup

___
bug-gdb mailing list
bug-gdb@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-gdb


Re: gdb 7.5.91 resolves symbolic links when passing argv[0]

2013-04-29 Thread David Kastrup
Pedro Alves  writes:

> Hello David,
>
> On 04/28/2013 10:14 AM, David Kastrup wrote:
>> 
>> I've reported this to the Ubuntu bug tracker, but judging from the
>> package files, I can't find proof that it has been introduced
>> downstream.
>
> I'm afraid that issues reported on this list often end up
> ignored/forgotten.  I'm not exactly sure why we still have it.
> Could you report this to the upstream bug tracker?  It's at:
>
>  http://sourceware.org/bugzilla/
>
> Sorry for the extra trouble.

I have not been able to figure out all the right categories: the tracker
is completely befuddling to me.  That's why I reverted to the list
instead of registering on yet-another-website for just a single use
which I'd probably get wrong anyway.

I have verified that the problem is still present in current master
(checking out the git mirror).  I have not been able to figure out just
when it has been introduced, and I don't have a clue where to look in
the code (the obvious grep for "readlink" did not really succeed in
letting me find a suspect).

-- 
David Kastrup

___
bug-gdb mailing list
bug-gdb@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-gdb