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

Re: Builtin strftime and TZ assignments



On Feb 21, 11:16pm, Peter Stephenson wrote:
} Subject: Re: Builtin strftime and TZ assignments
}
} On Sat, 21 Feb 2015 14:54:41 -0800
} Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} > Without it, starting from an unset TZ, doing
} > 
} > torch% TZ=UTC strftime ...
} > 
} > results in TZ remaining set to UTC after strftime completes.  With the
} > pm->level bump, TZ is back to unset again after strftime completes.
} 
} When you say "without", do you mean without setting pm->level at all?

Yes; I assumed incorrectly that passing PM_LOCAL in the flags would cause
createparam() to assign pm->level = locallevel, but obviously I should
have explicitly checked that.  (Why does it not?)

} That wouldn't work because a level is only assigned if you "typeset" or
} equivalent --- a normal assignment creates a global parameter.  But I'd
} expect it to work with locallevel instead of locallevel+1.

It probably does, then, and I was just confused.

} I don't understand the difference if createparam() isn't there.  It
} should always be called by any function that needs to create a parameter.

If you just call setsparam("TZ", ...), it will eventually go through
createparam() and the right thing happens with locallevel, but there's
no way to tell setsparam() [which is just a macro for assignsparam()] to
create the parameter already exported.

Also I now suspect my patch breaks strftime -s, I didn't test that.



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