bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#19874: 25.0.50; encode-time not working as expected


From: Ashish SHUKLA
Subject: bug#19874: 25.0.50; encode-time not working as expected
Date: Thu, 26 Feb 2015 12:21:55 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (amd64-portbld-freebsd10.1)

On Wed, 25 Feb 2015 09:41:45 -0800, Paul Eggert <eggert@cs.ucla.edu> said:
| Thanks for the bug report.  My guess is that there's an
| incompatibility with FreeBSD 10.1 amd64 mktime.  I can't reproduce the
| problem on FreeBSD 9.1 x86.

| Please try the attached patch, just for debugging, and then run the
| following one-line shell command:

| src/emacs -Q -batch -eval '(progn (setenv "TZ" "Asia/Kolkata") (print
| (encode-time 44 42 6 15 2 2015 0 nil 0)))'

| What output do you get?  Here's what I get on Fedora 21 x86-64, which seems 
correct:

| oldtz=Asia/Kolkata tz=XXX-0:00:00 oldTZ=Asia/Kolkata TZ=XXX-0:00:00
| 2015-02-15 06:42:44 -1 -> 2015-02-15 06:42:44 0 = 1423982564

Tried, and following is what I get:

--8<---------------cut here---------------start------------->8---
emacs-25.0.50.20150206.5c9ad35f/src % ../src/emacs -Q -batch -eval '(progn 
(setenv "TZ" "Asia/Kolkata") (print (encode-time 44 42 6 15 2 2015 0 nil 0)))'
oldtz=Asia/Kolkata tz=XXX-0:00:00 oldTZ=Asia/Kolkata TZ=XXX-0:00:00 2015-02-15 
06:42:44 -1 -> 2015-02-15 06:42:44 0 = 1423982564
(21728 16356)
--8<---------------cut here---------------end--------------->8---


Since I noticed that your code doesn't do any changes, rather just prints
some intermediate information, so I did this in X11 window (note the absence
of '-batch' option)

--8<---------------cut here---------------start------------->8---
emacs-25.0.50.20150206.5c9ad35f/src % ../src/emacs -Q -eval '(progn (setenv 
"TZ" "Asia/Kolkata") (print (encode-time 44 42 6 15 2 2015 0 nil 0)))'
oldtz=(null) tz=XXX-0:00:00 oldTZ=(null) TZ=(null) 2015-02-15 06:42:44 -1 -> 
2015-02-15 06:42:44 0 = 1423962764
--8<---------------cut here---------------end--------------->8---

in minibuffer in X11 window, "(21727 62092)" message was printed. I explicitly
eval-ed Emacs Lisp code in *scratch* buffer, and got same output as mentioned
above.

Ran "emacs -batch ...." under gdb, with breaking on `getenv' after 
`Fencode_time':

