unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: kzhr@d1.dion.ne.jp, 23600@debbugs.gnu.org
Subject: bug#23600: 25.1.50; encode-time returns wrong result
Date: Sat, 4 Jun 2016 10:15:04 -0700	[thread overview]
Message-ID: <57530C98.3030508@cs.ucla.edu> (raw)
In-Reply-To: <83h9d9uf3d.fsf@gnu.org>

Eli Zaretskii wrote:

> 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.

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.





  reply	other threads:[~2016-06-04 17:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-22 22:10 bug#23600: 25.1.50; encode-time returns wrong result Kazuhiro Ito
2016-06-01  8:19 ` Paul Eggert
2016-06-02  1:54   ` Kazuhiro Ito
2016-06-02  6:38     ` Paul Eggert
2016-06-05 11:08       ` Kazuhiro Ito
2016-06-12 10:45       ` Kazuhiro Ito
2016-06-13 21:54         ` Paul Eggert
2016-06-14 14:05           ` Kazuhiro Ito
2016-06-14 14:40             ` Paul Eggert
2016-06-04 15:51   ` Eli Zaretskii
2016-06-04 17:15     ` Paul Eggert [this message]
2016-06-04 17:37       ` Eli Zaretskii
2016-06-04 22:18         ` Paul Eggert
2016-06-05  2:47           ` Eli Zaretskii
2016-06-05 15:20             ` Eli Zaretskii
2016-06-06  1:48               ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57530C98.3030508@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=23600@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=kzhr@d1.dion.ne.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).