Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: bug in patterns used for filename expansion (e.g. a[b/c]d)



On 2007-10-09 08:24:13 -0700, Bart Schaefer wrote:
> That said, the thing zsh-as-ksh is most like is ksh88.

I think that the manual should say that, because it seems that the
provided AT&T ksh is generally ksh93 (e.g. under Debian and Mac OS X).

>  
> } vin:~> ksh --version
> } zsh 4.3.4 (i686-pc-linux-gnu)
> } vin:~> ksh
> } $ ls a[b/*
> } ls: a[b/*: No such file or directory
> } 
> } vin:~> ksh93
> } $ ls a[b/*
> } > ksh93: syntax error: `[' unmatched
> 
> This is exactly the difference between bash and ksh as mentioned on
> the austin-group, is it not?

No, Geoff Clare said in the austin-group is:

$ ls a[b/*
a[b/file

in both cases. This is also what I obtain with AT&T ksh93 under Mac OS X.
So, only zsh, when run as ksh, is different. Is this a bug in zsh or does
ksh88 behave like that? (I don't have ksh88, so I can't test.)

> } vin:~> ksh -c 'ls a[b/*'
> } ls: a[b/*: No such file or directory
> } vin:~> ksh93 -c 'ls a[b/*'
> } ls: a[b/*[: No such file or directory
> 
> Where'd that extra '[' come from?  I'd say this is a ksh bug.

Yes, this is strange and ksh93 under Mac OS X behaves differently, so
I assume that this is a bug in Debian's ksh package.

> 
> } vin:~> touch 'a[b/*'
> } vin:~> ksh93 -c 'ls a[b/*'
> } ls: a[b/*[: No such file or directory
> } vin:~> ksh -c 'ls a[b/*'
> } a[b/*
> 
> Again modulo the extra-bracket bug, this is the bash v. ksh thing.

No:

vin:~> ll a\[b
-rw-r--r-- 1 vlefevre vlefevre 0 2007-10-09 16:10:36 *
-rw-r--r-- 1 vlefevre vlefevre 0 2007-10-09 16:25:17 *[
-rw-r--r-- 1 vlefevre vlefevre 0 2007-10-09 16:04:18 file
vin:~> bash -c 'ls a[b/*'
a[b/*  a[b/*[  a[b/file

and with ksh from Mac OS X (sh (AT&T Labs Research) 1993-12-28 p),
I get the same behavior, while zsh gives:

vin:~> ksh -c 'ls a[b/*'
a[b/*

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)



Messages sorted by: Reverse Date, Date, Thread, Author