--8<---------------cut here---------------start------------->8---
Breakpoint 5, 0x00000008084beab4 in getenv () from /lib/libc.so.7
(gdb) bt
#0  0x00000008084beab4 in getenv () from /lib/libc.so.7
#1  0x0000000000677fa8 in emacs_mktime_z (tz=0x1385fd8 "XXX-0:00:00", 
tm=0x7fffffffb140) at editfns.c:1404
#2  0x0000000000679f6a in Fencode_time (nargs=9, args=0x7fffffffb1a0) at 
editfns.c:2150
#3  0x000000000068ac60 in eval_sub (form=18361299) at eval.c:2154
#4  0x000000000068ad06 in eval_sub (form=18361523) at eval.c:2167
#5  0x000000000068b4b6 in Fprogn (body=18360931) at eval.c:445
#6  0x000000000068aa06 in eval_sub (form=18361811) at eval.c:2131
#7  0x000000000068fb66 in Feval (form=18361811, lexical=0) at eval.c:1996
#8  0x0000000000690a7d in Ffuncall (nargs=2, args=0x7fffffffba78) at eval.c:2721
#9  0x00000000006f3114 in exec_byte_code (bytestr=11659316, vector=11659349, 
maxdepth=94, args_template=1030, nargs=1, args=0x7fffffffc458) at bytecode.c:919
#10 0x0000000000691aba in funcall_lambda (fun=11659269, nargs=1, 
arg_vector=0x7fffffffc450) at eval.c:2885
#11 0x0000000000690c6e in Ffuncall (nargs=2, args=0x7fffffffc448) at eval.c:2767
#12 0x00000000006f3114 in exec_byte_code (bytestr=11636164, vector=11636197, 
maxdepth=74, args_template=2, nargs=0, args=0x7fffffffce78) at bytecode.c:919
#13 0x0000000000691aba in funcall_lambda (fun=11636117, nargs=0, 
arg_vector=0x7fffffffce78) at eval.c:2885
#14 0x0000000000690c6e in Ffuncall (nargs=1, args=0x7fffffffce70) at eval.c:2767
#15 0x00000000006f3114 in exec_byte_code (bytestr=11633180, vector=11633213, 
maxdepth=50, args_template=2, nargs=0, args=0x7fffffffd730) at bytecode.c:919
#16 0x0000000000691aba in funcall_lambda (fun=11633133, nargs=0, 
arg_vector=0x7fffffffd730) at eval.c:2885
#17 0x000000000068ff01 in apply_lambda (fun=11633133, args=0, count=3) at 
eval.c:2826
#18 0x000000000068afdf in eval_sub (form=18458531) at eval.c:2226
#19 0x000000000068fb66 in Feval (form=18458531, lexical=0) at eval.c:1996
#20 0x00000000005cff4a in top_level_2 () at keyboard.c:1148
#21 0x000000000068e3d1 in internal_condition_case (bfun=0x5cff20 <top_level_2>, 
handlers=19488, hfun=0x5cff50 <cmd_error>) at eval.c:1348
#22 0x00000000005cfeb3 in top_level_1 (ignore=0) at keyboard.c:1156
#23 0x000000000068d981 in internal_catch (tag=46224, func=0x5cfe60 
<top_level_1>, arg=0) at eval.c:1108
#24 0x00000000005b1190 in command_loop () at keyboard.c:1117
#25 0x00000000005b0fe1 in recursive_edit_1 () at keyboard.c:728
#26 0x00000000005b138a in Frecursive_edit () at keyboard.c:799
#27 0x00000000005aeda1 in main (argc=5, argv=0x7fffffffde88) at emacs.c:1607

