From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13176 invoked by alias); 27 Nov 2017 21:34:14 -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: 42055 Received: (qmail 24124 invoked by uid 1010); 27 Nov 2017 21:34:14 -0000 X-Qmail-Scanner-Diagnostics: from mail-qk0-f179.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.220.179):SA:0(-1.9/5.0):. Processed in 4.707551 secs); 27 Nov 2017 21:34:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 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:in-reply-to:references:from:date:message-id:subject:to; bh=IJYWCpenK07qfE9ML8LcM9jTZ9vUXo3meCTn26ktkIo=; b=mtZVv9ei8YfUxbGii0lcx8JygBdm5Cp53Atgu1+aO5oZAcPftspZDwFP1/abqSFj/f zhYki7o4VderqoPOjqDcduMseveBu37cN4auMO2SgOaj+NT/KmgqTK2yUJafFfqwGzDF 3gaQNQiyydoAgk2WuwchSvJpOntZVjfWmhoGItR3wD0EX59rdJAL25E/WylLTBF+3i3m nGK2RAFjNP7Rcpz5ottzLdOXxogSxfXp23mMYF4x2oW8DT+mN3xkdJXQDMnniU0C3yoT TEqJkrQ74iwLH0FdqEDqWBOX/oEDr5Nv9dhGEXPiR3kH+WIHgWBToOdvxENIdET1W0Lv m3wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=IJYWCpenK07qfE9ML8LcM9jTZ9vUXo3meCTn26ktkIo=; b=eoE88bCAVFF+aSIyRjq7qIxrOAW3zPe1NTFwkeU6Ll8qHYnWJkXanSImiI41qs8Rxk HhiKxHDrpCV+uwaBEwb47cQvfY0zU/wjSaLA5xADGlTKv9iwbwGmyvRQHbxTSZq5EAPG tDlaR050MSy5d09J/1o6SJuAPcP2L5sn/ZuYe94b96J3fhgcYwLRe9HuQE9TfE2xtg31 muJtn+FzamjpplrBM8JAKNAIcVyfE/SmekqwJqwmYb/KEfG5qUN6NL69Vip+7JFL7wvI k0K8NxAWFH/m00xrTOPZFZuXkZc8hqU/2yhWV77iVsT4ngj7nYHBh8ItjPdXVMOl4pKT oJhQ== X-Gm-Message-State: AJaThX6YMOMDK8bBoc/N21yuH5wu7qMmHo4jusNIgKb+ms9EUc2Kn2em 2PtNfLJyUpIRo6qQgsVnaEP1YuMEHbcenwAk/Al8vQ== X-Google-Smtp-Source: AGs4zMYBAkRX5gyDfVGXM4AppPf9TbCG3hzaRbBYPALCAXf9DluTC9hTn0ZGElZV16GZrmhbUdbs+EYRfs+w9b1mAVc= X-Received: by 10.55.151.71 with SMTP id z68mr18071822qkd.83.1511818446232; Mon, 27 Nov 2017 13:34:06 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <20171126232101.GA8393@chaz.gmail.com> <7a5807b1-0c5e-8134-a651-83e8b3df4d82@gmx.com> <20171127201721.GA1897@chaz.gmail.com> From: Bart Schaefer Date: Mon, 27 Nov 2017 13:34:05 -0800 Message-ID: Subject: Re: f() { local -ar path=(/bin); };f gives an error To: "zsh-workers@zsh.org" Content-Type: text/plain; charset="UTF-8" > On 11/27/2017 03:17 PM, Stephane Chazelas wrote: >> >> The issue here is that when you're trying to make $path (the >> special array variable tied to $PATH) readonly (with a value) >> locally in a function, that doesn't work. Something a little weird happens with order-of-operations for tied parameters: f() { local -ar path; PATH=foo; echo $path } Note there's no error there, $path is changed by the assignment to $PATH even though the array is read-only. The reverse also works; you have to make both parameters read-only to prevent changing either one by assignment to the other. f() { path=(/bin); local -r path PATH; ... } # achieves the desired effect