Zsh Mailing List Archive
Messages sorted by:
Re: 3.1.2 beta bug
- X-seq: zsh-workers 3370
- From: Andrew Main <zefram@xxxxxxxxx>
- To: hzoli@xxxxxxxxxxxxxxx (Zoltan Hidvegi)
- Subject: Re: 3.1.2 beta bug
- Date: Tue, 22 Jul 1997 09:35:05 +0100 (BST)
- Cc: jdz@xxxxxxxxxxxxxxxxxx, zsh-workers@xxxxxxxxxxxxxxx
- In-reply-to: <199707211951.PAA25628@xxxxxxxxxxxxxxxxxxxxx> from "Zoltan Hidvegi" at Jul 21, 97 03:51:52 pm
Zoltan Hidvegi wrote:
>As an experiment, 3.1.2 has leaf optimization. It is assumed that a
>directory has no subdirectories if a directory has a link count less than
>2. This optimization is also used by GNU find as I know. Too bad that
>it does not work, since it can speed up some searches a lot (especially
>**/file type pattern globs).
find has an option "-noleaf" to disable the optimisation. Perhaps we
need a similar option in zsh?
> Maybe a test for nlink == 2 instead of <= 2
>would help. A filesystem without the usual Unix directory link count
>semantics would probably have link count 1 for directories.
No, not really. Under Linux:
% ls -ld /proc /proc/*(/)
dr-xr-xr-x 5 root root 0 Apr 30 22:29 /proc
dr-xr-xr-x 3 root root 0 Jul 22 09:27 /proc/1
dr-xr-xr-x 3 root root 0 Jul 22 09:27 /proc/11688
dr-xr-xr-x 3 root root 0 Jul 22 09:27 /proc/12
dr-xr-xr-x 3 root root 0 Jul 22 09:27 /proc/13
[many other processes]
dr-xr-xr-x 2 root root 0 Jul 22 08:44 /proc/net
dr-xr-xr-x 2 root root 0 Jul 22 09:27 /proc/scsi
dr-xr-xr-x 5 root root 0 Jul 22 09:27 /proc/sys
The link count of 5 on /proc suggests three subdirectories, whereas it
actually has many more. Even if zsh isn't doing that form of leaf
optimisation, the fact remains that a directory can easily have a
meaningful but wrong link count. Not to mention the possibility of
a directory actually having multiple links other than . and .. (more
useful than one might imagine).
Leaf optimisation, though powerful, is of use in such limited
circumstances that it is almost useless.
Messages sorted by: