From patchwork Wed Sep 5 09:14:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 29200 Received: (qmail 95865 invoked by alias); 5 Sep 2018 09:16:35 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 89397 invoked by uid 89); 5 Sep 2018 09:15:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-27.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS, TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.2 spammy=Hx-languages-length:3682, installs X-HELO: mx0a-001b2d01.pphosted.com Subject: Re: [PATCH] Adjust name-prefix of ld.so in test-container.c. To: DJ Delorie Cc: fweimer@redhat.com, libc-alpha@sourceware.org References: From: Stefan Liebler Date: Wed, 5 Sep 2018 11:14:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: x-cbid: 18090509-0016-0000-0000-000002009112 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18090509-0017-0000-0000-00003257322E Message-Id: On 09/04/2018 06:37 PM, DJ Delorie wrote: > > Stefan Liebler writes: >> + if (strncmp (argv[1], support_objdir_elf_ldso, >> + strlen (support_objdir_elf_ldso)) == 0) > > If we're comparing the whole name now, this could be a strcmp() instead? > Yes, of course. You are right. I've updated the patch. Thanks Stefan Reviewed-by: Carlos O'Donell commit 79f7c31ef02a13eb6ede1393770d29cb36914754 Author: Stefan Liebler Date: Wed Sep 5 09:23:13 2018 +0200 Adjust name of ld.so in test-container.c. The test-container.c file assumes that ld.so is always named something like /elf/ld-linux-*. But e.g. on s390x it is named ld64.so.1 or ld.so.1 on s390. There are other architectures like power or mips with similar names. This patch introduces the new global variable support_objdir_elf_ldso which contains the absolute path to the runtime linker used by the testsuite, e.g. OBJDIR_PATH/elf/ld-linux-x86-64.so.2. The check in test-container.c is now comparing against this path. Without this patch, test-container.c is searching invalid files / directories and fails to find glibc/nss/tst-nss-test3.root/tst-nss-test3.script. Then the test tst-nss-test3 fails! ChangeLog: * support/support.h (support_objdir_elf_ldso): New variable. * support/support_paths.c (support_objdir_elf_ldso): Likewise. * support/Makefile (CFLAGS-support_paths.c): Add definition for OBJDIR_ELF_LDSO_PATH. * support/test-container.c (main): Search for the ld.so which is also used by the testsuite. diff --git a/support/Makefile b/support/Makefile index 545bfa2727..8b4a7bf8c5 100644 --- a/support/Makefile +++ b/support/Makefile @@ -160,6 +160,7 @@ endif CFLAGS-support_paths.c = \ -DSRCDIR_PATH=\"`cd .. ; pwd`\" \ -DOBJDIR_PATH=\"`cd $(objpfx)/..; pwd`\" \ + -DOBJDIR_ELF_LDSO_PATH=\"`cd $(objpfx)/..; pwd`/elf/$(rtld-installed-name)\" \ -DINSTDIR_PATH=\"$(prefix)\" \ -DLIBDIR_PATH=\"$(libdir)\" diff --git a/support/support.h b/support/support.h index d0e15bca1d..9418cd11ef 100644 --- a/support/support.h +++ b/support/support.h @@ -91,6 +91,10 @@ char *xstrndup (const char *, size_t); extern const char support_srcdir_root[]; extern const char support_objdir_root[]; +/* Corresponds to the path to the runtime linker used by the testsuite, + e.g. OBJDIR_PATH/elf/ld-linux-x86-64.so.2 */ +extern const char support_objdir_elf_ldso[]; + /* Corresponds to the --prefix= passed to configure. */ extern const char support_install_prefix[]; /* Corresponds to the install's lib/ or lib64/ directory. */ diff --git a/support/support_paths.c b/support/support_paths.c index a1c22315bd..6d0beb102c 100644 --- a/support/support_paths.c +++ b/support/support_paths.c @@ -36,6 +36,14 @@ const char support_objdir_root[] = OBJDIR_PATH; # error please -DOBJDIR_PATH=something in the Makefile #endif +#ifdef OBJDIR_ELF_LDSO_PATH +/* Corresponds to the path to the runtime linker used by the testsuite, + e.g. OBJDIR_PATH/elf/ld-linux-x86-64.so.2 */ +const char support_objdir_elf_ldso[] = OBJDIR_ELF_LDSO_PATH; +#else +# error please -DOBJDIR_ELF_LDSO_PATH=something in the Makefile +#endif + #ifdef INSTDIR_PATH /* Corresponds to the --prefix= passed to configure. */ const char support_install_prefix[] = INSTDIR_PATH; diff --git a/support/test-container.c b/support/test-container.c index c56b53ed81..fbdfb4a06a 100644 --- a/support/test-container.c +++ b/support/test-container.c @@ -674,8 +674,7 @@ main (int argc, char **argv) } } - if (strncmp (argv[1], concat (support_objdir_root, "/elf/ld-linux-", NULL), - strlen (support_objdir_root) + 14) == 0) + if (strcmp (argv[1], support_objdir_elf_ldso) == 0) { ++argv; --argc;