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

Re: print builtin preceded by parameter assignment



On Wed, Apr 24, 2019 at 5:33 AM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>
> There are several bugs (perhaps all related):
>
> 1. The fact that TZ remains exported with a value different
>    from $TZ.

This is not related (and is not actually the case).  TZ does not
remain exported.  What remains is that the settz() call has changed
the current timezone of the zsh process to be something that differs
from the value of the TZ environment variable.

>> 2. The fact that TZ and other variables (at least LC_ALL and CDPATH)
>    are handled differently with a variable assignment before a
>    builtin, when not exported.

This is also not really related.  CDPATH is not an environment string
in the first place, it's an internal variable used only by zsh; the
fact that it can be exported is irrelevant to the behavior.  The
difference with LC_ALL is that it is recognized as semantically
meaningful to the shell, so it has special code to invoke setlocale()
whenever it changes.  TZ is not specially handled in the same way.

> 3. The fact that for TZ, the "export" status has an effect on
>    the value taken into account in a builtin.

Underneath this comes down to a system library issue:  The library
behaves differently depending on whether settz() [or setlocale()] has
been called, and if it has not been, then it behaves differently
depending on whether the values are truly in the process environ
array.  Its questionable whether zsh can (or should) track and
special-case every environment variable that has such side-effects.



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