Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: The big kre zsh bug report
- X-seq: zsh-workers 43926
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Robert Elz <kre@xxxxxxxxxxxxx>
- Subject: Re: The big kre zsh bug report
- Date: Fri, 21 Dec 2018 12:37:08 -0800
- Cc: Martijn Dekker <martijn@xxxxxxxx>, "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bZAedSluTIJxte+EPmFV70LZADZb/kdZj0UA2tUiV3E=; b=O5aGQYaZ76Ab5Ck5KMA+GDJwU9ShRqvXmm0NBCXvDgh6+XRc4uIyFQFoy5OVvlLxQV jJLQKhFmzE85T8PEl63pjRGs2kne4mckYHXzV6mmEbGu6en5qaIrrw8KBf7X+fkzF3CZ SRGaOyHrgsQldZAv0RG0kvypHmqIeQZhKtEkcfzi4BwhYsggnBBR8liAPb0rH1dY5OW2 ezzRYnzbIBP4vzsyS4breDHCMFW5fz8WRzYyADulVO5gaaNlDmV7CUqJSAUGCRyQOHqm MVzNje59RLfjx3klJiBW0thHYMp/BW31lKxSrcdLQSvIFie4qVrEU60bcfm7uQMVJIgI SqVw==
- In-reply-to: <16681.1545391852@jinx.noi.kre.to>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <d7b0451f90bdfe61f48cc1361690180e07158900.camel@ntlworld.com> <b8851c3a50bd8bceba1961f2f764e1a6869481ac.camel@ntlworld.com> <18f684a8-2fec-4ebe-a63e-cf6688ae519f@inlv.org> <CAH+w=7bthv3E3Lr3UC9FvroXFcS1W+fDRuS6CLPxy_eyX0szqw@mail.gmail.com> <16681.1545391852@jinx.noi.kre.to>
(For some reason gmail put your reply in spam, I only found it by accident.)
On Fri, Dec 21, 2018 at 3:31 AM Robert Elz <kre@xxxxxxxxxxxxx> wrote:
>
> | It seems to me that changing this for $=t in zsh native mode might
> | break a lot of things, so I'll leave it open for discussion as to
> | whether it's feasible to change it only for emulation mode. However,
> | it does differ from the most recent version of bash I have handy.
By this I meant zsh's current behavior differs from bash, so we ought
to at least consider changing it in emulation.
> From the version in the prompt string where you illustrated bash
> behaviour later, you seem to be testing against a very old bash
It's what's on CentOS 6.10.
> (though apparently bash 3 still exists in the wild).
MacOS 10.13 appears to have bash3, at least based on the prompt.
> | For the lazy or very busy reader:
> |
> | -h Locate and remember utilities invoked by functions as those
> | functions are defined (the utilities are normally located when the
> | function is executed).
>
> Yes, I know what it means.
Obviously you do, but I didn't until it was mentioned here, so I
assume the rest of the zsh-workers audience might not either.
> I cannot think of a use for it, nor have
> I ever seen any script that would ever use it, nor does anything I
> know of implement it
It doesn't even seem possible to implement sanely, unless perhaps by
freezing $PATH and putting the shell in a virtual chroot jail.
var=grep
$var "$@"
would seem to be enough to thwart it without some really elaborate
"compile time" analysis of what $var was going to yeild.
> | var='"z"'; case ${var} in (${var}) printf M;; (*) printf X;; esac
> |
> | This also prints M. If backslash-z should become a quoted z,
> | shouldn't the above case also become a quoted z?
>
> No. It all comes from the use of RE's to define how glob works
> (and the ancient implementation) - '\' quotes magic in an RE, other
> forms of shell quoting do not.
OK, that's understandable. Any situation in which given (just for
example) var='[a-z]' we interpret $var as a character class, we ought
to also when given var='\z' treat $var as a literal z.
As mentioned above about $=t for splitting, I'm not sure we can safely
apply this to $~var without changing some expected behavior, so it'll
require careful consideration.
> In native zsh mode if you want to change that to be more like csh,
> which did complain about invalid patterns, that's fine, but for emulating
> sh it really isn't.
None of the discussion of $var interpolation of '\z' in pattern
context has any relationship to the discussion about treatment of bad
patterns.
> | There isn't any --emulate bash, really, it's merly a synonym for
> | --emulate sh.
>
> In that case, I would suggest deleting it. It gives a false impression.
> bash has lots of stuff that sh does not have, how close some of that
> is to zsh native mode I have no idea.
>
> | And therefore no, it's not intended to be perfect.
>
> It depends what you're aiming for with --emulate ... if it is just so you
> can run native sh scripts, then most of this does not matter.
It's just so you can run native sh scripts. It's not intended to turn
zsh into a portability test platform. Really it's so that you can do
ln -s /bin/zsh bash
The --emulation option is just a way to talk zsh into behaving as if
$0 were changed. --emulate csh is even farther from accurate.
> | Checking for overflow here seems like a lot of computational expense for a
> | case that probably only happens in test suites. Since zsh implements arrays
> | as actual non-sparse C arrays, memory is going to explode long before
> | anything manages to assign that many positional parameters.
>
> Don't bet on it. An array with 2^32 unset elements, followed by one set
> (assuming it is implemented in a rational way) is just 8 * (2^32 + 1) bytes,
I don't recall exactly but it's probably more like double that (2^32
pointers to things representing unset elements, not 2^32 null
pointers).
Nevertheless, point taken.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author