This is the mail archive of the cygwin 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: link count wrong for pseudo-dirs (?); find gets confused

Hash: SHA1

According to Linda A. Walsh on 1/5/2006 9:35 PM:
> You may have not had a chance to drill into the details of the
> "cygcheck.out" I attached last email, but...

It's still on my todo list; free time is often a scarce commodity.

>    You know, thinking about this -- it sounds like my problem
> is related to what you are talking about, _but_ I'm not
> running a snapshot (as I understand it).
>    Side note: I don't have /proc show up in my root when I 'ls'.
>    Do you have a dummy entry created?

/proc is auto-listed only in the snapshots; to have it listed in 1.5.18
you had to create a dummy directory.

Mount points are similar; if you don't have a dummy directory underlying
the mount point, the directory link count is liable to be wrong.

> Anyway, my "cygdrive"="null".  I.e. my mapped drives
> map onto my root drive.  So not only is my "/" equal to "\"
> on my "$SYSTEMDRIVE" (C:), but my drives show up mounted under
> "/" as "/a", "/b", "c"...

Yes, your cygcheck showed that.

>    I also get different numbers of subdirectories when I list
> "/" than what the "link" count says and a third number if I list
> using "cygpath -w":
> $ ls -ldF /
> drwxr-x---  31 law 0 Dec 31  1969 // ## 31 links
> $ cmd /c dir |grep DIR|wc -l        24                         ## 24
> dirs seen by windows
>     24

Was this run in /, or did you just get the subdirectory count of an
unrelated directory?

> $ ls -1F|grep "/"|wc -l         ## ***Find note below
> ls: pagefile.sys: No such file or directory
> ls: d: No such file or directory   ## (removable disk)
> ls: e: No medium found            ## (cd/dvd drive)
> 38                               ## 38 dirs seen by ls

This implies that the subdirs seen by ls do not impact the link count,
probably because they are mount directories without underlying dummy

> ----
> $ ls -1F `cygpath -w /`|grep "/"|wc -l    ls: C:\/pagefile.sys: No such
> file or directory
> 29                    ## 29 dirs?: not sure this is relevant?

This matches your earlier ls - a link count of 31 implies 29
subdirectories under traditional unix semantics (where every mount point
also has a dummy directory, and no directory hard links exist).

> ---
> ***Find doesn't inspect the last 9 subdirectories of this
>   ls listing.

Yes, if you don't use -noleaf, find quits statting for directories after
it has read link count - 2 subdirectories, so it will fail to traverse the
remaining subdirectories when the link count is inaccurate.  I don't know
if it is easy (or even possible) to make the link count accurate in the
presence of mount points without underlying directories, or on the other
hand to make the link count 0 in directories with mount point
subdirectories (because find no longer tries the link count optimization
on directories with a link count of 0).

> Hope this gives some more info to go on.
> I emphasize -- this isn't a 'snapshot' as I understand it,
> it was downloaded through "setup.exe".
> Let me know if you want any more info or to try any test
> cases.

- --
Life is short - so eat dessert first!

Eric Blake   
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Thunderbird -


Unsubscribe info:
Problem reports:

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