From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 386AD3858D39 for ; Wed, 8 Feb 2023 16:50:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 386AD3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675875042; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TQjFQxLqFWKzo08JM+POT7wkzBHRnfq/zoEZeRHgl7o=; b=frFHsjLddoYsc9+oQy/oZJf+5MsmHNOLqD6wEvZ69Y5BOb8ae6VIU1JtQcZJclRUjP+Vl+ XPuCEQ4WtSFKDRHd2tfxOvYGKmK5J6ynzCQY4FlisOWDi8smpGM75dC/2+ZJ6sUPX9GI1D aVSR9PN/MPCz/D1VR0IT2Zc4yZH5QcM= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-16-n4fOCGUrPACgBCe7DzGObw-1; Wed, 08 Feb 2023 11:50:41 -0500 X-MC-Unique: n4fOCGUrPACgBCe7DzGObw-1 Received: by mail-il1-f198.google.com with SMTP id h2-20020a92c262000000b00313b8b647ceso8442549ild.15 for ; Wed, 08 Feb 2023 08:50:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TQjFQxLqFWKzo08JM+POT7wkzBHRnfq/zoEZeRHgl7o=; b=me/P1eFq2a/bl6SRTlxgA2LGaqPhCYsnadu1nlYrK98bWY/GL8dFm7BEsI+76hcb7n P+OzWUruM1GQF/Hm0hvW6BMsnvqt5O8p1Dw5CnMnp0/FvrzlqbiQL1xD6MrdyyMm3yEo TvCapYfSsL2Xbb4OepvZ+zkMM3JtyFpLB8zZbsOZFtaC6RkfyKvrvsPP+FN3az9iy+OQ ZqNWHUGPUJ/L30iAFU4uEbslD9G3GNEKX/VOMM/GPw3eFEACIFWFvzDeViAhIy71DU3p FCGDizpGSElClQdDIqVKRQJuO3QS3AE6OEt9O3ndmnrDBz7/9jtD4ud13f01CBk32C/F Oqjw== X-Gm-Message-State: AO0yUKVpvF6jvJ4zzSbvkERzjyyLJhcv5Tl3wyDMIM2bit3HuzaptTZ7 NY/hRvt0G5B1dhj7jkaJB4QfZHb468MCE2w5cvYt6aazTEdX7cDIS9cvfu9EC2KkJIXf/zQma5/ cyA55WMDTD6bPtB4W1itV0AreoA== X-Received: by 2002:a05:6e02:1cac:b0:313:d385:3e98 with SMTP id x12-20020a056e021cac00b00313d3853e98mr8557195ill.18.1675875040454; Wed, 08 Feb 2023 08:50:40 -0800 (PST) X-Google-Smtp-Source: AK7set8JLzpFeTa0o3+NS+72j2BQCRdY1qoT8NYDVFqCVkWahCpUzSI4v8b1/ZqbD8hm96ioNM+sBg== X-Received: by 2002:a05:6e02:1cac:b0:313:d385:3e98 with SMTP id x12-20020a056e021cac00b00313d3853e98mr8557140ill.18.1675875039594; Wed, 08 Feb 2023 08:50:39 -0800 (PST) Received: from [192.168.0.241] (192-0-145-146.cpe.teksavvy.com. [192.0.145.146]) by smtp.gmail.com with ESMTPSA id r8-20020a056638130800b003b231d7257asm5389114jad.74.2023.02.08.08.50.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Feb 2023 08:50:38 -0800 (PST) Message-ID: <4fb0c999-b5f0-4471-6abb-43624095dfb0@redhat.com> Date: Wed, 8 Feb 2023 11:50:37 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH] elf: Smoke-test ldconfig -p against system /etc/ld.so.cache To: Florian Weimer , libc-alpha@sourceware.org References: <87lel8qzyl.fsf@oldenburg.str.redhat.com> From: Carlos O'Donell Organization: Red Hat In-Reply-To: <87lel8qzyl.fsf@oldenburg.str.redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP 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 2/8/23 04:16, Florian Weimer via Libc-alpha wrote: > The test is sufficient to detect the ldconfig bug fixed in > commit 9fe6f6363886aae6b2b210cae3ed1f5921299083 ("elf: Fix 64 time_t > support for installed statically binaries"). > > Tested on i686-linux-gnu and x86_64-linux-gnu, both with a > x86_64-linux-gnu as the host. LGTM. This is a good smoke test. I think we can continue to extend this to use -r in some ways. Reviewed-by: Carlos O'Donell > --- > elf/Makefile | 6 ++++ > elf/tst-ldconfig-p.sh | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 83 insertions(+) > > diff --git a/elf/Makefile b/elf/Makefile > index b509b3eada..2fc6391183 100644 > --- a/elf/Makefile > +++ b/elf/Makefile > @@ -626,6 +626,7 @@ ifeq ($(run-built-tests),yes) > tests-special += \ > $(objpfx)noload-mem.out \ > $(objpfx)tst-ldconfig-X.out \ > + $(objpfx)tst-ldconfig-p.out \ OK. Special test. Only for $(run-build-tests) so they must able to run. > $(objpfx)tst-leaks1-mem.out \ > $(objpfx)tst-rtld-help.out \ > # tests-special > @@ -2396,6 +2397,11 @@ $(objpfx)tst-ldconfig-X.out : tst-ldconfig-X.sh $(objpfx)ldconfig > '$(run-program-env)' > $@; \ > $(evaluate-test) > > +$(objpfx)tst-ldconfig-p.out : tst-ldconfig-p.sh $(objpfx)ldconfig > + $(SHELL) $< '$(common-objpfx)' '$(test-wrapper-env)' \ > + '$(run-program-env)' > $@; \ > + $(evaluate-test) OK. Running with wrapper correctly. > + > # Test static linking of all the libraries we can possibly link > # together. Note that in some configurations this may be less than the > # complete list of libraries we build but we try to maxmimize this list. > diff --git a/elf/tst-ldconfig-p.sh b/elf/tst-ldconfig-p.sh > new file mode 100644 > index 0000000000..ec937bf4ec > --- /dev/null > +++ b/elf/tst-ldconfig-p.sh > @@ -0,0 +1,77 @@ > +#!/bin/sh > +# Test that ldconfig -p prints something useful. OK. > +# 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 > +# . > + > +# Check that the newly built ldconfig -p can dump the system > +# /etc/ld.so.cache file. This should always work even if the ABIs are > +# not compatible, except in a cross-endian build (that presumably > +# involves emulation when running ldconfig). > + > +common_objpfx=$1 > +test_wrapper_env=$2 > +run_program_env=$3 > + > +if ! test -r /etc/ld.so.cache; then OK. My preference would have been to use '-r root' to chroot and setup an empty ld.so.cache to avoid depending on the system. > + echo "warning: /etc/ld.so.cache does not exist, test skipped" > + exit 77 > +fi > + > +testout="${common_objpfx}elf/tst-ldconfig-p.out" > +# Truncate file. > +: > "$testout" > + > +${test_wrapper_env} \ > +${run_program_env} \ > +${common_objpfx}elf/ldconfig -p \ > + $testroot/lib >>"$testout" 2>>"$testout" > +status=$? > +echo "info: ldconfig exit status: $status" >>"$testout" OK. > + > +errors=0 > +case $status in > + (0) > + if head -n 1 "$testout" | \ > + grep -q "libs found in cache \`/etc/ld.so.cache'\$" ; then > + echo "info: initial string found" >>"$testout" > + else > + echo "error: initial string not found" >>"$testout" > + errors=1 > + fi > + if grep -q "^ libc\.so\..* => " "$testout"; then > + echo "info: libc.so.* string found" >>"$testout" > + else > + echo "error: libc.so.* string not found" >>"$testout" > + errors=1 > + fi OK. > + ;; > + (1) > + if head -n 1 "$testout" | \ > + grep -q ": Cache file has wrong endianness\.$" ; then > + echo "info: cache file has wrong endianess" >> "$testout" > + else > + echo "error: unexpected ldconfig error message" >> "$testout" > + errors=1 > + fi OK. > + ;; > + (*) > + echo "error: unexpected exit status" >> "$testout" > + errors=1 OK. > + ;; > +esac > + > +exit $errors > > base-commit: 41349f6f67c83e7bafe49f985b56493d2c4c9c77 > -- Cheers, Carlos.