From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc2d.google.com (mail-oo1-xc2d.google.com [IPv6:2607:f8b0:4864:20::c2d]) by sourceware.org (Postfix) with ESMTPS id D59F33858413 for ; Fri, 4 Mar 2022 14:01:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D59F33858413 Received: by mail-oo1-xc2d.google.com with SMTP id h16-20020a4a6f10000000b00320507b9ccfso9482773ooc.7 for ; Fri, 04 Mar 2022 06:01:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=Y6lOd3q5tqIlsRJMTaRnhBhdsaB45LTwdn/Yqs/GW1U=; b=3/pn5BXHq1uAvz5I7vUe3TRWE3RDNGPR3KrcQ0EIYMjD6Bj7FftKpitFIQloQu8aTP 8zcZPLfDhHRwgHyQT/BipMzvZi7oOwU7TjzQM8//3j6LYTo6qik3ridQEjAjNdRllaWv i8IFaMBckrYgvexQ/CebU5lW/cdDZPu0I8si8NocR8XsOAOTJLy5RVY6yQYdJFJnoae4 Eqrl8/xWr+bes144ZqL3Kdjrg5NCGFCrgvrVADQmmx9lno4Cm8hpOpJlC0FQsSep6P8z +nA4w/vtUEyok1a+pu8on5TZVFnJPTQZAZWqcl3e02hisGWOpwH2NR9CKPyRsDgCYsiJ h9oQ== X-Gm-Message-State: AOAM533/H8+rFg7IePVsZAQR/cQSgMtT7qw9Ol4WmnGggA47cDJdz7/1 ChbjpnMlvl1saM5XNvOOxuBlaQ== X-Google-Smtp-Source: ABdhPJxGkC/K9+Yrm3iWJZnAZAJDERYoYKTwwMSml3x6NLccZwwIhEbLUOuZNJwYpeDzDGIo1ttSAQ== X-Received: by 2002:a05:6870:1147:b0:ce:c0c9:5ed with SMTP id 7-20020a056870114700b000cec0c905edmr8030800oag.63.1646402484434; Fri, 04 Mar 2022 06:01:24 -0800 (PST) Received: from ?IPV6:2804:431:c7ca:2dcb:a992:742c:8048:43bc? ([2804:431:c7ca:2dcb:a992:742c:8048:43bc]) by smtp.gmail.com with ESMTPSA id x17-20020a056870b1d100b000d9f73ce6e7sm220357oak.52.2022.03.04.06.01.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Mar 2022 06:01:23 -0800 (PST) Message-ID: <85c16187-11e4-6723-476f-9933262432cf@linaro.org> Date: Fri, 4 Mar 2022 11:01:21 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH v4] elf: Fix DFS sorting algorithm for LD_TRACE_LOADED_OBJECTS with missing libraries (BZ #28868) Content-Language: en-US To: Andreas Schwab , Adhemerval Zanella via Libc-alpha Cc: Florian Weimer References: <20220304120201.363600-1-adhemerval.zanella@linaro.org> <877d99lwgi.fsf@igel.home> From: Adhemerval Zanella In-Reply-To: <877d99lwgi.fsf@igel.home> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2022 14:01:27 -0000 On 04/03/2022 09:43, Andreas Schwab wrote: > On Mär 04 2022, Adhemerval Zanella via Libc-alpha wrote: > >> @@ -2725,3 +2735,50 @@ $(objpfx)tst-p_align3: $(objpfx)tst-p_alignmod3.so >> $(objpfx)tst-p_align3.out: tst-p_align3.sh $(objpfx)tst-p_align3 >> $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \ >> $(evaluate-test) >> + >> + >> +# Move the library to a folder so it can be selected by --library-path >> +define libtracemod-mv >> + test -d $(objpfx)libtracemod$(1) || mkdir $(objpfx)libtracemod$(1) > > You can use mkdir -p, which avoids any races. Ok. > >> + test -f $(objpfx)libtracemod$(1).so \ >> + && mv $(objpfx)libtracemod$(1).so $(objpfx)libtracemod$(1) > > This will result in a non-zero status if $(objpfx)libtracemod$(1).so > doesn't exist, causing the command to fail. It's also not race-free. Right, but since $(objpfx)libtracemod$(1).so is a prerequisite I don't see how the failure will happen. How do you suggest to handle it? > >> +define tst-trace-skeleton >> +$(objpfx)tst-trace$(1).out: $(..)scripts/tst-ld-trace.py \ >> + $(objpfx)libtracemod1.so \ >> + libtracemod-mv \ >> + tst-trace$(1).exp > > The dependency on the phony libtracemod-mv will cause the command to > always be rerun. > Thinking twice the phony does not seem the best option, I replaced with a stamp file: $(objpfx)libtracemod-mv.stamp: $(objpfx)libtracemod1.so $(call libtracemod-mv,2) [...] touch $@ $(objpfx)tst-trace$(1).out: $(..)scripts/tst-ld-trace.py \ $(objpfx)libtracemod-mv.stamp \ tst-trace$(1).exp However even with this the rule seems to be rerun every time. Any idea on how to avoid it?