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: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-4.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 9393D1F8C4 for ; Wed, 23 Mar 2022 04:35:31 +0000 (UTC) Received: from localhost ([::1]:37474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nWsiY-0006bB-IG for normalperson@yhbt.net; Wed, 23 Mar 2022 00:35:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWsiP-0006ah-04 for bug-gnulib@gnu.org; Wed, 23 Mar 2022 00:35:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:26818) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWsiK-0000kv-KV for bug-gnulib@gnu.org; Wed, 23 Mar 2022 00:35:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648010113; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=mJ0/RB7d3AQ2G9NrM4Zm7wcOtyufoMqnEIKE5AOczTs=; b=Jq+CyaYLSz+pGJRT4GeIl2q8D0nEbpz525yOtBsDahYwJkgSHe77bgtkZk+/dl4oQxIKCF gfRdLfRAxxsPF/n25dhSBJdXlV4/cxxVG/95UMBl6RxMZgt4xM1/BKdHQNlO+zD9yOzngT 9Zx6xpUz0sdi6YwLW0BzAIsT4pS/Qwg= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-597-DqApvx-LMpCd9QJ1Ovsq9g-1; Wed, 23 Mar 2022 00:34:31 -0400 X-MC-Unique: DqApvx-LMpCd9QJ1Ovsq9g-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 51ACA3C01B94; Wed, 23 Mar 2022 04:34:31 +0000 (UTC) Received: from greed.delorie.com (ovpn-112-4.rdu2.redhat.com [10.10.112.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38C2643E8FF; Wed, 23 Mar 2022 04:34:31 +0000 (UTC) Received: from greed.delorie.com.redhat.com (localhost [127.0.0.1]) by greed.delorie.com (8.15.2/8.15.2) with ESMTP id 22N4YUGo1824068; Wed, 23 Mar 2022 00:34:30 -0400 From: DJ Delorie To: Paul Eggert Subject: Re: [patch v2] glob: resolve DT_UNKNOWN via is_dir In-Reply-To: (message from Paul Eggert on Fri, 11 Mar 2022 16:37:54 -0800) Date: Wed, 23 Mar 2022 00:34:30 -0400 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dj@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Received-SPF: pass client-ip=170.10.129.124; envelope-from=dj@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bug-gnulib@gnu.org Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Paul Eggert writes: > I don't see how the patch fixes the case where readdir_result_type (d) > returns DT_LNK; this might be a symlink to a directory. It was not part of the problem I was trying to solve. A DT_LNK was already a known file type, and handled, so I left it alone. > Proposed pair of patches attached (I haven't installed these). The first > is yours but with tabs turned to spaces and with ChangeLog equal to your > log entry. The second contains my proposed improvements. I haven't > tested except on the Gnulib test cases (which aren't much). I tested it on upstream glibc; it needs one #undef but was otherwise ok. Reviewed-by: DJ Delorie > Of course performance will suffer with all these correctness patches, > but that can wait until a rewrite. Modern XFS and EXT filesystems should not hit these code paths at all, except for symbolic links, and even then only with GLOB_ONLYDIR. > +# define dirfd(str) __dirfd (str) This needs an #undef before it, else it causes build errors as glibc already has a definition for dirfd() and it conflicts with this one. Prudence says they should *all* be protected as such, but I only mention the new one. > + case DT_LNK: case DT_UNKNOWN: I contemplated the case of symbolic links; I couldn't find anything in the standards about it but I went with "glob does what shell wildcards do" and those followed links, and I think that makes sense, so OK. I added that case to my local test area and it seems to do what I think people will expect it to do.