From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23320 invoked from network); 11 May 1998 15:59:23 -0000 Received: from ns2.primenet.com.au (HELO primenet.com.au) (7795@203.24.36.3) by ns1.primenet.com.au with SMTP; 11 May 1998 15:59:23 -0000 Received: (qmail 7630 invoked from network); 11 May 1998 15:59:12 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns2.primenet.com.au with SMTP; 11 May 1998 15:59:12 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id LAA22796; Mon, 11 May 1998 11:49:02 -0400 (EDT) Resent-Date: Mon, 11 May 1998 11:49:02 -0400 (EDT) From: Zoltan Hidvegi Message-Id: <199805111549.KAA90396@frontiernet.net> Subject: Re: PATCH: misc glob fixes In-Reply-To: <199805110936.KAA22602@taos.demon.co.uk> from Andrew Main at "May 11, 98 10:36:47 am" To: zefram@tao.co.uk (Andrew Main) Date: Mon, 11 May 1998 10:49:06 -0500 (CDT) Cc: zsh-workers@math.gatech.edu X-Mailer: ELM [version 2.4ME+ PL35 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"uUy-h1.0.7a5.ktnLr"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3965 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Zefram wrote: > Zoltan Hidvegi wrote: > >First, many systems ignore trailing slashes on filenames. As a result */ > >will match all files instead of just directories as required by common > >sense and the POSIX standard. The solution is to stat/lstat/access > >`filename/.' instead of `filename/'. > > But "filename/." can't be statted if the directory is not searchable > by the zsh process, whereas POSIX would require the glob to succeed. > It would be better to stat "filename/" and test that the result has > type directory. Actually I'm not sure about that. POSIX requites that pathname components other than the last component should be searchable. You can think filename/ as two components, the second component is empty. I tested many shells (various old Korn and Bourne shells) and none of them matches unsearchable directories with */ Also note that on Linux you need search permission on filename in order to stat filename/, so on Linux sometimes you are not allowed to stat filename/ while you are allowed to stat filename. The same is true for the good old Ultrix 4.2, and perhaps other systems. On these systems the patch has no effect on the shell behavior. I think the shell should behave the same way on all systems, and it should behave like sh and ksh, so I think that the patch implements the correct behavior. Zoli