From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-dl1-x122a.google.com (mail-dl1-x122a.google.com [IPv6:2607:f8b0:4864:20::122a]) by sourceware.org (Postfix) with ESMTPS id 320C64BA9000 for ; Mon, 20 Apr 2026 16:40:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 320C64BA9000 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 320C64BA9000 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::122a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776703209; cv=none; b=nYepWXfl63flgJuYSD25RHCdD3hYZoLcP+pDNsNljDqmlEhdvtx1cktZvzqn0QDl27BPtsb1xZjo+DVR9ysFNz8lJTaCrq3VFMufiHuxogDmkxtxvNSgZf6sN9eoqklbjlCQbBttahBsDyOw2KIO/YUp13+BNLFrGvm5doE2Hwo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776703209; c=relaxed/simple; bh=KOulFVj/WXoBTQNTT++jk7Ede5iWu/Cw35WoFJIV7x4=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=czvWNuLYEKSRE11hDzD5W2RP57VWU5fYz0BarFOq6Edzwyx75MQhsdw49/sZWpusdOvrb4ncf+ayfSXkR/sdA6T1FwhVToc+gNYxyI1BztE4ut+qR2/bQQdvBEGduK/5YXNh8a8r7h8b9U3ifHjoiL2aXA/vAcc6UG8i8QHCxaY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 320C64BA9000 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=oUtqpvJG Received: by mail-dl1-x122a.google.com with SMTP id a92af1059eb24-12c637089ccso7808459c88.1 for ; Mon, 20 Apr 2026 09:40:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776703208; x=1777308008; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=pn049vnqzRJ5DivofnP6UwVw67UsVJkflDA83RJNUkU=; b=oUtqpvJGclVzAUcFvLp5ErHbJnwVRxpdxvhKRazBY5jKn9+7I0mYmmjMpJJXhKBJ3N lq6PfrvMfTzuxkIi9YQg7ri3t+JyHGD5s6TaKVT6t91FfaxahCRpo/I4URPrh9Q58L2R Sb9yeQOkEkiNKwCLjilXNjjTFhO3ElLWZp9F2hwx/rg2KTNssBd9F8gRDCn+1SP+MmJF 9DwFQzrfcAkKrKiaHZDxt28MWYPpqF3htEUFKMm6fTpFrJSm6IWR6IVr2YeaJ2MRnEsv Ot/4HdvCTtdaAHTiV2boCzTy7dME81sHEem9wyj/3u46WlHBl5w5I0oaLlpME2udIDfD cBQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776703208; x=1777308008; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=pn049vnqzRJ5DivofnP6UwVw67UsVJkflDA83RJNUkU=; b=plgicBZjiSTFX3kYvR9AdU/ilSU7xy+kswnulQFzz1DoOZTVgoIl6Z9TWKWWEWQDpZ fxK4SoeM+rE2RglML0cTSQJfggj8X3In9p95PmW2MheB8/QXfPOKh752rWSIpZ1c9iRU 5neMlutkN8hTuROy8pNsEwBwRfqpRrTdwDdLCkMD6EBaKjlu6iG2VEDjHobVOA+dGYW6 mQZ4eWFIilx8bNf1wIo7IJLmfGioul3oHmJaCQwMkccoopP57Lx6mTmDuUwQOu96jYTE k7ipS/4FZ8jEZRFR0b/cfG4AraAdAuWFOkf4/rSfVAhsz+Lnw8wjlXxaiX/6+jzi6Dye GhtQ== X-Gm-Message-State: AOJu0YwiTgk8QfwX1ZmgbMAMv92VS4J7vp5xWTjD5/+i7oRPXZ0SzNSX sitv68+dIlzpVPVWcxIRl4n8InM7aVV/GtCP4fkhaNqLt86IX2NAv/dQSwACH7DIBE0= X-Gm-Gg: AeBDievOaXbpXQYcUAcBCRCrd3wsi2nhrp4JClTPnRNwucTxavxpmYQv1Ukmv2mJ+Ff bnoyvT9X2KS/jQqiaY4+7hO/hdGe1hbQCBxxxcZQ5BmRQY8BYF0OcIVSpd/MH7LNu/lvtg9GqS0 H0eqEacaYoSWzEtGmC0ddJBNKTWO2D9dJew6ahPKJuxBLoh+mZATGXmC81ZbvEFHNp2RG0X9cVn 26hV6xCBHW1koxT9RPOOwzfQgbQyS+8XapBwFLe2FMPgALcpxCeCsb5keFRd1Kc/ytckjeIahGU yPPe8nnt9bXvgklV3wZqubgCLhR/ONd7kJgojC55JUPPslMHhJtlmnqCO1nG5w9hl+8nzxV2kr3 gHDOcu+EHcdL7AGnFtDgc4Exqt4Il4byEt34fNzaE3cCPOsyUFe20ePiyqQyjXbgt52DedWgRte i8oF6sEGj9uEvqwBwhdi5GF4YYWuTM2ttwZzL3uadeuy4h6qIMk15eZWukP0EXRfSxqNxSvPyc1 9rdcwaXsAONnWpMe76yHxOd4JseofxmXbHUwG3blQ== X-Received: by 2002:a05:7022:418e:b0:12c:87f1:f41a with SMTP id a92af1059eb24-12c87f1f772mr3642540c88.21.1776703207811; Mon, 20 Apr 2026 09:40:07 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c3:d5d0:c49:69f8:6bda:7b88? ([2804:1b3:a7c3:d5d0:c49:69f8:6bda:7b88]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-12da8b8fbc4sm1073876c88.4.2026.04.20.09.40.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Apr 2026 09:40:07 -0700 (PDT) Message-ID: Date: Mon, 20 Apr 2026 13:40:04 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] io: Fix silent readdir failures in ftw/nftw (BZ 33085) To: DJ Delorie Cc: libc-alpha@sourceware.org References: Content-Language: en-US From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,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 sourceware.org List-Id: On 17/04/26 19:43, DJ Delorie wrote: > > Adhemerval Zanella writes: >> diff --git a/io/ftw.c b/io/ftw.c >> @@ -246,8 +246,16 @@ open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp) >> struct dirent64 *d; >> size_t actsize = 0; >> >> - while ((d = __readdir64 (st)) != NULL) >> + while (1) >> { >> + errno = 0; >> + d = __readdir64 (st); >> + if (d == NULL) >> + { >> + if (errno != 0) >> + return -1; > > Need to free(buf) here. Good catch. > >> - frame->state = FTW_STATE_CLEANUP; >> + { >> + frame->state = FTW_STATE_CLEANUP; >> + if (errno != 0) >> + result = -1; > > And here. This is is not really needed because the open_dir_stream entry will be cleared in the FTW_STATE_CLEANUP state (the code does not return early, but change the state to FTW_STATE_CLEANUP). > >> diff --git a/io/tst-ftw-bz33085.c b/io/tst-ftw-bz33085.c > >> +/* The test stress the readdir calls from nftw, where failures should not > > typo : stress -> stresses Ack. > >> + handled as end of stream. The first it at 'ftw_dir' > > s/it/is/ > Ack. >> + (FTW_STATE_STREAM_LOOP) for the default entries read. The another one is >> + at open_dir_stream where it is triggered when there is a file description >> + exaustion and the code< must close an existing stream to make room for the > > extra < ("code<") Ack. > > Rest looks OK. >