GNU bug report logs -
#22302
25.1.50; time-stamp ignores time-stamp-time-zone
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22302 in the body.
You can then email your comments to 22302 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#22302
; Package
emacs
.
(Mon, 04 Jan 2016 00:20:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Harald Hanche-Olsen <hanche <at> math.ntnu.no>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 04 Jan 2016 00:20:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Run emacs -Q and insert this text:
Time-stamp: <>
Then do:
M-: (require 'time-stamp) RET
M-x set-variable RET time-stamp-time-zone RET "UTC" RET
M-x time-stamp
Expected result: A UTC time stamp is inserted.
Actual result: A time stamp in the local time zone is inserted.
My analysis:
time-stamp uses time-stamp-string to compute the string to insert.
And that calls:
(format-time-string (time-stamp-string-preprocess ts-format)
nil time-stamp-time-zone)
However, time-stamp-string-preprocess does all the work,
leaving nothing for format-time-string to do.
And it does so without consulting time-stamp-time-zone.
Admittedly, the doc string for time-stamp (no longer?) mentions time-stamp-time-zone.
However, the variable does exist, and its doc string indicates that it will be used by time-stamp.
– Harald
In GNU Emacs 25.1.50.1 (x86_64-apple-darwin15.2.0, NS appkit-1404.34 Version 10.11.2 (Build 15C50))
of 2015-12-17
Repository revision: 23b5c22703eeee7b4fe6608ce12ffe3b87794933
Windowing system distributor 'Apple', version 10.3.1404
Configured using:
'configure --with-ns'
Configured features:
RSVG IMAGEMAGICK NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS
Important settings:
value of $LC_CTYPE: en_US.UTF-8
locale-coding-system: utf-8-unix
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#22302
; Package
emacs
.
(Tue, 12 Jan 2016 04:41:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 22302 <at> debbugs.gnu.org (full text, mbox):
Harald Hanche-Olsen wrote:
> Run emacs -Q and insert this text:
> Time-stamp: <>
>
> Then do:
> M-: (require 'time-stamp) RET
> M-x set-variable RET time-stamp-time-zone RET "UTC" RET
> M-x time-stamp
>
> Expected result: A UTC time stamp is inserted.
> Actual result: A time stamp in the local time zone is inserted.
This is due to af32fa956. Paul, could you have a look please?
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Tue, 12 Jan 2016 17:15:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Harald Hanche-Olsen <hanche <at> math.ntnu.no>
:
bug acknowledged by developer.
(Tue, 12 Jan 2016 17:15:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 22302-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 01/11/2016 08:40 PM, Glenn Morris wrote:
> Harald Hanche-Olsen wrote:
>
>> Run emacs -Q and insert this text:
>> Time-stamp: <>
>>
>> Then do:
>> M-: (require 'time-stamp) RET
>> M-x set-variable RET time-stamp-time-zone RET "UTC" RET
>> M-x time-stamp
>>
>> Expected result: A UTC time stamp is inserted.
>> Actual result: A time stamp in the local time zone is inserted.
> This is due to af32fa956. Paul, could you have a look please?
Thanks for reporting this. I fixed the bug by installing the attached
patch to emacs-25.
By the way, the value "UTC" is not portable to non-GNU systems, and
POSIX says that in theory it could cause Emacs to crash. The value
should be "UTC0" or (in Emacs 25) t. I see that some of Emacs's own
source files have this issue, and plan to look into that.
[0001-Fix-time-stamp-time-zone-bugs-introduced-in-July.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#22302
; Package
emacs
.
(Tue, 12 Jan 2016 17:48:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 22302-done <at> debbugs.gnu.org (full text, mbox):
Paul Eggert wrote:
> By the way, the value "UTC" is not portable to non-GNU systems, and
> POSIX says that in theory it could cause Emacs to crash.
Well, that sure sounds like a recipe for trouble.
Please make it so that perfectly reasonable user-input can't crash Emacs.
> The value should be "UTC0" or (in Emacs 25) t.
I would guess that very few people are going to use "UTC0" instead of
"UTC". Can't say I blame them.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#22302
; Package
emacs
.
(Tue, 12 Jan 2016 20:20:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 22302-done <at> debbugs.gnu.org (full text, mbox):
On 01/12/2016 09:47 AM, Glenn Morris wrote:
> Please make it so that perfectly reasonable user-input can't crash Emacs.
Sorry, I take it back, in rereading the spec POSIX says merely that the
behavior is unspecified when TZ="UTC", which I understand to mean that
localtime_r should not crash so we don't need to worry about that in
Emacs. However, the user might not get Universal Time, so "UTC0" is
still safer.
This is not an issue for operating systems like GNU/Linux, FreeBSD, OS
X, and Solaris, where "UTC" means the same thing as "UTC0", because
there's a file with a name like /usr/share/zoneinfo/UTC that does the
right thing. I don't know what MS-Windows does with TZ="UTC" but I
expect it works OK there too, otherwise we would have gotten bug reports
before now (as this issue would come up even in older Emacs versions). I
am mostly worried about obscure operating systems like HP-UX that do not
use the tz database and which are not much tested by GNU Emacs developers.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#22302
; Package
emacs
.
(Tue, 12 Jan 2016 20:52:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 22302 <at> debbugs.gnu.org (full text, mbox):
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> Date: Tue, 12 Jan 2016 12:19:10 -0800
> Cc: 22302-done <at> debbugs.gnu.org, Harald Hanche-Olsen <hanche <at> math.ntnu.no>
>
> I don't know what MS-Windows does with TZ="UTC"
Nothing. It doesn't understand that. The MS-Windows time routines
need an explicit offset from UTC to be able to account for the
timezone. So unless you say UTC-0, nothing will happen.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#22302
; Package
emacs
.
(Tue, 12 Jan 2016 21:30:02 GMT)
Full text and
rfc822 format available.
Message #25 received at 22302 <at> debbugs.gnu.org (full text, mbox):
On 01/12/2016 12:51 PM, Eli Zaretskii wrote:
>> don't know what MS-Windows does with TZ="UTC"
> Nothing. It doesn't understand that. The MS-Windows time routines
> need an explicit offset from UTC to be able to account for the
> timezone. So unless you say UTC-0, nothing will happen.
In that case I'm a bit puzzled. Before today, lines like this:
# time-stamp-time-zone: "UTC"
appeared in files like build-aux/gitlog-to-changelog. Emacs implements
these lines by temporarily setting the TZ environment variable to "UTC".
If that setting is ineffective on MS-Windows, presumably any relevant
time stamps were generated in local time instead, which is not wanted.
Perhaps no MS-Windows users noticed, or none of them bothered to file a
bug report.
Or perhaps "nothing will happen" means "no offset from UTC will be
applied", which means that unrecognized TZ settings act like UTC; this
is what tzcode does.
Or it could be something else, though I don't know what.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#22302
; Package
emacs
.
(Wed, 13 Jan 2016 15:48:01 GMT)
Full text and
rfc822 format available.
Message #28 received at 22302 <at> debbugs.gnu.org (full text, mbox):
> Cc: rgm <at> gnu.org, 22302 <at> debbugs.gnu.org, hanche <at> math.ntnu.no
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> Date: Tue, 12 Jan 2016 13:29:23 -0800
>
> On 01/12/2016 12:51 PM, Eli Zaretskii wrote:
> >> don't know what MS-Windows does with TZ="UTC"
> > Nothing. It doesn't understand that. The MS-Windows time routines
> > need an explicit offset from UTC to be able to account for the
> > timezone. So unless you say UTC-0, nothing will happen.
>
> In that case I'm a bit puzzled. Before today, lines like this:
>
> # time-stamp-time-zone: "UTC"
>
> appeared in files like build-aux/gitlog-to-changelog. Emacs implements
> these lines by temporarily setting the TZ environment variable to "UTC".
> If that setting is ineffective on MS-Windows, presumably any relevant
> time stamps were generated in local time instead, which is not wanted.
>
> Perhaps no MS-Windows users noticed, or none of them bothered to file a
> bug report.
>
> Or perhaps "nothing will happen" means "no offset from UTC will be
> applied", which means that unrecognized TZ settings act like UTC; this
> is what tzcode does.
I see that what I said was inaccurate: the MS-Windows runtime indeed
doesn't interpret the 3-letter TZ name, but if the offset is missing,
it is taken as zero. So "UTC" will indeed be interpreted as "UTC+0"
(and so will "EDT" and any other "XXX" with no offset).
Of course, currently this doesn't work in time-stamp, for the reasons
described in the original bug report. But format-time-string does
behave on Windows as described above.
Sorry for any confusion I could cause.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 11 Feb 2016 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 127 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.