[{"id":3672999,"web_url":"http://patchwork.ozlabs.org/comment/3672999/","msgid":"<87ldf4ilz4.fsf@gmail.com>","list_archive_url":null,"date":"2026-04-03T06:42:07","subject":"Re: [PATCH v5 2/2] io: Use gnulib fts implementation (BZ 22944, BZ\n 20331)","submitter":{"id":88687,"url":"http://patchwork.ozlabs.org/api/people/88687/","name":"Collin Funk","email":"collin.funk1@gmail.com"},"content":"Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:\n\n> This patch synchronizes the glibc fts implementation with the latest\n> version from gnulib (as of 2026-02-16).\n>\n> The primary motivation is to address limitations in the legacy glibc\n> implementation, most notably BZ 22944, where fts fails with an\n> ENAMETOOLONG error when traversing very long paths or deeply nested\n> directory trees.  The gnulib implementation dynamically reallocates\n> path buffers and uses openat/fchdir optimizations, effectively\n> lifting the MAXPATHLEN limitation.\n>\n> The gnulib implementation also added extra features, which are\n> used by different GNU projects (coreutils, diffutils):\n>\n>  * FTS_TIGHT_CYCLE_CHECK: used to enable a strict, immediate\n>    cycle-detection algorithm during a file system traversal.  This is\n>    done internally using a hash table: every time the traversal enters\n>    a directory, it records the directory's device and inode (dev/ino)\n>    pair in the hash table, and before entering any directory, fts\n>    checks the hash table.\n>\n>  * FTS_CWDFD: instead of actually changing the process's current\n>    working directory, it maintains a virtual current working directory\n>    using file descriptors.  The file descriptor is store at the\n>    fts_cwd_fd field and all subsequent file operations are performed\n>    relative to this file descriptor using *at functions.\n>\n>  * FTS_DEFER_STAT: performance-oriented flag that instructs the file\n>    tree traversal engine to delay fetching file metadata.  When the\n>    flag is used, fts skips the immediate stat call.  Instead, it marks\n>    the entry with a special internal state (FTS_NSOK and\n>    FTS_STAT_REQUIRED).  The actual stat call is pushed down the line\n>    and executed by fts_read right before the application actually\n>    accesses the entry.\n>\n>  * FTS_VERBATIM: fts_open aaccept and use the path strings exactly as\n>    they were provided in the arguments array without slash trimming.\n>\n>  * FTS_MOUNT: it restrict the file tree walk to a single file system.\n>\n> Hopefully,it would allow some GNU projects to use the glibc\n> implementation instead of pulling the gnulib one.\n>\n> It requires some changes to keep compatibility, compared to gnulib:\n>\n>  * The new required fields are added at the end of FTS structure, and\n>    the new FTS flags are adjusted to avoid change FTS_NAMEONLY/FTS_STOP\n>    (even though they are marked as private).\n>\n>  * The FTSENT uses a flexible array (fts_name), so two adjustments are\n>    required: the two new members (fts_fts and fts_dirp) are place\n>    *before* the struct and the fts_statp is now always allocated and\n>    accounted (the gnulib implementation uses a awalys allocated member).\n>\n> Checked on x86_64-linux-gnu and i686-linux-gnu.\n> --\n> Changes from v4:\n> * I_ring struct, typedef, and enum under the \"__*\".\n> ---\n\nThis looks good to me. Thanks again for working on this.\n\nReviewed-by: Collin Funk <collin.funk1@gmail.com>\n\nCollin","headers":{"Return-Path":"<libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org>","X-Original-To":["incoming@patchwork.ozlabs.org","libc-alpha@sourceware.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","libc-alpha@sourceware.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=lQ7955kd;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=lQ7955kd","sourceware.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","sourceware.org; spf=pass smtp.mailfrom=gmail.com","server2.sourceware.org;\n arc=none smtp.remote-ip=2607:f8b0:4864:20::42b"],"Received":["from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fn8Kk2FQjz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 03 Apr 2026 17:42:33 +1100 (AEDT)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id A94204BA23DB\n\tfor <incoming@patchwork.ozlabs.org>; Fri,  3 Apr 2026 06:42:30 +0000 (GMT)","from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com\n [IPv6:2607:f8b0:4864:20::42b])\n by sourceware.org (Postfix) with ESMTPS id 59CF14BA23C3\n for <libc-alpha@sourceware.org>; Fri,  3 Apr 2026 06:42:10 +0000 (GMT)","by mail-pf1-x42b.google.com with SMTP id\n d2e1a72fcca58-82a7ebc729dso689762b3a.3\n for <libc-alpha@sourceware.org>; Thu, 02 Apr 2026 23:42:10 -0700 (PDT)","from fedora ([2601:646:8081:3770::19df])\n by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-82cf9c6ad8asm5241540b3a.40.2026.04.02.23.42.08\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 02 Apr 2026 23:42:08 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org A94204BA23DB","OpenDKIM Filter v2.11.0 sourceware.org 59CF14BA23C3"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 59CF14BA23C3","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 59CF14BA23C3","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775198530; cv=none;\n b=EPVYyILL4ishkvkiAhLaUAsMUtb/wIk3N8T97jMQSDseGhTMk/Z8iw/U4S5gHgiDIXsodWOVivm7bQS+2j/mctafLi/15AsOfMkWh5H8uD2dx+G28raA6Jia7jURZCyVu4Bzgv1/ggR0N+xP6BnRCePHc/Mfr1hzvStatcPL58c=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1775198530; c=relaxed/simple;\n bh=hvH2fxDKF+R8QY73x91roa5qd16krW4MZFeMpZCQW3w=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=ia9zaAvovBdj61/VC/+sqrWCzc7jA3dEn98KUdBh2MFkZaHMSTbB9P6PD16SVTiL4W4yC/Z8+9WBBma9+a+MBpftSwDtHEaxxUXjLPKy66iCZSwXZMAGIc4o7210+kySDn0NovhQvtIt11yhQbQHFv8/FJFYBoKcli3Sh7o4IW4=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775198529; x=1775803329; darn=sourceware.org;\n h=mime-version:user-agent:message-id:date:references:in-reply-to\n :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=LPYCIUEqYAyfWiV+Fq4S13W/d+c8PiJv45Qkg87KDNA=;\n b=lQ7955kdVbWaoEGz2qI1bolTEbeCe5xdkRjcDEcSVaxvPlEyWHmDAaTPU3jADUUJ59\n kkgGy94Hp1paz8JLN9gX56dqvAHMBDzMiP3Vs6VAgBsQFE+nxlCSrR/ef5ynFxv2/4Ea\n kF1AtlhuAMxJ9kWwVROy4wpUmo6MVNbvWV5b5kzaEcjzO6obiw+8AwF6HqHZ+oxzQp1B\n TLO574C1YJmgrLwWbcT+AmTC/hHQo7oyG+4Dzv5+wyU8rtlium+asWZolQKtPa+9M16w\n ZQTdfnenbhdnBrclr/WPCdeqDJr+3duAY1bGqSG8gnYsUVaQTHmE352Z40T/ih3khAQP\n FwUA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775198529; x=1775803329;\n h=mime-version:user-agent:message-id:date:references:in-reply-to\n :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to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:b0:82c:eb46:aeac with SMTP id\n d2e1a72fcca58-82d0dbc34dcmr1901435b3a.50.1775198529105;\n Thu, 02 Apr 2026 23:42:09 -0700 (PDT)","From":"Collin Funk <collin.funk1@gmail.com>","To":"Adhemerval Zanella <adhemerval.zanella@linaro.org>","Cc":"libc-alpha@sourceware.org","Subject":"Re: [PATCH v5 2/2] io: Use gnulib fts implementation (BZ 22944, BZ\n 20331)","In-Reply-To":"<20260402190108.919025-2-adhemerval.zanella@linaro.org>","References":"<20260402190108.919025-1-adhemerval.zanella@linaro.org>\n <20260402190108.919025-2-adhemerval.zanella@linaro.org>","Date":"Thu, 02 Apr 2026 23:42:07 -0700","Message-ID":"<87ldf4ilz4.fsf@gmail.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","Content-Type":"text/plain","X-BeenThere":"libc-alpha@sourceware.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Libc-alpha mailing list <libc-alpha.sourceware.org>","List-Unsubscribe":"<https://sourceware.org/mailman/options/libc-alpha>,\n <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe>","List-Archive":"<https://sourceware.org/pipermail/libc-alpha/>","List-Post":"<mailto:libc-alpha@sourceware.org>","List-Help":"<mailto:libc-alpha-request@sourceware.org?subject=help>","List-Subscribe":"<https://sourceware.org/mailman/listinfo/libc-alpha>,\n <mailto:libc-alpha-request@sourceware.org?subject=subscribe>","Errors-To":"libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org"}}]