From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout04.t-online.de (mailout04.t-online.de [194.25.134.18]) by sourceware.org (Postfix) with ESMTPS id 7537C3858C27 for ; Wed, 20 Sep 2023 10:58:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7537C3858C27 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=t-online.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=t-online.de Received: from fwd83.aul.t-online.de (fwd83.aul.t-online.de [10.223.144.109]) by mailout04.t-online.de (Postfix) with SMTP id DAC83FDBC for ; Wed, 20 Sep 2023 12:58:09 +0200 (CEST) Received: from [192.168.2.101] ([91.57.240.81]) by fwd83.t-online.de with (TLSv1.3:TLS_AES_256_GCM_SHA384 encrypted) esmtp id 1qiuuF-3V82JE0; Wed, 20 Sep 2023 12:58:08 +0200 Subject: Re: cygport may not create debug info if top directory contains a symlink To: cygwin-apps@cygwin.com References: <9bc07a5f-86d9-76ee-f45d-e1956c9035f8@t-online.de> <8f480c7f-e2d0-c2b2-f6fb-24a1e54c2b19@t-online.de> <86ec734a-4277-f9be-81bb-75a4bbae6e76@Shaw.ca> From: Christian Franke Message-ID: <6ecfe72d-1f77-af76-9430-8594b8f13384@t-online.de> Date: Wed, 20 Sep 2023 12:58:07 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 SeaMonkey/2.53.16 MIME-Version: 1.0 In-Reply-To: <86ec734a-4277-f9be-81bb-75a4bbae6e76@Shaw.ca> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TOI-EXPURGATEID: 150726::1695207488-D37E8FD5-C94EA9FE/0/0 CLEAN NORMAL X-TOI-MSGID: 74751eef-317b-4874-9ae5-d91fcb921403 X-Spam-Status: No, score=3.0 required=5.0 tests=BAYES_00,BODY_8BITS,FREEMAIL_FROM,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Brian Inglis wrote: > On 2023-09-18 04:41, Christian Franke via Cygwin-apps wrote: >> Brian Inglis wrote: >>> On 2023-09-17 08:01, Jon Turney via Cygwin-apps wrote: >>>> On 16/09/2023 15:17, Christian Franke via Cygwin wrote: >>>>> Found during tests of busybox package: >>>>> If the path of the top build directory contains a symlink and the >>>>> project's build scripts normalize pathnames, no debug info is >>>>> created by cygport. >>>>> >>>>> This is because options like >>>>>   -fdebug-prefix-map=${B}=/usr/src/debug/${PF} >>>>> have no effect because ${B} contains a symlink but the compiler is >>>>> run with the real source path. >>>> >>>> I think that there was some historical bug with gcc where a >>>> relative path for the old path in this mapping wasn't correctly >>>> handled, which is why were using an absolute path here at all. >>>> >>>> So changing it to something like [1] (if that works), might be better. >>>> >>>> [1] >>>> https://github.com/jon-turney/cygport/commit/4175d456a9184c5cdebd8bfb4b5ba30583cedd66 > > Should bin/cygport.in:534: not have $B between the == as in line 531: > >     declare ${flags}+=" -fdebug-prefix-map=${B}=/usr/src/debug/${PF}" >     ... >     declare ${flags}+=" -fdebug-prefix-map==/usr/src/debug/${PF}" > > or be hoist above the condition if identical, unless that is some > undocumented default for cwd? I guess the == without ${B} is intentional because it makes the debug source path relative to ${B} as lines 535-536 also do. > ... >>> An STC script which creates test dirs to demonstrate the issue and >>> show the alternative outputs would be nice so anyone can see. > >> $ ln -s /usr/src /tmp/source >> >> $ cd /tmp/source >> >> $ pwd >> /tmp/source >> >> $ /bin/pwd >> /usr/src >> >> $ pwd -P >> /usr/src >> >> $ /bin/pwd -L >> /tmp/source > > Thanks, looks good - care to submit a patch, including above > suggestions, to cover all bases? > Users may have a good reason to use a symlinked directory, e.g. fake the original build path during a rebuild. So I'm still not sure how to handle this. - Simply warn the user:   declare -r top=$(cd ${_topdir}; pwd);  +if [ "${top}" != "$(cd ${_topdir}; pwd -P)" ]  +then  +       warning "symlinks in ${top} do not work with some build systems."  +fi   unset _topdir; - or enforce the real path:  -declare -r top=$(cd ${_topdir}; pwd);  +declare -r top=$(cd ${_topdir}; pwd -P);  +if [ "${top}" != "$(cd ${_topdir}; pwd -L)" ]  +then  +       inform "using real path ${top} as top level directory."  +fi   unset _topdir; Projects using GNU autotools and cyg{conf,make,install} in cygport are usually not affected by symlinks in ${top}. -- Regards, Christian