From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 2cac6202 for ; Fri, 21 Dec 2018 20:37:47 +0000 (UTC) Received: (qmail 24640 invoked by alias); 21 Dec 2018 20:37:29 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 43926 Received: (qmail 28392 invoked by uid 1010); 21 Dec 2018 20:37:29 -0000 X-Qmail-Scanner-Diagnostics: from mail-lj1-f181.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.100.2/25112. spamassassin: 3.4.2. Clear:RC:0(209.85.208.181):SA:0(-1.9/5.0):. Processed in 2.948873 secs); 21 Dec 2018 20:37:29 -0000 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bZAedSluTIJxte+EPmFV70LZADZb/kdZj0UA2tUiV3E=; b=tPaM6Kk+rfcmtgEMFL/yaOhMlsFiUvBYGkBP7CURtVdZrmdSfRorbl3VpHx1BkUYNY Myj8UhqB7yPuifti6uFYtveQl5JJsxRBIkOqjRITSQ4zdRI4wkYyKAsAvZf4gYtu0HWV FlD0eo0ohGW5QKBKvO323/pmecuJi6Hw28hy9cdMpf+eAfGXJ87pQ/tWPTEECntZgrAt ewIB+Y/yM/TQTkBotpKsmuETuA+g6qGCVl6w5iXr4SgB242QAtXX9ccZkyTStxYhlZbV St1mWrhjtWXuElhh9XFIHg6vhLWC5NFQanavRgnS3+sEHW6bHAu/F/xs3QhYT4PwGX+4 SqLw== X-Gm-Message-State: AJcUukeWuTd/JO760frnJyXJuAC5Eplsl5yyIz4OVWpZpbTOOF4RLIAp JBLPzvYDbbQp9wG5RTqX+FXWJzPB977ody0x7ARQig== X-Google-Smtp-Source: ALg8bN5Nl8LgS5dveUTZbIsqblZg2QfpqcuCILEqQn6ZoNb+U+ZSvUj8MlN+Syoyg4aFcyY7FKSVSyydVUgsfyPzDLg= X-Received: by 2002:a2e:92ca:: with SMTP id k10-v6mr2492968ljh.63.1545424642038; Fri, 21 Dec 2018 12:37:22 -0800 (PST) MIME-Version: 1.0 References: <18f684a8-2fec-4ebe-a63e-cf6688ae519f@inlv.org> <16681.1545391852@jinx.noi.kre.to> In-Reply-To: <16681.1545391852@jinx.noi.kre.to> From: Bart Schaefer Date: Fri, 21 Dec 2018 12:37:08 -0800 Message-ID: Subject: Re: The big kre zsh bug report To: Robert Elz Cc: Martijn Dekker , "zsh-workers@zsh.org" Content-Type: text/plain; charset="UTF-8" (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 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.