From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11679 invoked by alias); 11 Oct 2013 14:46:49 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 11667 invoked by uid 89); 11 Oct 2013 14:46:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Oct 2013 14:46:48 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1VUdzI-0000Me-LZ from Luis_Gustavo@mentor.com ; Fri, 11 Oct 2013 07:46:44 -0700 Received: from NA1-MAIL.mgc.mentorg.com ([147.34.98.181]) by svr-orw-fem-01.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 11 Oct 2013 07:46:44 -0700 Received: from [172.30.8.57] ([172.30.8.57]) by NA1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 11 Oct 2013 07:46:44 -0700 Message-ID: <52580F4B.8050306@codesourcery.com> Date: Fri, 11 Oct 2013 14:46:00 -0000 From: Luis Machado Reply-To: lgustavo@codesourcery.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Jan Kratochvil CC: "'gdb-patches@sourceware.org'" Subject: Re: [PATCH] Fix calling gcore when gdb is not in $PATH. References: <525806C8.8040108@codesourcery.com> <20131011143145.GA1517@host2.jankratochvil.net> In-Reply-To: <20131011143145.GA1517@host2.jankratochvil.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00388.txt.bz2 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. Thanks, Luis