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=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2461 invoked from network); 1 Sep 2021 11:50:52 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 1 Sep 2021 11:50:52 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1630497052; b=UYK4K19YzzHEKxUvO5dxF52rh5XLXL+hpdzRQHAPjJWmLkz2NOlCsLWuMywJOQsx3ycuIFYLc7 +UOUV5GPrYIJuyi0/xn0UycEq3urzUF8wek4aSOafW12liFP5/i0bgKINJr4lIzlatneGTjMS9 C+GUiSgYvoOvsm54TASD2LnKMylHNrVxUg4aeLEf81QlgoveFXbzZU7786PpE64BI5CMp44H2g Tn/CYrj8x6akhueVfnmKkV3+8meeEAWKN5LspxdnDDcbP8cA/McsHjsxgdZbIq/mZEvsr7wdCN nbCSCJdCIL5TV5AaV5qr0aWCkJ9m7FJi+PNOMDyIYKDdvg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-vs1-f51.google.com) smtp.remote-ip=209.85.217.51; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1630497052; bh=W7bh5WXWakeBOtgXBz2Kdw/yNhtNsHTn76XuNWm4XpE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=LyjbIbfbkPlMRxHYACzjr3Q20o5eNb7szX+B21RGtqPEx33T6o7T498eP3Lev1+sVvBByXgg/h 6QNURQWZINZhVgCLBmGdj7ATIzV7r/YFWpXBlvRTGexcBEvIrerxW3hKOF7zIE+DqE8LO6apv9 x1xOGci7NeclAVLXDvUQMAMHLs19xvnTiWu19PbAANh9Uy6klbh4VbfZjP+R+xTZ2nHw2XaUzi 1it53tiV6Sxz8xfsTXuacqCEZCaiFQiQVimkYnzYo+Idcn8gEpnWV/CzYng5r+kM9lmfmPzq+n AqahcG4qqWS9hPyHDj6/jyIuCMTkPkOcTysufYUrNnVCHg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=W7bh5WXWakeBOtgXBz2Kdw/yNhtNsHTn76XuNWm4XpE=; b=ERKBC6IflasKHzlq81cqOuZudE iAP2oi30inMV8h2Mv0Q5BHw0tmdOaBbuV9cwe9tnuY9h7oXzQ92ViqPPoDgfbcfS8ibMemwztNfxc 9Xd1jVPE9+0APU2k+r90GNWqWdRiCNfNdnZk2ytfyqUdgkkXwS1NSMZJMHcmj50eK5pNN0B7dYsjc lAagAhTx86ylDoWzymySW3J9KVdkAM/6la+/Ku+onPM6QMK9GiKP8SUZZ9QJuLEdZcRa+lTkM9Ytm Gu6sd4HoNvQCF1JDVC6HWhnD4SXKULO6TOg3X7AmHGUz86c8i2Qx//PqUYTpV79fBRTbYMQ23++s+ /mSp260w==; Received: from authenticated user by zero.zsh.org with local id 1mLOlX-000Apt-LQ; Wed, 01 Sep 2021 11:50:51 +0000 Authentication-Results: zsh.org; iprev=pass (mail-vs1-f51.google.com) smtp.remote-ip=209.85.217.51; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-vs1-f51.google.com ([209.85.217.51]:40562) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mLOlG-000AYi-NL; Wed, 01 Sep 2021 11:50:35 +0000 Received: by mail-vs1-f51.google.com with SMTP id d6so2158120vsr.7 for ; Wed, 01 Sep 2021 04:50:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=W7bh5WXWakeBOtgXBz2Kdw/yNhtNsHTn76XuNWm4XpE=; b=ktAIDrl6ry40EKMFIlUWV5FVg92piNLbl3qkqeuvqjSVhvs2jwwo+1o75pEWzJpYy/ jUuQqczpS6AhBb5tGxVmuryb32Q391qDjnTyvSs/2JG1dIgLsWdD7U2VKGH9UTuJSD0i 3G+cSNV+/wz5pzvxybd3g75zop3O2MP1TyivdJaj+Y5bIO6r5DPNPTI6eb6Iy+etzI6p u9PVC0sqTXzNCxzKiB83KUO2wTPnMf0u9U+MXsG1rJhow0mRkNmn6l8lHcsg9ow3uLjl gb3PvLwBpGg918LBIe+ZWW6Aqq6I+HGeoYI4OVKHoq0OQJWDm0PDffSFitLYeZwVxSHt J+xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=W7bh5WXWakeBOtgXBz2Kdw/yNhtNsHTn76XuNWm4XpE=; b=SS61PAOB3OsIB3Z7Ktp3gY6hCunBmvB+ENhSzhkqUsBtTN3mOIm2MmFR4/xMX0X8s0 PzRD20wUPqyHlMDjBfn3/NjVHKyPLTBMFWr7O7QjF4A7iKzijWCKOH3lAK5azzo3WqaK fgoGcr1vRLqMqgmnqmpVjEhNofXCmJge18yZ5niV7Aletg813FDGZyFGI5oZElfefsli VcINZejgAoy/LmjdWElWUM0wfZwAQqZYprr+mNkeE6XTwnyiVn3Ez0oXFIAk0X/2Y1Vd z4gDiMr9+MKpSdtL9fmBk6dp8gSNLJQUSzkZbPsIwMq5Ex4naxmr8ZEWrKqBBjQ+WgDk vBZw== X-Gm-Message-State: AOAM530qVgZrsCk3bDZhC8+lAmNsK7GLmP48jmPehLotwkJzuOYZQ4Gh dVefbXbH/wtPll5Pm5VyUmGQqlZP2bbZW95Tt5GY1BzA+BHqFQPI X-Google-Smtp-Source: ABdhPJwr3uVfVrzstk5Yc2iHGnnMRWRNJo1EFgWLTVIkoK6jxUXaKbR/nu/07E37wDrp37rcecGaKyYxYil+gPdrC24= X-Received: by 2002:a67:fd95:: with SMTP id k21mr22772085vsq.34.1630497033652; Wed, 01 Sep 2021 04:50:33 -0700 (PDT) MIME-Version: 1.0 From: Marlon Richert Date: Wed, 1 Sep 2021 14:49:58 +0300 Message-ID: Subject: [BUG] zsh/param/private scoping error To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 49346 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: The following two functions are normally equivalent: () { typeset -g tst } () { tst= } Both result in a global variable 'tst' being created. However when the second function is called from a function that happens to declare a private variable with the same name, it no longer creates a global variable but instead aborts with an error: % () { private tst; () { tst= } } (anon):1: tst: attempt to assign private in nested scope % This is not how one would expect private variables to behave. Inside the inner function, the private variable should be completely out of scope and the `tst=` statement should result in the creation of a global variable. Note that the error above does not happens when there already exists a global variable with the same name: % typeset -g tst % () { private tst; () { tst= } } %