TZLOAD_FROMENV flag used incorrectly
tzset_unlocked() calls zoneinit() with TZLOAD_STRINGS | TZLOAD_FROMENV regardless of whether name actually came from the environment. If name is null, zoneinit() will use TZDEFAULT instead, but will incorrectly consider that to be tainted, and unnecessarily perform an access check before trying to open it. That is luckily harmless in unmodified tzcode, but I would still prefer if TZLOAD_FROMENV were only set when actually true; see attached patch. DES -- Dag-Erling Smørgrav - des@des.no
Thanks for the bug report. I installed the attached, which should have the same effect as what you suggested albeit with slightly simpler machine code.
Paul Eggert via tz <tz@iana.org> writes:
Thanks for the bug report. I installed the attached, which should have the same effect as what you suggested albeit with slightly simpler machine code.
Thank you. By the way, do you have any plans to do anything about the inconsistent indentation and widespread use of the register keyword? DES -- Dag-Erling Smørgrav - des@des.no
On 2025-08-31 03:06, Dag-Erling Smørgrav wrote:
do you have any plans to do anything about the inconsistent indentation and widespread use of the register keyword?
For style reasons Arthur David Olson prefers "register" as it prevents taking the address of a local variable, so I keep "register" in code that already has it. To me the style doesn't seem worth the maintenance hassle, so I don't use it in newer code. Although C++17 removed "register", TZDB code does not conform to C++17 in many other ways, and there seems little need for the maintenance hassle to make it conform as everybody that has a C++ compiler also has access to a C compiler. For indentation, I use a similar rule: leave old code alone, and in new code use an arguably better style that allows more levels of indentation. "Arguably" as some argue that extra levels are bad. Not sure it's worth the maintenance hassle of reindenting the old code.
participants (2)
-
Dag-Erling Smørgrav -
Paul Eggert