From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5423 invoked by alias); 27 Nov 2017 20:17:30 -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: 42053 Received: (qmail 2823 invoked by uid 1010); 27 Nov 2017 20:17:30 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm0-f47.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(74.125.82.47):SA:0(-1.9/5.0):. Processed in 2.194152 secs); 27 Nov 2017 20:17:30 -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,FREEMAIL_FROM, 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: 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:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=zg7O2lgg27yrjkTf/VS0WlTitqavWiDARU2hpba1VZs=; b=gMFiKuLKbjG9ItakPJdXkyVfGHyZl8ppMfJLMJwmfmbTjVlOA7+ejrSvKdESdBWu8H q21/dE+UD888cCows5plhdwnCY17cOuhywl/ljvC5L98sTHNC/Xzte2zMVlDHWIBCw4K /0qngS5lpQCgtN8cnSFLurZBDXn6pETZQalQdNbm3u7JQRjRxAvfV+4xzKNCOgAaCwWw kZW4EpHl8FEgVbphhobhsueCeMJCnSE+ocoWMJDDgfyVfAusY+fkS/8V8xFwOPLCCweX 1VO4dz939NcqW9XhX3iOwgSU6joo/3H7yIJ4MWZpAsWCZrC6dqNWBKTM5hbN9LjrPikY LJHA== 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:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=zg7O2lgg27yrjkTf/VS0WlTitqavWiDARU2hpba1VZs=; b=AJ9OlidkS/MEfD5kRD502WyIK2AwJbstCnb7bE4aNEhhWZqgvl78d1o6BPsiWfsQnT VXHbsFGjfXKCAj70YeVvty0+d4J/DY4PiyTSv5YU/qZ1RDXDkJ2cb8bD9Cd9Tn4deSNH rQp7C7Wcm2HWhLevu2ppMqwItELyyFdCGOvsxRDh00QiRozYY1e3eVSo6Vkd4JnJSTkN Dk8yNZyJ7H1co/t8MrIhlv47ljwL7ZucKDek0GN4hTm70JZmwWaH6spVtF4jImNjWJWg KmNfPk+CPEgvqfytF5dXc6bsMoBFmQYUhx0XZYtTQ/9xEk2TUrE5Q37HxhboWrbw+1UW hilQ== X-Gm-Message-State: AJaThX5b/edNSAvqzdYtdklFdG0hbQbSMcU6FW0sg5y2fCuB5XnNF3bY wv8JLq9g2iW5GvyJWm42oB8= X-Google-Smtp-Source: AGs4zMbj6YLhLEpKcUYtBmNakRlkWX0AsJjerpeO5qIeo90s5bQ4YzfXJ8ilXa6+5/Qt9DXdI/XRyA== X-Received: by 10.28.55.71 with SMTP id e68mr18638765wma.139.1511813844377; Mon, 27 Nov 2017 12:17:24 -0800 (PST) Date: Mon, 27 Nov 2017 20:17:21 +0000 From: Stephane Chazelas To: Eric Cook Cc: zsh-workers@zsh.org Subject: Re: f() { local -ar path=(/bin); };f gives an error Message-ID: <20171127201721.GA1897@chaz.gmail.com> Mail-Followup-To: Eric Cook , zsh-workers@zsh.org References: <20171126232101.GA8393@chaz.gmail.com> <7a5807b1-0c5e-8134-a651-83e8b3df4d82@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7a5807b1-0c5e-8134-a651-83e8b3df4d82@gmx.com> User-Agent: Mutt/1.5.24 (2015-08-30) 2017-11-26 18:28:17 -0500, Eric Cook: > On 11/26/2017 06:21 PM, Stephane Chazelas wrote: > > FYI, > > > > someone reported this on unix.stackexchange.com: > > https://unix.stackexchange.com/questions/407125/why-cant-i-define-a-readonly-variable-named-path-in-zsh > > > > Which looks like a bug: > > > > $ zsh -c 'f() { local -ar path=(/bin); }; f' > > f: read-only variable: path > > $ /zsh --version > > zsh 5.4.2-dev-0 (x86_64-unknown-linux-gnu) > > > > See also the answer there by someone would did some investigation already. > > > () { local -har path=(/foo); typeset -p path } > typeset -ar path=( /foo ) > > -h Hide: only useful for special parameters (those marked > `' in the table in zshparam(1)), and for local parameā€ > ters with the same name as a special parameter... Thanks. But that creates a non-special local "path" variable. 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. it also doesn't work with the scalar variant: () { local -r PATH=/foo; } same goes with the $cdpath/$CDPATH variable. -- Stephane