From mboxrd@z Thu Jan 1 00:00:00 1970
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org
X-Spam-Level:
X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,
UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.4
Received: (qmail 20914 invoked from network); 12 Nov 2020 10:48:16 -0000
Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368)
by inbox.vuxu.org with ESMTPUTF8; 12 Nov 2020 10:48:16 -0000
ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1605178096;
b=u41htWoOugKevyFJgDvBm0ZWwT8pKi0G1x4ppb8ShUF/2f8q0ELdIfuKQUTEOCcawpCQwlM7mq
LPCGFZnVkGwTHCR4fuGW+9QBaqMRUkU/kn1ewZTE/ruytvdULHmm1GRWDaOJYd6CqV609pVrpA
n7kyv0dEpVcJLujbogsqTprFqdqvana7dEYQwiWVxgHeZoVO6MYVnuMS+XYaaozvbOgMOs4TBX
SmqTblHzgmeSnBfewZq27q2wF/jD7yhE51+MI0dWewwS2EEWfWbtPqqGLFhhZKPRSFQQ5WZtvj
TRvVnM/9c2J894IAftdph+zUTu/Ng1ysBs8nPkLOMPIGjw==;
ARC-Authentication-Results: i=1; zsh.org;
iprev=pass (smtpq2.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.97;
dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256;
dmarc=pass header.from=ntlworld.com;
arc=none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1605178096;
bh=3ETnUUHTcFjk8tkAcLpmVnD+CrQIYP1PIkcKHKRiUjM=;
h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help:
List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:
References:In-Reply-To:Message-ID:To:From:Date:DKIM-Signature:
DKIM-Signature;
b=EBbc2RCNPyrSHju+KUwhAfHhm2HThvAw9Qlwgjoei/ppu6hXVuMV6Aa/7x91fbdGioTo5Y85Hf
y+8MiDdvKirZ5tFVa1NcwkvA6V2kw6yAKCQojcL6B7X4ktSQs+KJUqJZCME3BwWgGO8VakAj8d
p3KKE1m3wZEPbu7//3CrbMh4QfNp7BtypsFUliTnkH88flCjPLO7tLRIo8BvyK6BMrDASVG/U9
Y2fSoLnGD2f/0w3SHZFQFRGxEwHdN28Bwjx/AgcCl3VKzsVI5XowGPzMOQHAyt4vEAjAi2Cu4X
t78vtgRZZOekWNxaVhyrFMekQ/NOkK/0eSWAdqn6WoyrTA==;
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org;
s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:
List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding:
Content-Type:MIME-Version:Subject:References:In-Reply-To:Message-ID:To:From:
Date:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:
Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
bh=MBkmx/mJDoclM6ZQO4z519gZ4z7UrPTm7cQ1ezI8R7k=; b=HQPD59Nu/of/k96J8Su/FgWtfR
QkkKDXdv3h9qDf6GTHTuW87UQaUVIc9oxRzjgW6hTH7GplpzBRa1dzfhJ8BfxKdaeZb3reCkQxWtY
R9PCbaetQqEoLa6Xp/khRIsFBukIjrMeCRnQat+1sDI5Td81k8dCrMZUU6ODIp9lPpAkMFaevafjL
Qwo1FTbLvG6TXqnuIPz/dsJKRdPd+zsDDCmrx+7up/FWSv6BQZujvCoWkW54yqmUNoOQf3q59jYbI
EtfV/DT5Aywz3cgCSivRfrnsglov2zVm07fY+ivvBLIgeSaYYOi7g7sxWOiorjlMc/ne7TOaJ2HyF
DEq1Q4CA==;
Received: from authenticated user by zero.zsh.org with local
id 1kdA9D-0009Zw-D0; Thu, 12 Nov 2020 10:48:11 +0000
Authentication-Results: zsh.org;
iprev=pass (smtpq2.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.97;
dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256;
dmarc=pass header.from=ntlworld.com;
arc=none
Received: from smtpq2.tb.ukmail.iss.as9143.net ([212.54.57.97]:47090)
by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128)
id 1kdA8y-0009R3-MN; Thu, 12 Nov 2020 10:47:57 +0000
Received: from [212.54.57.82] (helo=smtp3.tb.ukmail.iss.as9143.net)
by smtpq2.tb.ukmail.iss.as9143.net with esmtp (Exim 4.86_2)
(envelope-from
)
id 1kdA8y-0000ZQ-Du
for zsh-workers@zsh.org; Thu, 12 Nov 2020 11:47:56 +0100
Received: from oxbe20.tb.ukmail.iss.as9143.net ([172.25.160.151])
by smtp3.tb.ukmail.iss.as9143.net with ESMTP
id dA8ykSAJl0LrqdA8ykYuOM; Thu, 12 Nov 2020 11:47:56 +0100
X-Env-Mailfrom: p.w.stephenson@ntlworld.com
X-Env-Rcptto: zsh-workers@zsh.org
X-SourceIP: 172.25.160.151
X-CNFS-Analysis: v=2.4 cv=fudi2H0f c=1 sm=1 tr=0 ts=5fad12dc
a=Ip+kZtMD4PYul4iMASbA3A==:117 a=brd1hNE3X6AA:10 a=IkcTkHD0fZMA:10
a=eCkG9cKAQX0A:10 a=BdiwUUftpNS2wdMgVGMA:9 a=QEXdDO2ut3YA:10
X-Authenticated-Sender: p.w.stephenson@ntlworld.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ntlworld.com;
s=meg.feb2017; t=1605178076;
bh=3ETnUUHTcFjk8tkAcLpmVnD+CrQIYP1PIkcKHKRiUjM=;
h=Date:From:To:In-Reply-To:References:Subject;
b=2CFeT9wkNo/ZOutpddjZosBDTJGpm3+QFVa3SjjNPE0ngfUQuPjm3Y/Q1hiJLejjq
Zhodxz8VZ9Qi9e8mE5S9CB5u0JjDsaFKiO/IusIWg/7eh85XX1k9N+4v/tD+nK0Vm3
dXfHxlEIgjfFA2Y/N2UhcrvgkQGGD9sF/Xrg4jhN268FQoPBfrfq3DosjQzNq1K9M0
TdWKdtxe8nIm4v9UIIDy82sxPeVQd+j3gKIkBZUTWCQJsa9zCCs2HYvOxXQc/lspwI
tZyNeia2Fol8r4oGPa++OVcAmRF/F3C7Jv1MJLgIIRIldpHUch422Kiduc+VRcEuFW
3V161wORWjNwA==
Date: Thu, 12 Nov 2020 10:47:56 +0000 (GMT)
From: Peter Stephenson
To: Zsh hackers list
Message-ID: <887944058.1348251.1605178076357@mail2.virginmedia.com>
In-Reply-To:
References:
Subject: Re: Bug with unset variables
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Priority: 3
Importance: Medium
X-Mailer: Open-Xchange Mailer v7.8.4-Rev72
X-Originating-IP: 165.225.81.103
X-Originating-Client: open-xchange-appsuite
X-CMAE-Envelope: MS4xfNvx9fj1IhIWpsnL7358QPlWgcRv+YBGY09xdx23wPolRYvlWWhbxlaFeNXOy0BQoREtmYsjkvpGuLsGwxE4NiD4cnA8lG0Cjl3YQud1WIbrauIQkg8r
pUsoyY1nMFN7QtqPEnPNQ7hMTUnQ5eTtXkhBFhtSOTb1dFBtpH/5ExAnxqSPUZGQ5S3jdr54n49ie9EzEZ/lqRHpHu6mTFKQ/Cpoa4rn2X55orio3B613Knw
X-Seq: 47545
Archived-At:
X-Loop: zsh-workers@zsh.org
Errors-To: zsh-workers-owner@zsh.org
Precedence: list
Precedence: bulk
Sender: zsh-workers-request@zsh.org
X-no-archive: yes
List-Id:
List-Help:
List-Subscribe:
List-Unsubscribe:
List-Post:
List-Owner:
List-Archive:
Archived-At:
With some trepidation, let me see if I can try and sum up.
fn() {
typeset foo
# foo is regarded as set (in the sense "not unset") here.
}
Other shells would treat foo as unset at that point.
This is a long standing feature of zsh, so the default behaviour
is not going to change. Almost certainly there was no direct
thought at the time zsh was implemented about the details
of this case, so it was probably not a formal syntactical
decision.
It is a bug when emulating other shells (although note that there
are plenty of such bugs --- emulation is never complete). I
said I thought we'd done something about this, but I don't see any
evidence, so I was probably wrong. There is definitely scope for
improvement.
Given that all shells would treat $foo as an empty string in
the context above, the practical impact is limited to a few
edge cases --- granted that can be infuriating (and more)
when you hit one, so I am not dismissing such cases. That's why
this issue doesn't often come up despite its long-standing
nature.
For the same reason, that $foo will reliably substitute as
an empty string, I don't see any *overriding* reason for
the behaviour of other shells. That absolutely doesn't
mean I see no arguments for that behaviour, all of
which I think have now been rehearsed.
Hope that's useful.
pws