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 48F153858D39 for ; Tue, 18 Jan 2022 11:26:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 48F153858D39 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-42-RtW3k5-IMsepvasdIX3Nog-1; Tue, 18 Jan 2022 06:26:40 -0500 X-MC-Unique: RtW3k5-IMsepvasdIX3Nog-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 746951006AA3; Tue, 18 Jan 2022 11:26:39 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.198]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D2D6B752DC; Tue, 18 Jan 2022 11:26:37 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella Cc: "xuyang2018.jy@fujitsu.com" , Theodore Ts'o , "libc-alpha@sourceware.org" , "fstests@vger.kernel.org" Subject: Re: [PATCH] src/ext4_resize.c: set errno to 0 before the strtoull call References: <1642405014-3287-1-git-send-email-xuyang2018.jy@fujitsu.com> <61E6298D.80006@fujitsu.com> <61E64FED.2010906@fujitsu.com> Date: Tue, 18 Jan 2022 12:26:35 +0100 In-Reply-To: (Adhemerval Zanella's message of "Tue, 18 Jan 2022 08:23:25 -0300") Message-ID: <87wnixjndg.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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: Tue, 18 Jan 2022 11:26:45 -0000 * Adhemerval Zanella: > > > On 18/01/2022 02:27, xuyang2018.jy--- via Libc-alpha wrote: >> on 2022/1/18 11:56, Theodore Ts'o wrote: >>> On Tue, Jan 18, 2022 at 02:43:26AM +0000, xuyang2018.jy@fujitsu.com wrote: >>>>> You're right of course, but out of curiosity, which C library are you >>>>> using? >>>> I use glibc-2.34. >>> >>> Hmm, ok. I'm using glibc 2.31, and in this particular program, errno >>> shouldn't have been set by any prior system call. I'm guessing maybe >>> it was something in crt0 which ended up setting errno? >> It maybe a glibc bug. >> I cc glibc mailing list and see whether they have met this problem. >> >> @Florian >> >> Now, I use glibc-2.34 and run the following program[1] but the errno is >> not 0 in the beginning. So is this a known bug on glibc-2.34(Theodore >> doesn't meet this problem on glicb-2.31)? >> >> [1]https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git/tree/src/ext4_resize.c > > The errno should be only set on a failure, no function shall set errno > to 0 (it is a POSIX definition which glibc adheres). The application > need to explicitly set errno to 0 before the function call to check if > an error occurs. While this is true, I think errno should still be 0 at the start of the program. Thanks, Florian