GNU bug report logs -
#23600
25.1.50; encode-time returns wrong result
Previous Next
Reported by: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
Date: Sun, 22 May 2016 22:12:01 UTC
Severity: normal
Found in version 25.1.50
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
Message #29 received at 23600 <at> debbugs.gnu.org (full text, mbox):
> Cc: kzhr <at> d1.dion.ne.jp, 23600 <at> debbugs.gnu.org
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> Date: Sat, 4 Jun 2016 10:15:04 -0700
>
> > Do callers of putenv expect the argument to be destroyed?
>
> Yes and no. POSIX says that the environment can be modified in-place, so a
> caller of putenv (S) should be prepared for *S to be modified (which is what I
> assume you mean by "destroyed") because the string will be put into the
> environment. Also, POSIX allows putenv to modify *S, as S is of type char * and
> there is no prohibition in the standard against putenv modifying the pointed-to
> storage. That being said, I don't know of any POSIXish implementation of putenv
> (S) that modifies *S and I doubt whether any mainstream implementation would do
> that.
Right, that's what I thought.
> Although the code you mention is stretching things a bit, it's not stretching
> them beyond recognition: the intent of putenv ("TZ=<JST>-9") is not really "set
> the 'TZ' value to the byte-string '<JST>-9' in the environment array", it's more
> "set the time zone to 9 hours ahead of UTC and with abbreviation 'JST'", and on
> MS-Windows the code implements this intent more faithfully than doing nothing would.
I think it would be cleaner if we copied the string before modifying
it. I will do that when I have time.
Thanks.
This bug report was last modified 9 years and 35 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.