From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by sourceware.org (Postfix) with ESMTPS id 3127A3858408 for ; Fri, 29 Oct 2021 12:14:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3127A3858408 Received: by mail-qk1-x733.google.com with SMTP id ay10so3904350qkb.12 for ; Fri, 29 Oct 2021 05:14:18 -0700 (PDT) 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:references:from:in-reply-to :content-transfer-encoding; bh=aGYqlxPc05GDRcepm33Mpct1TYe2AXBuCuX5PSMBLHQ=; b=YANcOpccbAGatoZ+EByWNfT1LUNa2GWHRu8vsfZFzcQW1BzPUd2bQhJoW1g+aPI0C+ ujSTMpcKInzK7HSyoeuBWtD1Mu8Y23gp4+tBhhka6JkGw4gY0bTCkLJPahJPhqoaPrTx FxA7HS0YsT69csTTnp5K9jcySjB3rkFuB0q6rxhs3LlRqX3IUK2D3CftC7dwZe7On9Ug o9mtUmL5coBAphdnx0jtKm+N9c0xwlp7Kbwi7zNxr1uANCahbc91YQZmT2GusSowQm/U E3RYexesDOXHcaFZ/j2NJiUNUkB4c4q8uWlLCgRjmXZAPrRzYdSZLxYr7+jarZBHJILj VI2A== X-Gm-Message-State: AOAM5325nc7r7gtLGtmSlDkaR8T3F3RKSQhbPomcs63sQyRaZD0gkhP9 m7yevlehxSRJ/tEv+O1xWZR/834s6xeEtA== X-Google-Smtp-Source: ABdhPJzBWDNx0CxtSmkFt4Tou2aG4LlMUPZAC9xicYvBR+2YpU7G9Txnayzes1cL7N7EaqXPCrNZxQ== X-Received: by 2002:a05:620a:288f:: with SMTP id j15mr8511510qkp.280.1635509657650; Fri, 29 Oct 2021 05:14:17 -0700 (PDT) Received: from ?IPV6:2804:431:c7cb:b64f:a500:ef25:9b66:6e05? ([2804:431:c7cb:b64f:a500:ef25:9b66:6e05]) by smtp.gmail.com with ESMTPSA id q13sm3973688qkl.7.2021.10.29.05.14.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Oct 2021 05:14:17 -0700 (PDT) Message-ID: Date: Fri, 29 Oct 2021 09:14:15 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 Subject: Re: [PATCH] tst-tzset: output reason when creating 4GiB file fails Content-Language: en-US To: Stafford Horne , GLIBC patches References: <20211028212300.2311323-1-shorne@gmail.com> From: Adhemerval Zanella In-Reply-To: <20211028212300.2311323-1-shorne@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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, 29 Oct 2021 12:14:19 -0000 On 28/10/2021 18:23, Stafford Horne via Libc-alpha wrote: > Currently, if the temporary file creation fails the create_tz_file > function returns NULL. The NULL pointer is then passed to setenv which > causes a SIGSEGV. Rather than failing with a SIGSEGV print a warning > and exit. > --- > timezone/tst-tzset.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/timezone/tst-tzset.c b/timezone/tst-tzset.c > index d6da2932bb..e6aef6bf51 100644 > --- a/timezone/tst-tzset.c > +++ b/timezone/tst-tzset.c > @@ -103,6 +103,13 @@ static void > test_tz_file (off64_t size) > { > char *path = create_tz_file (size); > + if (path == NULL) > + { > + printf ("creating timezone file of size: %lld MiB failed.\n", > + size / (1024 * 1024)); > + exit (1); > + } > + > if (setenv ("TZ", path, 1) < 0) > { > printf ("setenv failed: %m\n"); > On x86_64: tst-tzset.c: In function ‘test_tz_file’: tst-tzset.c:108:50: error: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘off64_t’ {aka ‘long int’} [-Werror=format=] 108 | printf ("creating timezone file of size: %lld MiB failed.\n", You need to use PRId64: diff --git a/timezone/tst-tzset.c b/timezone/tst-tzset.c index e6aef6bf51..3dad42e041 100644 --- a/timezone/tst-tzset.c +++ b/timezone/tst-tzset.c @@ -25,6 +25,7 @@ #include #include #include +#include static int do_test (void); #define TEST_FUNCTION do_test () @@ -105,7 +106,7 @@ test_tz_file (off64_t size) char *path = create_tz_file (size); if (path == NULL) { - printf ("creating timezone file of size: %lld MiB failed.\n", + printf ("creating timezone file of size: %" PRId64 "MiB failed.\n", size / (1024 * 1024)); exit (1); }