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

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

bug#22887: 24.4; Bug in timeclock-day-* functions (timeclock.el)


From: Oleg Katsitadze
Subject: bug#22887: 24.4; Bug in timeclock-day-* functions (timeclock.el)
Date: Wed, 2 Mar 2016 14:51:10 -0800

Here's how to reproduce:

1. Run "emacs -Q".

2. Evaluate this:

    (load-library "timeclock.el")

3. Create some time log entries (e.g., by clocking in/out using
timeclock.el).

4. For one of the days in ~/.emacs.d/timelog, manually add the "h"
entry ("time required") to override the default required time for that
day, e.g.:

    h 2016/03/02 00:00:00 6

5. Evaluate this:

    (timeclock-reread-log)

6. Evaluate this:

    (timeclock-day-list-length (timeclock-day-alist))

Emacs reports an error:

    Debugger entered--Lisp error: (wrong-type-argument listp 21600.0)
      cadr(21600.0)
      (timeclock-time-to-seconds (cadr entry))
      (- (timeclock-time-to-seconds (cadr entry))
(timeclock-time-to-seconds (car entry)))
      timeclock-entry-length(21600.0)
      (+ length (timeclock-entry-length entry))
      (setq length (+ length (timeclock-entry-length entry)))
      (while --dolist-tail-- (setq entry (car --dolist-tail--)) (setq
length (+ length (timeclock-entry-length entry))) (setq
--dolist-tail-- (cdr --dolist-tail--)))
      (let ((--dolist-tail-- entry-list) entry) (while --dolist-tail--
(setq entry (car --dolist-tail--)) (setq length (+ length
(timeclock-entry-length entry))) (setq --dolist-tail-- (cdr
--dolist-tail--))))
      (let ((length 0)) (let ((--dolist-tail-- entry-list) entry)
(while --dolist-tail-- (setq entry (car --dolist-tail--)) (setq length
(+ length (timeclock-entry-length entry))) (setq --dolist-tail-- (cdr
--dolist-tail--)))) length)
      timeclock-entry-list-length((21600.0 ((22231 25979) (22231
25983) "project")))
      timeclock-day-length(("2016/03/02" 21600.0 ((22231 25979) (22231
25983) "project")))
      funcall(timeclock-day-length ("2016/03/02" 21600.0 ((22231
25979) (22231 25983) "project")))
      (+ length (funcall func day))
      (setq length (+ length (funcall func day)))
      (while --dolist-tail-- (setq day (car --dolist-tail--)) (setq
length (+ length (funcall func day))) (setq --dolist-tail-- (cdr
--dolist-tail--)))
      (let ((--dolist-tail-- day-list) day) (while --dolist-tail--
(setq day (car --dolist-tail--)) (setq length (+ length (funcall func
day))) (setq --dolist-tail-- (cdr --dolist-tail--))))
      (let ((length 0)) (let ((--dolist-tail-- day-list) day) (while
--dolist-tail-- (setq day (car --dolist-tail--)) (setq length (+
length (funcall func day))) (setq --dolist-tail-- (cdr
--dolist-tail--)))) length)
      timeclock-day-list-template(timeclock-day-length (("2016/03/02"
21600.0 ((22231 25979) (22231 25983) "project"))))
      timeclock-day-list-length((("2016/03/02" 21600.0 ((22231 25979)
(22231 25983) "project"))))
      eval((timeclock-day-list-length (timeclock-day-alist)) nil)
      eval-last-sexp-1(nil)
      eval-last-sexp(nil)
      call-interactively(eval-last-sexp nil nil)
      command-execute(eval-last-sexp)

Expected:  Length of day-alist from the time log, in seconds.

I think the bug is in timeclock-day-* functions which use "cdr day"
instead of "cddr day", thus failing to skip the DAY-LENGTH field of
the ENTRIES-BY-DAY alist.  When there's no "h" entry in the time log,
timeclock sets DAY-LENGTH to nil, and the timeclock-day-length
function works because it eventually executes

    timeclock-time-to-seconds (cadr nil)

which works.  But as soon as "h" is added, DAY-LENGTH becomes non-nil
which crashes timeclock as soon as it tries to take cadr of an
integer.

Note that timeclock-day-projects correctly uses cddr, unlike other
timeclock-day-* functions.

Thanks,
Oleg


In GNU Emacs 24.4.1 (i586-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2015-03-07 on binet, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11604000
Configured using:
 `configure --build i586-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 
--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --build i586-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
 
--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
 -Werror=format-security -Wall' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LC_ALL: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Debugger

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<down-mouse-2> <mouse-2> C-j M-x t i m e c l <tab>
n i <backspace> <backspace> i n <return> p r o j e
c t <return> M-x t i m e c l o c k - o u <tab> <return>
<return> C-x C-f . e m a c s . d / t i m e l o g <tab>
<return> C-o h SPC 2 0 1 6 / 0 3 / 0 2 SPC 0 0 . <backspace>
: [ <backspace> 0 0 : 0 0 SPC 6 C-x C-s C-x k <return>
<down-mouse-2> <mouse-2> C-j <down-mouse-2> <mouse-2>
C-j M-x r e p o r t <tab> <return>

Recent messages:
uncompressing timeclock.el.gz...done
Loading /usr/share/emacs/24.4/lisp/calendar/timeclock.el.gz...done
Saving file /home/oleg/.emacs.d/timelog...
Wrote /home/oleg/.emacs.d/timelog
Saving file /home/oleg/.emacs.d/timelog...
Wrote /home/oleg/.emacs.d/timelog
Saving file /home/oleg/.emacs.d/timelog...
Wrote /home/oleg/.emacs.d/timelog
Mark set [2 times]
Entering debugger...

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
help-fns mail-prsvr mail-utils help-mode easymenu debug timeclock
easy-mmode jka-compr time-date tooltip electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
gfilenotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 8 79029 6067)
 (symbols 24 17956 0)
 (miscs 20 61 214)
 (strings 16 10068 4233)
 (string-bytes 1 291660)
 (vectors 8 9796)
 (vector-slots 4 396421 4712)
 (floats 8 80 320)
 (intervals 28 289 13)
 (buffers 512 12)
 (heap 1024 18148 749))





reply via email to

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