From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1251 invoked from network); 22 Jul 1997 09:07:25 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 22 Jul 1997 09:07:25 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id FAA29220; Tue, 22 Jul 1997 05:01:01 -0400 (EDT) Resent-Date: Tue, 22 Jul 1997 05:01:01 -0400 (EDT) From: Andrew Main Message-Id: <199707220835.JAA20961@taos.demon.co.uk> Subject: Re: 3.1.2 beta bug To: hzoli@frontiernet.net (Zoltan Hidvegi) Date: Tue, 22 Jul 1997 09:35:05 +0100 (BST) Cc: jdz@grogg.engr.sgi.com, zsh-workers@math.gatech.edu In-Reply-To: <199707211951.PAA25628@node5.frontiernet.net> from "Zoltan Hidvegi" at Jul 21, 97 03:51:52 pm X-Loop: zefram@tao.co.uk X-Headers: in preparation X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"HYfz42.0.V87.DR7rp"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3370 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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. -zefram