Lisp Backtrace:
"encode-time" (0xffffb1a0)
"print" (0xffffb5e8)
"progn" (0xffffb848)
"eval" (0xffffba80)
"command-line-1" (0xffffc450)
"command-line" (0xffffce78)
"normal-top-level" (0xffffd730)
(gdb) next
Single stepping until exit from function getenv,
which has no line number information.
emacs_mktime_z (tz=0x1385fd8 "XXX-0:00:00", tm=0x7fffffffb140) at editfns.c:1405
1405      USE_SAFE_ALLOCA;
(gdb) list
1400    #ifndef HAVE_TZALLOC
1401    time_t
1402    mktime_z (timezone_t tz, struct tm *tm)
1403    {
1404      char *oldtz = getenv ("TZ");
1405      USE_SAFE_ALLOCA;
1406      if (oldtz)
1407        {
1408          size_t oldtzsize = strlen (oldtz) + 1;
1409          char *oldtzcopy = SAFE_ALLOCA (oldtzsize);
(gdb) print oldtz
$1 = 0x1364783 "Asia/Kolkata"
--8<---------------cut here---------------end--------------->8---

And with gdb-ing in non -batch mode, got this instead:

--8<---------------cut here---------------start------------->8---
Breakpoint 4, 0x00000008084beab4 in getenv () from /lib/libc.so.7
(gdb) bt
#0  0x00000008084beab4 in getenv () from /lib/libc.so.7
#1  0x0000000000677fa8 in emacs_mktime_z (tz=0x1d16ae8 "XXX-0:00:00", 
tm=0x7fffffffb150) at editfns.c:1404
#2  0x0000000000679f6a in Fencode_time (nargs=9, args=0x7fffffffb1b0) at 
editfns.c:2150
#3  0x000000000068ac60 in eval_sub (form=30524771) at eval.c:2154
#4  0x000000000068ad06 in eval_sub (form=30524755) at eval.c:2167
#5  0x000000000068b4b6 in Fprogn (body=30524947) at eval.c:445
#6  0x000000000068aa06 in eval_sub (form=30524675) at eval.c:2131
#7  0x000000000068fb66 in Feval (form=30524675, lexical=0) at eval.c:1996
#8  0x0000000000690a7d in Ffuncall (nargs=2, args=0x7fffffffba88) at eval.c:2721
#9  0x00000000006f3114 in exec_byte_code (bytestr=11659316, vector=11659349, 
maxdepth=94, args_template=1030, nargs=1, args=0x7fffffffc468) at bytecode.c:919
#10 0x0000000000691aba in funcall_lambda (fun=11659269, nargs=1, 
arg_vector=0x7fffffffc460) at eval.c:2885
#11 0x0000000000690c6e in Ffuncall (nargs=2, args=0x7fffffffc458) at eval.c:2767
#12 0x00000000006f3114 in exec_byte_code (bytestr=11636164, vector=11636197, 
maxdepth=74, args_template=2, nargs=0, args=0x7fffffffce88) at bytecode.c:919
#13 0x0000000000691aba in funcall_lambda (fun=11636117, nargs=0, 
arg_vector=0x7fffffffce88) at eval.c:2885
#14 0x0000000000690c6e in Ffuncall (nargs=1, args=0x7fffffffce80) at eval.c:2767
#15 0x00000000006f3114 in exec_byte_code (bytestr=11633180, vector=11633213, 
maxdepth=50, args_template=2, nargs=0, args=0x7fffffffd740) at bytecode.c:919
#16 0x0000000000691aba in funcall_lambda (fun=11633133, nargs=0, 
arg_vector=0x7fffffffd740) at eval.c:2885
#17 0x000000000068ff01 in apply_lambda (fun=11633133, args=0, count=3) at 
eval.c:2826
#18 0x000000000068afdf in eval_sub (form=18458531) at eval.c:2226
#19 0x000000000068fb66 in Feval (form=18458531, lexical=0) at eval.c:1996
#20 0x00000000005cff4a in top_level_2 () at keyboard.c:1148
#21 0x000000000068e3d1 in internal_condition_case (bfun=0x5cff20 <top_level_2>, 
handlers=19488, hfun=0x5cff50 <cmd_error>) at eval.c:1348
#22 0x00000000005cfeb3 in top_level_1 (ignore=0) at keyboard.c:1156
#23 0x000000000068d981 in internal_catch (tag=46224, func=0x5cfe60 
<top_level_1>, arg=0) at eval.c:1108
#24 0x00000000005b1190 in command_loop () at keyboard.c:1117
#25 0x00000000005b0fe1 in recursive_edit_1 () at keyboard.c:728
#26 0x00000000005b138a in Frecursive_edit () at keyboard.c:799
#27 0x00000000005aeda1 in main (argc=4, argv=0x7fffffffde98) at emacs.c:1607

Lisp Backtrace:
"encode-time" (0xffffb1b0)
"print" (0xffffb5f8)
"progn" (0xffffb858)
"eval" (0xffffba90)
"command-line-1" (0xffffc460)
"command-line" (0xffffce88)
"normal-top-level" (0xffffd740)
(gdb) next
Single stepping until exit from function getenv,
which has no line number information.
emacs_mktime_z (tz=0x1d16ae8 "XXX-0:00:00", tm=0x7fffffffb150) at editfns.c:1405
1405      USE_SAFE_ALLOCA;
(gdb) print oldtz 
$1 = 0x0
--8<---------------cut here---------------end--------------->8---

HTH
-- 
Ashish SHUKLA

<@abbe> give man ssh access, he'll still need computer. give him a computer,
he'll give ssh access to you.

Sent from my Emacs

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]