public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: "Yaakov (Cygwin Ports)" <yselkowitz@users.sourceforge.net>
To: cygwin-apps@cygwin.com
Subject: Re: cygport-0.9.0 in release-2
Date: Mon, 25 Aug 2008 17:22:00 -0000	[thread overview]
Message-ID: <48B2EA05.7090308@users.sourceforge.net> (raw)
In-Reply-To: <48B2D751.3060405@users.sourceforge.net>

-----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-----

  reply	other threads:[~2008-08-25 17:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-24  7:10 Yaakov (Cygwin Ports)
2008-08-25 12:06 ` Eric Blake
2008-08-25 15:53   ` Yaakov (Cygwin Ports)
2008-08-25 16:02     ` Yaakov (Cygwin Ports)
2008-08-25 17:22       ` Yaakov (Cygwin Ports) [this message]
2008-08-27  3:14 ` Yaakov (Cygwin Ports)
2008-08-28  5:16   ` Reini Urban
2008-08-29  0:27     ` Yaakov (Cygwin Ports)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48B2EA05.7090308@users.sourceforge.net \
    --to=yselkowitz@users.sourceforge.net \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).