Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ${path[@]} in sh mode [was: Segfault with zsh 5.2]
- X-seq: zsh-workers 37734
- From: Martijn Dekker <martijn@xxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: ${path[@]} in sh mode [was: Segfault with zsh 5.2]
- Date: Sat, 23 Jan 2016 01:08:10 +0000
- In-reply-to: <CAHYJk3Qi-N3J2Np6w1Jqm_J+4=ip+kpGwhpQhi74L3osmfnYgw@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <87h9jujttm.fsf@gmail.com> <20151207135532.1a285c15@pwslap01u.europe.root.pri> <878u56jpob.fsf@gmail.com> <20151207143621.3cbbe7bd@pwslap01u.europe.root.pri> <56A28D28.3090701@inlv.org> <56A294F9.5020509@inlv.org> <CAHYJk3Qi-N3J2Np6w1Jqm_J+4=ip+kpGwhpQhi74L3osmfnYgw@mail.gmail.com>
Mikael Magnusson schreef op 23-01-16 om 00:07:
> On Fri, Jan 22, 2016 at 9:45 PM, Martijn Dekker <martijn@xxxxxxxx> wrote:
>> Martijn Dekker schreef op 22-01-16 om 20:12:
>>> Peter Stephenson schreef op 07-12-15 om 14:36:
>>>> Change now pushed.
>>>
>>> Can the ${path[@]} array be disabled in sh mode? I just noticed that it
>>> auto-syncs with the system $PATH. Lowercase "path" is a perfectly normal
>>> variable name in other shells and is a common English word, so conflicts
>>> that result in corruption of $PATH are not unlikely when running scripts
>>> written using other shells.
>>
>> Never mind: it is disabled when zsh is launched as sh (but not when
>> launched as zsh and then executing 'emulate sh'). So I suppose it was
>> decided long before that disabling it post-launch is not feasible. Sorry
>> for the noise.
>
> If you're in a function context, you can say 'typeset -h path' to hide
> the specialness of $path and declare a new local of the same name. Eg,
> one that isn't connected to PATH.
It would be nice if that worked globally too, and even nicer if it were
automatically done by 'emulate sh' (or ksh for that matter) and undone
by 'emulate zsh'. But that might be non-trivial and the developers may
have other priorities.
- M.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author