Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16672
| Path | csiph.com!goblin3!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Lawrence Velázquez <vq@larryv.me> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: set -u not working as expected |
| Date | Sun, 2 Aug 2020 01:12:56 -0400 |
| Lines | 52 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.481.1596345182.2739.bug-bash@gnu.org> (permalink) |
| References | <000301d66834$588493c0$098dbb40$@kalvr.net> <F4821044-5F8D-4B6D-A266-BAC88AE3DC2C@larryv.me> <1867D8FC-85DD-4406-A239-3002913493AB@larryv.me> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 (Mac OS X Mail 12.4 \(3445.104.15\)) |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | usenet.stanford.edu 1596345183 3936 209.51.188.17 (2 Aug 2020 05:13:03 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | bug-bash@gnu.org |
| To | Kristof Burek <contact@kalvr.net> |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=larryv.me; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm1; bh=A mVTaL7vmaZ5WCd6+f+poSoxNyMamU6UWxJnN9+AuPg=; b=mbN/fVQEdJyrUsWas fO9nCXf67piM6rvQT5u/VRREDkO9zsheBBtYi9ZUgjcIeWh8oE/OkQFcpQdr4frp zbM4ksSIoZ5ANKA7sH+zNtYyU8cn36pdJh8TlzzfK3w1VztPM0qSwtOgn2lR7aBN u8QLL0BHhaYkj9EC4/rorAwzQAqiBdl8smRTxev7T0mh4Z5h4wagadnmSrFQlQch 4CzEAVkbPoLbw0Muljvsi59Ej5FHmpoHoxFD3xLt1ZjY8DGWGaBgF72/w1GaECz3 sp+pe6QiWx/yfyzk79etmME9xjH+oL+dd/gpbB/cFww7tN0s+wdAzIRqYug23bql aS+fA== |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=AmVTaL7vmaZ5WCd6+f+poSoxNyMamU6UWxJnN9+Au Pg=; b=tRRwiLV1GeFELSCmvilIgKtVtWQPbd/cd44KWAwDy9tyJQU6b2trjCMja e4YDUJ/2cb6X3kzktqcMw3wUkqf2gBIs4iZmAMU/6e6Rkt6CdTTqAaMMxZvs2cAk vLi/2HNJxMqmipOia+l4KiTUxgbSM2Wl02VkNgwQOGgSbV0yhyO1sY9awGZ2lXuS wvWKcNEeuZ9oYUcBzIZe3tf6FrvbXCCItJy1iVu296E0jAom4J7K2dFouBdM6Qzj O4RcxY/Ru6LTiQ8dmCtagM36DoHHnqIAjYNKq5CgdjPG+i8LV6VxB+qJ74z2qqC4 3Wyq5ibEYkRYIw4pQoCzZwv9XCR4w== |
| X-ME-Sender | <xms:WUsmX0bjcR0mQ2WXRoJWrjogTxuRX2hH3keocI8ajlgLWenuY6FIjQ> |
| X-ME-Proxy-Cause | gggruggvucftvghtrhhoucdtuddrgeduiedrjedugdelfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurheptggguffhjgffgffkfhfvofesthhqmh dthhdtjeenucfhrhhomhepnfgrfihrvghntggvpgggvghljoiiqhhuvgiiuceovhhqsehl rghrrhihvhdrmhgvqeenucggtffrrghtthgvrhhnpedukeejtdelhedvudfhveelgeetff etkeehvdehjeetleffvdegtdejvdeuueegieenucfkphepuddttddruddvrddujeekrddv feenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehvqh eslhgrrhhrhihvrdhmvg |
| X-ME-Proxy | <xmx:WUsmX_bELFylr1158RnUB5ZbCMnE-MJK3l2sjza7hZv3dRP6qKq50Q> <xmx:WUsmX-84LVbT7PplK6Rz-mlsqBE-kjQoBlG5evYkM1TCZHYq-FEBzw> <xmx:WUsmX-pjn1Wf-wwN15_HqYJHkQq_mmtzEBoKF5oStY9TAmwCZrrJiA> <xmx:WUsmX80wRWdlfbjS-vLCqyzqSO_lDFYNiylb_cJTlR664uFDPG560w> |
| In-Reply-To | <F4821044-5F8D-4B6D-A266-BAC88AE3DC2C@larryv.me> |
| X-Mailer | Apple Mail (2.3445.104.15) |
| Received-SPF | pass client-ip=64.147.123.25; envelope-from=vq@larryv.me; helo=wout2-smtp.messagingengine.com |
| X-detected-operating-system | by eggs.gnu.org: First seen = 2020/08/02 00:19:24 |
| X-ACL-Warn | Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] |
| X-Spam_score_int | -27 |
| X-Spam_score | -2.8 |
| X-Spam_bar | -- |
| X-Spam_report | (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no |
| X-Spam_action | no action |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.23 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <https://lists.gnu.org/archive/html/bug-bash> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <1867D8FC-85DD-4406-A239-3002913493AB@larryv.me> |
| X-Mailman-Original-References | <000301d66834$588493c0$098dbb40$@kalvr.net> <F4821044-5F8D-4B6D-A266-BAC88AE3DC2C@larryv.me> |
| Xref | csiph.com gnu.bash.bug:16672 |
Show key headers only | View raw
> On Aug 1, 2020, at 8:47 PM, Lawrence Velázquez <vq@larryv.me> wrote:
>
> Presumably none of these shells implements u+=(t) as u=("${u[@]}" t).
Granted, they do disagree on ${u[@]}.
% bash -c 'set -u; unset u; u=("${u[@]}" t); typeset -p u'
declare -a u=([0]="t")
% ksh -c 'set -u; unset u; u=("${u[@]}" t); typeset -p u'
typeset -a u=(t)
% zsh -c 'set -u; unset u; u=("${u[@]}" t); typeset -p u'
zsh:1: u[@]: parameter not set
> I haven't seen the code for arithmetic expansion, but I assume it
> treats v+=1 as morally equivalent to v=${v}+1 (à la C99). Thus there
> *is* an expansion, which fails under set -u. Regardless of the
> particulars, ksh and zsh again agree:
>
> % bash -c 'set -u; unset v; let v+=1; printf "<%s>\\n" "$v"'
> bash: v: unbound variable
> % ksh -c 'set -u; unset v; let v+=1; printf "<%s>\\n" "$v"'
> ksh: let: v: parameter not set
> ksh: v: parameter not set
> % zsh -c 'set -u; unset v; let v+=1; printf "<%s>\\n" "$v"'
> zsh:1: v: parameter not set
> zsh:1: v: parameter not set
On the other hand...
% bash -c 'set -u; typeset -i v; printf "<%s>\\n" "$v"'
bash: v: unbound variable
% ksh -c 'set -u; typeset -i v; printf "<%s>\\n" "$v"'
ksh: v: parameter not set
% zsh -c 'set -u; typeset -i v; printf "<%s>\\n" "$v"'
<0>
...and...
% bash -c 'set -u; typeset -i v; v+=1; printf "<%s>\\n" "$v"'
<1>
% ksh -c 'set -u; typeset -i v; v+=1; printf "<%s>\\n" "$v"'
<1>
% zsh -c 'set -u; typeset -i v; v+=1; printf "<%s>\\n" "$v"'
<1>
*shrug*
vq
Back to gnu.bash.bug | Previous | Next | Find similar
Re: set -u not working as expected Lawrence Velázquez <vq@larryv.me> - 2020-08-02 01:12 -0400
csiph-web