From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id B1C621F8C6 for ; Fri, 9 Jul 2021 13:14:17 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E267A398A48E for ; Fri, 9 Jul 2021 13:14:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E267A398A48E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1625836456; bh=lBjuLm3zpbKzSHK+UZEuWubvG31oPsCbYV1KuBIWcuo=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=o6Rokk+sgWU0F4CQ2j/I69se57kMGtARuP7HbQ/WsUVC9WUvI0n983RjDnFafaYGs GM3VyIsD85qZE1/DwMSzKA60BOmSVi83vGRnm5lD5meifRmVhgjT+k55qGFe8GRmtt 6sNYYmWlPuy309zdlncuUXqSCOf1ePB5s1NR2I24= Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id 24AAB384BC11 for ; Fri, 9 Jul 2021 13:13:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 24AAB384BC11 Received: by mail-pl1-x62b.google.com with SMTP id p17so4451194plf.12 for ; Fri, 09 Jul 2021 06:13:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lBjuLm3zpbKzSHK+UZEuWubvG31oPsCbYV1KuBIWcuo=; b=NU+ejLKjk6DVveqvaHWkVhPT+Rkcwlox+S/HsCJyY0UKAt8f+gQ0Q3ZqEBmf9/qjtZ iXfMpbcgY0YqAM4N7chf5FMdHezQXQKCWnIE8iSs4CO49oz6l3tOpi272iQYrRWqBQ0o XQ8xOGb0nBwAKtw+wwLNFCgpBP6cpQMPfJYIaJFFAeQSGmqO2fMJGrDyelkvmCEtl2kE ekZUevqG9Jn66IRJqspECS0x9VIp3HpfJYeSKDu/4iSP/uz+ZA/O3tBSjEbNufkKFyss ZrmsIJATLbFi2vDKwJTpPYp5xdIISSz0mvopiiwwEB9RIOeaciKQ7CdJCKIsuTwjRm0g F+oA== X-Gm-Message-State: AOAM5325wQSoQ/KUEWPE0GS7kVq+ptg+E5pjmxD0xzv9h2D6H7l9Lys2 zXZeorX27HNa2bOMyPJuwarupuyNbFOqFQ== X-Google-Smtp-Source: ABdhPJyqZhTZnfn6piUoXfLyB4p5hq09W3Pho7TP+82sS0gcZDV2vVnjXyzLUyzH+BfSr1nglnwZUA== X-Received: by 2002:a17:90a:ca8d:: with SMTP id y13mr10182951pjt.61.1625836431939; Fri, 09 Jul 2021 06:13:51 -0700 (PDT) Received: from [192.168.1.108] ([177.194.59.218]) by smtp.gmail.com with ESMTPSA id d14sm6680648pfv.171.2021.07.09.06.13.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Jul 2021 06:13:51 -0700 (PDT) Subject: Re: [PATCH] Properly run tst-spawn5 directly [BZ #28067] To: "H.J. Lu" , libc-alpha@sourceware.org References: <20210709130408.1620161-1-hjl.tools@gmail.com> Message-ID: <101ef60c-0d86-e756-5413-dcec94b0b6d8@linaro.org> Date: Fri, 9 Jul 2021 10:13:49 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210709130408.1620161-1-hjl.tools@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: , From: Adhemerval Zanella via Libc-alpha Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On 09/07/2021 10:04, H.J. Lu wrote: > Change tst-spawn5.c to handle tst-spawn5 without optional path to ld.so, > --library-path nor the library path when glibc is configured with > --enable-hardcoded-path-in-tests. This fixes BZ #28067. I was about to push a fix for this change, but your were faster. LGTM, one suggestion below. Reviewed-by: Adhemerval Zanella > --- > posix/tst-spawn5.c | 30 +++++++++++++++++++----------- > 1 file changed, 19 insertions(+), 11 deletions(-) > > diff --git a/posix/tst-spawn5.c b/posix/tst-spawn5.c > index 277b848794..8649bb5094 100644 > --- a/posix/tst-spawn5.c > +++ b/posix/tst-spawn5.c > @@ -40,6 +40,7 @@ static int restart; > /* Hold the four initial argument used to respawn the process, plus > the extra '--direct' and '--restart', and a final NULL. */ > static char *initial_argv[7]; > +static int initial_argv_count; > > #define CMDLINE_OPTIONS \ > { "restart", no_argument, &restart, 1 }, > @@ -133,11 +134,16 @@ static void > spawn_closefrom_test (posix_spawn_file_actions_t *fa, int lowfd, int highfd, > int *extrafds, size_t nextrafds) > { > - /* 6 elements from initial_argv (path to ld.so, '--library-path', the > - path', application name', '--direct', and '--restart'), up to > - 2 * maximum_fd arguments (the expected open file descriptors), plus > - NULL. */ > - enum { argv_size = array_length (initial_argv) + 2 * NFDS + 1 }; > + /* 3 or 6 elements from initial_argv: > + + path to ld.so optional > + + --library-path optional > + + the library path optional > + + application name > + + --direct > + + --restart > + up to 2 * maximum_fd arguments (the expected open file descriptors), > + plus NULL. */ > + int argv_size = initial_argv_count + 2 * NFDS + 1; > char *args[argv_size]; > int argc = 0; > > @@ -268,12 +274,14 @@ do_test (int argc, char *argv[]) > if (restart) > handle_restart (argc, argv); > > - initial_argv[0] = argv[1]; /* path for ld.so */ > - initial_argv[1] = argv[2]; /* "--library-path" */ > - initial_argv[2] = argv[3]; /* the library path */ > - initial_argv[3] = argv[4]; /* the application name */ > - initial_argv[4] = (char *) "--direct"; > - initial_argv[5] = (char *) "--restart"; > + int i; > + > + for (i = 0; i < (argc == 5 ? 4 : 1); i++) > + initial_argv[i] = argv[i + 1]; I used: TEST_VERIFY_EXIT (argc == 2 || argc == 5); int i; for (i = 0; i < argc - 1; i++) initial_argv[i] = argv[i + 1]; > + initial_argv[i++] = (char *) "--direct"; > + initial_argv[i++] = (char *) "--restart"; > + > + initial_argv_count = i; > > do_test_closefrom (); > >