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

Re: [doc] "sh_word_split nothing to do with word splitting"?



Op 25-03-18 om 08:42 schreef Stephane Chazelas:
> There have been many cases where POSIX have specified accidents
> of implementation or design bugs of original implementations and
> the POSIX specification has been fixed later on when spotted
> even in some cases forcing the original implementation to be
> fixed.
> 
> IMO, here, it's clearly one of those. The solution here is not to
> implement the bug but fix the specification.

By that token, global field splitting and globbing themselves are
massive design flaws (which they are -- as you know I've been working on
a cross-shell way to make it practical to get rid of them).

Yet, POSIX shells conform, at least in their respective POSIX modes.

At least the current spec is consistent. All POSIX expansions are
subject to global split & glob (unless those are disabled).

Why would $( ... ) be subject to split+glob but not $(( ... ))? That
would be a bit confusing, and would detract from quoting expansions
consistently.

I think consistent and broken is better than inconsistent and broken.

> There are many "unspecified areas" in POSIX where it's the case,
> if you rely on unspecified behaviour you can't expect anything
> portably.

I don't see that as a reason to add yet another unspecified behaviour.
In practice we'd be stuck with it for a decade anyway, maybe two.

To rephrase myself, I think specified and broken is better than
unspecified and broken.

> In the mean time, we should document the difference so it's no
> longer "mysterious" like in my  suggested patch.

Yes, but what wonderful planet do you live on, where people actually
read documentation? :)

>> Then pdksh, supposedly a ksh88 clone, failed to clone ksh88 in that
>> aspect -- among many others.
> [...]
> 
> pdksh has fixed a number of issues in ksh88 (itself broken on
> many aspects as you've found out) as well. Another one shared
> with zsh: that the ".*" glob does not include "." nor ".." (in
> the case of pdksh actually inherited from the Forsyth shell).

I don't really see that as a fix though, just as another mostly
pointless difference causing incompatibility surprises. ksh93 matches
'.' and '..' to this day.

On zsh, it looks like another emulation bug. The SH_GLOB option should
cause ".*" to match "." and "..".

(Actually, modernish ought to detect this as a shell quirk with its own
ID. Thanks for reminding me of it.)

- M.



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