From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-workers-return-43658-ml=inbox.vuxu.org@zsh.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,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 7a57876b for ; Tue, 9 Oct 2018 11:00:08 +0000 (UTC) Received: (qmail 27433 invoked by alias); 9 Oct 2018 10:59:55 -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: 43658 Received: (qmail 12232 invoked by uid 1010); 9 Oct 2018 10:59:55 -0000 X-Qmail-Scanner-Diagnostics: from mail-wr1-f44.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.221.44):SA:0(-1.9/5.0):. Processed in 2.132275 secs); 09 Oct 2018 10:59:55 -0000 X-Envelope-From: stephane.chazelas@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ei4NhnVGnx9fYdK3VfYXyz8YrR9VLHdg/soLFM6WDww=; b=bUyCGJrCwAY+SxYaoPRPtGyeN/77yh/JAu3grj7hDdNdhNjYoxz/63LGEQkoP2mLPo q5O9Vmufil74OvXX4wcopuQ4Wus5UwNeAsq/6VcfRdVdT9QPNwtep+/gEJ809B4F8/La Ac4DRBAs1QA/Ga1bgQc4qqM71JUWk73xt1/DMYqMPQozyZloxJ/x/lL+sg9Opm0pO9JO LxmKu/BqtmyL5OISn05LLT4pu31t5QTRuk8sXbyidsD0QAWLaEbMgCVazY9V0WOMcX12 Klz4zicG4UDHnNvTn1F2FBeHiE2ECJ0s3FE7esJ2IEwufvrXD+6716C5YreO1X2qOyYu Zm4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=ei4NhnVGnx9fYdK3VfYXyz8YrR9VLHdg/soLFM6WDww=; b=SnP5+x8sSZTcnCKea5ncRoVuInk3Xtosxq7ozM1RzkmQ94uBfaCNuaF3ziZtmcz/1E rd73exc0Tymw3Q+ctWQkMlPcrCdGqri5iA1rtTt/Y0I3mzhdlGcEkx3VLRaBzzexDp/9 dz2eqPujoUt3yF2+QmA++W1kOnI0XS2PXagUPgGaoU6dIZEBmaVC8O5Lz/ePhmIvE0xQ JWefc2Pf52+WC6+Xc5m0MUIFLQMpu6zsT+aMZocYLnmOZ82j2HWTk+00I+EhYkBgiJuU 1+U2HTxVuWA71CVNFRvlzH7ey4mmZUwHKH0kCK7wt8W/IEDSz2bCufKagaIxQcVvup74 BjAA== X-Gm-Message-State: ABuFfoh0BebbzZaLgdFOTn8nk8xCi1hDn89vY4VtubmU6AkUFFNqzURS 24KcyuKWBBStXUE+rDiFrUYNGmq3pfs= X-Google-Smtp-Source: ACcGV62Pi5vFCIqYy8MPTQuZWrARg6BjGAiJomOCZ8MMlPXOCjVIi69vtszi30oS9L9imMMIPKzqOw== X-Received: by 2002:a5d:488a:: with SMTP id g10-v6mr19842795wrq.0.1539082789488; Tue, 09 Oct 2018 03:59:49 -0700 (PDT) Date: Tue, 9 Oct 2018 11:59:47 +0100 From: Stephane Chazelas To: Zsh hackers list Subject: local read-only variables (Was:[PATCH] [long] typeset doesn't report tied parameters (and related issues)) Message-ID: <20181009105947.6dogclbi477aasob@chaz.gmail.com> Mail-Followup-To: Zsh hackers list References: <20180924210550.carijwjibarjivu4@chaz.gmail.com> <20181007133545.zzkrbc3ed6shnk3e@chaz.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181007133545.zzkrbc3ed6shnk3e@chaz.gmail.com> User-Agent: NeoMutt/20171215 2018-10-07 14:35:46 +0100, Stephane Chazelas: [...] > -variable. Note that in zsh (unlike other shells) it is still possible ^^^^^^^^^^^^^^^^^^^ > -to create a local variable of the same name as this is considered a > -different variable (though this variable, too, can be marked readonly). > -) > +variable. > + > +It is still possible to change other attributes of the variable though, > +some of which like tt(-U) or tt(-Z) would affect the value. More generally, > +the readonly attribute should not be relied on as a security mechanism. > + > +Note that in zsh (like in pdksh but unlike most other shells) it is ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > +still possible to create a local variable of the same name as this is > +considered a different variable (though this variable, too, can be marked > +readonly). Special variables that have been made readonly retain their value > +and readonly attribute when made local.) [...] Actually also yash, we might as well remove that "(unlike other shells)". Note that pdksh has quite a few derivatives (mksh, posh, openbsd sh (I've not checked there)). Those shells don't make a distinction for special variables. Actually I'm not convinced it's useful to treat them specially in that regard. For instance, if you do "readonly IFS", you can no longer use library of functions that do some "local IFS=:" If I add "readonly IFS" to .zshenv, compaudit/compinit report errors and the shell exits with my current ~/.zshrc. See also related POSIX discussion at http://austingroupbugs.net/view.php?id=767 http://austingroupbugs.net/view.php?id=767#c3735 -- Stephane