From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from duck.apple.relay.mailchannels.net (duck.apple.relay.mailchannels.net [23.83.208.52]) by sourceware.org (Postfix) with ESMTPS id 8EA383858D32 for ; Thu, 25 May 2023 12:51:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8EA383858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 2055E200938; Thu, 25 May 2023 12:51:44 +0000 (UTC) Received: from pdx1-sub0-mail-a306.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 6E2D4201FE9; Thu, 25 May 2023 12:51:43 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1685019103; a=rsa-sha256; cv=none; b=IPrSpvTwWAiHFTpuukcjbl7/2Yegs0VcAINxgyyuYXshh+LcL/28lBKzKcxjCy9xheZK3H jCLg/uNegPNNKAFNAv2xiEGj6kcxXBsua5GXz1QQ8OtTcpHo0nY1U78xLQ7wMGjpAqfaWf SITdwWRD++N4PwSguoFuv9GXhsuCJbke1nQm0Hu3zGGWPSTrKw1GqQDXQl0TCu4WzLe9YN ZUmvwrFix7MTuoYu4PgNWXK/Io2tyJZI8x/e1fG5mjj/RnZEb+A3SUqArMUeUCLExSynK0 o0d57DTL1vo8F+E9j1shJ+1Llb3AEQr8gu2MGN+jLNpY2S+R4/t/GdeKxYbxOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1685019103; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=25QmOaa4T9xn2iumOy/Ofw8dHOHacFE94ldO5uXTPD8=; b=jzHr/yHGiop5lJTkOhEfCvugse2Ufy7eGWRMT0Uo+SyZkTjqMOpxcc5MyP1/oGWe3kIVFe ka5LysenAfGqpDSxas8GmTlSLAdwV3/XkI+qR1qprZUVVA4IAQ7x5C+tIqxtI8O9CtVFWs NwLrmNaqJoVqKDAcqs5tRoDN8j3pOfqn2BqMMSlp7FnMKRqJO2NrAR43Jj958naHRSPNqV VoV1+52EbwrLVx49UmhowcPZ5tCVfnpq54cbx5PLMBMtQsnlB1MTJoWetyxvUz5fMqwy+x l3gOxiF9WRTDBb67d5T26Y67kxV0w2V3Pah7wKTA4Q6YvO5LWvxaRHZi/D6mDA== ARC-Authentication-Results: i=1; rspamd-79bb5575d7-nhjl6; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Good X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Lyrical-Inform: 4a7c1bb21b185246_1685019103957_4040515575 X-MC-Loop-Signature: 1685019103957:3840991894 X-MC-Ingress-Time: 1685019103957 Received: from pdx1-sub0-mail-a306.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.125.42.166 (trex/6.8.1); Thu, 25 May 2023 12:51:43 +0000 Received: from [192.168.0.182] (bras-vprn-toroon4834w-lp130-02-142-113-138-85.dsl.bell.ca [142.113.138.85]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a306.dreamhost.com (Postfix) with ESMTPSA id 4QRnxV46kdz1n; Thu, 25 May 2023 05:51:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1685019103; bh=25QmOaa4T9xn2iumOy/Ofw8dHOHacFE94ldO5uXTPD8=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=xT0cPcbqF2QQubwKBFR6ukifexFsg114TxHXEZEkkpETxl8Q4pvkCih1Mi1uFQO+5 yDZWgb6Dvg0Sj4u0tSniaNL5rPbO6SZS1Euv2WxpeCF8Wqo3w3ndcjMGSS/BcyZ6Pm 0M9wH+r3YNleuMu+QppoHG7MhVbf5P+V9YIZnueFn53LQXxID7kHtsG9cz7Gcu3xxk 5ml9pIm7kl2lXsJE7GZYVWoWexe/PnCy47Vd7Ft9auBdrwZItvlG4HP6MbeUv7iQMX 2Cgm3sa9DIp4N2zGJdzOjzWCcFgBKX1f9/pCHib/kKgU4AL4cOofnihZ5YlCrNr/C4 wPmy40/qdDVtg== Message-ID: <918b5baa-1e56-b9e2-99e7-645ece52ff88@gotplt.org> Date: Thu, 25 May 2023 08:51:41 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v2 2/2] elf: Add test for finding libraries in root dir Content-Language: en-US To: Qixing ksyx Xue , libc-alpha@sourceware.org, carlos@redhat.com Cc: mooodyhunter@outlook.com References: From: Siddhesh Poyarekar In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3037.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,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.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-05-09 18:56, Qixing ksyx Xue via Libc-alpha wrote: > Suggested-by: Carlos O'Donell > Signed-off-by: Qixing ksyx Xue > --- > elf/Makefile | 3 +++ > elf/tst-rootdir-lib.c | 23 +++++++++++++++++++ > elf/tst-rootdir.c | 37 +++++++++++++++++++++++++++++++ > elf/tst-rootdir.root/preclean.req | 0 > elf/tst-rootdir.script | 1 + > 5 files changed, 64 insertions(+) > create mode 100644 elf/tst-rootdir-lib.c > create mode 100644 elf/tst-rootdir.c > create mode 100644 elf/tst-rootdir.root/preclean.req > create mode 100644 elf/tst-rootdir.script Sorry, I acked Andreas' patch to fix the same issue; it's also a slightly cleaner fix. It didn't have a test case though, so thank you for writing the test! Could you please send a v3 of the test with the following nits fixed and also quote the BZ number in the subject? Thanks, Sid > > diff --git a/elf/Makefile b/elf/Makefile > index 396ec51424..ee81575cbb 100644 > --- a/elf/Makefile > +++ b/elf/Makefile > @@ -325,6 +325,7 @@ static-dlopen-environment = \ > LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)dlfcn > tst-tls9-static-ENV = $(static-dlopen-environment) > tst-single_threaded-static-dlopen-ENV = $(static-dlopen-environment) > +tst-rootdir-ENV = LD_LIBRARY_PATH=/ > > tests += \ > argv0test \ > @@ -506,6 +507,7 @@ tests-container += \ > tst-dlopen-tlsmodid-container \ > tst-pldd \ > tst-preload-pthread-libc \ > + tst-rootdir \ > # tests-container > > test-srcs = \ > @@ -854,6 +856,7 @@ modules-names += \ > tst-relsort1mod1 \ > tst-relsort1mod2 \ > tst-ro-dynamic-mod \ > + tst-rootdir-lib \ > tst-single_threaded-mod1 \ > tst-single_threaded-mod2 \ > tst-single_threaded-mod3 \ > diff --git a/elf/tst-rootdir-lib.c b/elf/tst-rootdir-lib.c > new file mode 100644 > index 0000000000..22b7bdad70 > --- /dev/null > +++ b/elf/tst-rootdir-lib.c > @@ -0,0 +1,23 @@ > +/* Simple library for testing locating library in root directories. > + Copyright (C) 2023 Free Software Foundation, Inc. Please change this to "Copyright The GNU Toolchain Authors." for both files. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +const char * > +test_func (void) > +{ > + return "Success"; > +} > diff --git a/elf/tst-rootdir.c b/elf/tst-rootdir.c > new file mode 100644 > index 0000000000..a31d4237af > --- /dev/null > +++ b/elf/tst-rootdir.c > @@ -0,0 +1,37 @@ > +/* Test code for locating libraries in root directories. > + Copyright (C) 2023 Free Software Foundation, Inc. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#include > +#include > +#include > +#include > + > +static int > +do_test (void) > +{ > + void *handle = dlopen ("libtest.so", RTLD_LAZY); > + TEST_VERIFY_EXIT (handle != NULL); > + typedef const char *(test_func_t) (void); > + test_func_t *func = dlsym (handle, "test_func"); > + assert (func != NULL); > + TEST_COMPARE_STRING (func (), "Success"); > + dlclose (handle); > + return 0; > +} > + > +#include > diff --git a/elf/tst-rootdir.root/preclean.req b/elf/tst-rootdir.root/preclean.req > new file mode 100644 > index 0000000000..e69de29bb2 > diff --git a/elf/tst-rootdir.script b/elf/tst-rootdir.script > new file mode 100644 > index 0000000000..f852c0ec34 > --- /dev/null > +++ b/elf/tst-rootdir.script > @@ -0,0 +1 @@ > +cp $B/elf/tst-rootdir-lib.so /libtest.so