On 10/11/2013 11:46 AM, Luis Machado wrote: > On 10/11/2013 11:31 AM, Jan Kratochvil wrote: >> On Fri, 11 Oct 2013 16:10:16 +0200, Luis Machado wrote: >>> --- a/gdb/gcore.in >>> +++ b/gdb/gcore.in >>> @@ -51,7 +51,7 @@ for pid in $* >>> do >>> # `>> # available but not accessible as GDB would get stopped on >>> SIGTTIN. >>> - @GDB_TRANSFORM_NAME@ >> + "$(dirname "$0")"/@GDB_TRANSFORM_NAME@ > >> I have only some concern if $0 does not contain a directory name. >> Then `dirname basename` will be . and gdb -> ./gdb will be a >> regression as >> ./gdb will typically not be found. >> >> For example if you run: >> $ sh gcore foo >> then sh (or bash) executes /usr/bin/gcore but $0 is still just "gcore". >> >> It IMO even corresponds to the sh $0 POSIX description ("command_file"): >> http://pubs.opengroup.org/onlinepubs/007908799/xcu/sh.html > > > Right. That situation can indeed happen. Though it looks a little > awkward to call something in your path like that. > > I suppose we can extend the check to cover that case as well. Let me go > back to the drawing board. Is this one more acceptable (though slightly less portable)? Regards, Luis