From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#23600: 25.1.50; encode-time returns wrong result Date: Sat, 04 Jun 2016 20:37:26 +0300 Message-ID: <838tykvort.fsf@gnu.org> References: <574E9AA6.1070606@cs.ucla.edu> <83h9d9uf3d.fsf@gnu.org> <57530C98.3030508@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1465061906 22040 80.91.229.3 (4 Jun 2016 17:38:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 4 Jun 2016 17:38:26 +0000 (UTC) Cc: kzhr@d1.dion.ne.jp, 23600@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 04 19:38:15 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b9FWY-0007Jg-2Z for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Jun 2016 19:38:14 +0200 Original-Received: from localhost ([::1]:33563 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9FWX-0004VO-5N for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Jun 2016 13:38:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9FWR-0004VG-LN for bug-gnu-emacs@gnu.org; Sat, 04 Jun 2016 13:38:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9FWM-0002hk-Ep for bug-gnu-emacs@gnu.org; Sat, 04 Jun 2016 13:38:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42275) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9FWM-0002hg-Bz for bug-gnu-emacs@gnu.org; Sat, 04 Jun 2016 13:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1b9FWM-0005Se-8C for bug-gnu-emacs@gnu.org; Sat, 04 Jun 2016 13:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Jun 2016 17:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23600 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 23600-submit@debbugs.gnu.org id=B23600.146506184420945 (code B ref 23600); Sat, 04 Jun 2016 17:38:02 +0000 Original-Received: (at 23600) by debbugs.gnu.org; 4 Jun 2016 17:37:24 +0000 Original-Received: from localhost ([127.0.0.1]:54612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b9FVk-0005Rl-KH for submit@debbugs.gnu.org; Sat, 04 Jun 2016 13:37:24 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55638) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b9FVj-0005RZ-Ew for 23600@debbugs.gnu.org; Sat, 04 Jun 2016 13:37:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9FVa-0002cH-Cp for 23600@debbugs.gnu.org; Sat, 04 Jun 2016 13:37:18 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41304) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9FVa-0002cB-9r; Sat, 04 Jun 2016 13:37:14 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2880 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1b9FVW-0006uJ-CV; Sat, 04 Jun 2016 13:37:12 -0400 In-reply-to: <57530C98.3030508@cs.ucla.edu> (message from Paul Eggert on Sat, 4 Jun 2016 10:15:04 -0700) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:119072 Archived-At: > Cc: kzhr@d1.dion.ne.jp, 23600@debbugs.gnu.org > From: Paul Eggert > 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=-9") is not really "set > the 'TZ' value to the byte-string '-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.