Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [bug] Special parameters $PATH and $path aren't kept in sync after emulating sh



> On 09 November 2020 at 07:27 Brice Waegeneire <brice@xxxxxxxxxxx> wrote:
> Yesterday I stumbled upon a bug where setting $PATH when emulating
> sh would would break the variable synchronization between the string
> ($PATH) and the array ($path):

sh mode doesn't have the special variable path; you need to rely exclusively
on PATH within sh emulation.  The basic idea of sh emulation is to track
POSIX as closely as possible to make sure all the basics work --- it's
not designed as an all-singing-all-dancing smart shell in the same
way normal zsh mode is.  In this case, that means we try to make sure variables
people might use unsuspectingly in sh don't get overloaded with special
behaviour.  (Having said that, zsh is written in such a way there are various
places where we can't make sh emulation work properly, but that's going rather
beyond your issue.)

Hooking up normal zsh behaviour and sh behaviour together can be a bit
of a nuisance exactly because, by design, they work differently.  So if
you've got a workaround, I'm afraid that may be as good as it gets.

pws




Messages sorted by: Reverse Date, Date, Thread, Author