[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch v2] glob: resolve DT_UNKNOWN via is_dir

From: Paul Eggert
Subject: Re: [patch v2] glob: resolve DT_UNKNOWN via is_dir
Date: Wed, 23 Mar 2022 10:35:02 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

On 3/22/22 21:34, DJ Delorie wrote:

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.

Right, though glob uses GLOB_ONLYDIR internally so this slower code will execute in some cases even when the user doesn't specify 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.

Thanks, I protected it with an ifdef instead as that's more likely perform better.

Also, I noticed that the Gnulib glob module needs to be GPL not LGPLv2+, since it now depends on GPL modules like fstatat. So I fixed this (Gnulib-specific) issue as well.

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.

Thanks for checking that.

I installed the attached into Gnulib. The first two patches are the same as what I sent earlier, except with the ifdef and GPL changes mentioned above. The 3rd patch tests for glibc bug 25659, replaces glibc glob if the bug is present, and makes sure the resulting glob passes a sanity check.

I hope this lets us make the Gnulib and glibc glob.c identical.

Attachment: 0001-glob-resolve-DT_UNKNOWN-via-is_dir.patch
Description: Text Data

Attachment: 0002-glob-fix-symlink-and-issues-improve-speed.patch
Description: Text Data

Attachment: 0003-glob-test-for-glibc-bug-25659.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]