From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id iKY8JqM5XmATTAAAWB0awg (envelope-from ) for ; Fri, 26 Mar 2021 15:44:35 -0400 Received: by simark.ca (Postfix, from userid 112) id 99E3E1EF7C; Fri, 26 Mar 2021 15:44:35 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id F1CF41E789 for ; Fri, 26 Mar 2021 15:44:34 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B435A3844046; Fri, 26 Mar 2021 19:44:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B435A3844046 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1616787874; bh=Nip1ZuGdGlhUBv36m6E6uiKWKWcCFf/V28r8i68wD3g=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=C11suu01AxyrAMHTdMm5BySh6hp6bWJCVqeTqMtBQSN9f5/54rkFmOVOGuAJGZEtZ WHRRUCVJcmwN9WOzv1ApP67K10s+gYCK5aeJfJ0lQKyXtxY0w5YpFq3JSk8hxdGRkg SsI+sP9qin05lMokEF53EwMJCcigcj5iXNCspGco= Received: from lndn.lancelotsix.com (vps-42846194.vps.ovh.net [IPv6:2001:41d0:801:2000::2400]) by sourceware.org (Postfix) with ESMTPS id 7FBB53857C7A for ; Fri, 26 Mar 2021 19:44:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7FBB53857C7A Received: from Plymouth (unknown [IPv6:2a02:390:9086:0:b82c:5cfa:3593:8ad9]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id 75E8E818C3; Fri, 26 Mar 2021 19:44:30 +0000 (UTC) Date: Fri, 26 Mar 2021 19:44:28 +0000 To: Simon Marchi Subject: Re: [PATCH v2] [PR gdb/27614] gdb-add-index fails on symlinks. Message-ID: References: <20210326171100.1491-1-lsix@lancelotsix.com> <1b31f1e8-9379-d6f7-afb6-40a6ce7fb379@polymtl.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1b31f1e8-9379-d6f7-afb6-40a6ce7fb379@polymtl.ca> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Fri, 26 Mar 2021 19:44:30 +0000 (UTC) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Lancelot SIX via Gdb-patches Reply-To: Lancelot SIX Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Le Fri, Mar 26, 2021 at 02:53:12PM -0400, Simon Marchi a écrit : > BSDs' readlink doesn't have the -e option, so it would probably derail > from here (should we also check the exit status of readlink to make sure > it worked? did you try with a symlink pointing to a non-existent file / > with a non-existent component?). > > Would it work with just `readlink `? This would fail if $file is a symlink to a symlink. This is what ldconfig usually does (libfoo.so -> libfoo.so.x -> libfoo.so.x.y). I guess the most robust approach will be something like: ${GDB} --batch -nx -iex 'set auto-load no' \ -iex "file '$file'" -iex 'maint info bfds' | \ awk -F/ '{ fname=$NF } END { print fname }' This rely on how 'maint info bfds' formats its output and I am not sure how stable shit will be in time, but hopefully the new test case will catch any breackage. This will require few more tweaks along the way but nothing too fanncy. I’ll do that unless there is a simpler and as portable approach available. Lancelot. > > Simon >