This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygport-0.9.0 in release-2


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Eric Blake wrote:
> Other *NIX behave the same way, if they do not populate st_nlink
> to > 1 for directories (for example, I believe this is how Linux handles
> FAT filesystems, so the same lndir bug would be present there).
> Findutils already had to add special-case code to deal with st_nlink==1
> on directories, so it is more than just cygwin that does this, and
> this is a genuine upstream bug in lndir and not just a cygwin artifact.

OK, I'm just a bit surprised that I couldn't find a patch elsewhere for
this issue.

> Look closely at the lndir source code - it is doing an optimization
> where it avoids stat'ting directory entries once n_dirs is down to
> 0; because on file systems where the optimization works, n_dirs
> tells you how many subdirectories to expect, and once you have
> seen them all, all remaining readdir() entries will be non-directories.
> But in the case where st_nlink is too expensive to populate
> correctly (as is the case in cygwin, but also in other *NIX on
> various file systems like FAT), then ALL readdir results need
> stat'ting, since you no longer know if there are any remaining
> subdirs.

OK.

> That works, but I would prefer this (and don't make it conditional
> on cygwin, as it would also fix the bug for other platforms):
> 
> --- lndir.c.orig    2008-08-25 10:12:28.701142400 -0600
> +++ lndir.c    2008-08-25 10:13:20.606395800 -0600
> @@ -182,6 +182,8 @@
>     if (*(p - 1) != '/')
>     *p++ = '/';
>     n_dirs = fs->st_nlink;
> +    if (n_dirs == 1)
> +    n_dirs = INT_MAX;
>     while ((dp = readdir (df))) {
>     if (dp->d_name[strlen(dp->d_name) - 1] == '~')
>         continue;

Thanks, I've just committed xorg/lndir 1.0.1-2 to Ports SVN with this
patch.  I'll get this into release-2 as soon as I can, replacing
xorg-x11-bin-lndir, and make cygport-0.9 rely on it unconditionally.


Yaakov
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEAREIAAYFAkiy6gUACgkQpiWmPGlmQSMAHgCcCTmsiY1GjmlQFiF8JKo7tzWG
dfMAn0T4dIbK0rVs4Us76HLaEHzi3Zf8
=pIpm
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]