From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleg Katsitadze Newsgroups: gmane.emacs.bugs Subject: bug#22887: 24.4; Bug in timeclock-day-* functions (timeclock.el) Date: Wed, 2 Mar 2016 14:51:10 -0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1456965678 4164 80.91.229.3 (3 Mar 2016 00:41:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Mar 2016 00:41:18 +0000 (UTC) To: 22887@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Mar 03 01:41:09 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 1abHKH-0000Up-ED for geb-bug-gnu-emacs@m.gmane.org; Thu, 03 Mar 2016 01:41:09 +0100 Original-Received: from localhost ([::1]:59851 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abHKG-0002Bt-V2 for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 Mar 2016 19:41:08 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abHKD-0002Av-49 for bug-gnu-emacs@gnu.org; Wed, 02 Mar 2016 19:41:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abHKB-0003Xg-9E for bug-gnu-emacs@gnu.org; Wed, 02 Mar 2016 19:41:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:32965) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abHKB-0003Xa-5J for bug-gnu-emacs@gnu.org; Wed, 02 Mar 2016 19:41:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1abHKB-0007ek-0p for bug-gnu-emacs@gnu.org; Wed, 02 Mar 2016 19:41:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Oleg Katsitadze Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Mar 2016 00:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 22887 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.145696562929367 (code B ref -1); Thu, 03 Mar 2016 00:41:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Mar 2016 00:40:29 +0000 Original-Received: from localhost ([127.0.0.1]:58323 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1abHJc-0007da-QJ for submit@debbugs.gnu.org; Wed, 02 Mar 2016 19:40:29 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:46276) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1abFc1-00055Q-V9 for submit@debbugs.gnu.org; Wed, 02 Mar 2016 17:51:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abFbv-0001rG-Br for submit@debbugs.gnu.org; Wed, 02 Mar 2016 17:51:16 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:57434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abFbv-0001r2-8R for submit@debbugs.gnu.org; Wed, 02 Mar 2016 17:51:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abFbt-0001q4-JQ for bug-gnu-emacs@gnu.org; Wed, 02 Mar 2016 17:51:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abFbr-0001q1-WF for bug-gnu-emacs@gnu.org; Wed, 02 Mar 2016 17:51:13 -0500 Original-Received: from mail-io0-x22d.google.com ([2607:f8b0:4001:c06::22d]:34653) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abFbr-0001pq-Ox for bug-gnu-emacs@gnu.org; Wed, 02 Mar 2016 17:51:11 -0500 Original-Received: by mail-io0-x22d.google.com with SMTP id m184so8594278iof.1 for ; Wed, 02 Mar 2016 14:51:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to; bh=ZC2huJiHFGgzzaZWtI1GIdOJSaC1+ectPGzVtXGVEmk=; b=lJUHtlFq1ndYs4WqlDk28RzzypJyn8hBstU17KLZfvCzlkxrtBBmOFx5CoCXYZBa5g 65kbCoawAxNWcJlriNvvxOnuWUkg4p66QcEKY+PwCNoOvM+O0Z9W1onLofwRcFs6JqWW ZpYH6mwkFGfCG32DgQjvvrCbsX5LFyqHuL2QUD0ris4OWjlzCFUbdMNins15vZwej6I4 FvXgFy6d9/ULFQSCSJnfpXiBhEnJl+I4oGctUlTiNJuqtIzLQUztMuTvX0i5rJ/Jk1ZY 7AgD5VxJrxLPmmJxbkKYl15Id1T2dZLaVzCPxH5leGOLKwsEQmLAkfyt1ZVMWr8drg1m TfVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=ZC2huJiHFGgzzaZWtI1GIdOJSaC1+ectPGzVtXGVEmk=; b=LrcilPseMyrYsNnyTcIzG5SkcNuWbmHv19ACych8PdCXZEpA7/4anG/Aunr1qU/fH3 9917daBnlWWik2e6wNGLU2cVAYdyQPJygwrxbIGUmKdzDhDgNNPqP1W85DRswqMu3LnW hFpYEMtCgvorlkPNTxeNrwEiY2Z6JxDmHFeV1sTXjUUO84u8PFLSLlLKOWqXiCqKA+nK UMfyxvYLQ1SLM/fzB2xolZrCIsm75p6JkTnHVb5YSlveHecG9ycEGF7iayoiTgGgOgLb O0+FCR3uvk2CXZCBemYcWcvK1M6VZH/HQ1fd+HJ4qo0FSaSXdi2Lh7irI/RT6as1S9M6 MbKQ== X-Gm-Message-State: AD7BkJJUP1+RtkmBEQiATPbdLIxatrrZZrTUDu1WKfAkC//2RWQS9AZXUMhgAhJNXRl3P/AqAXnmRwaPLdNKiQ== X-Received: by 10.107.137.146 with SMTP id t18mr12750615ioi.147.1456959070843; Wed, 02 Mar 2016 14:51:10 -0800 (PST) Original-Received: by 10.107.48.10 with HTTP; Wed, 2 Mar 2016 14:51:10 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Wed, 02 Mar 2016 19:40:27 -0500 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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:114319 Archived-At: 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: C-j M-x t i m e c l n i i n p r o j e c t M-x t i m e c l o c k - o u C-x C-f . e m a c s . d / t i m e l o g C-o h SPC 2 0 1 6 / 0 3 / 0 2 SPC 0 0 . : [ 0 0 : 0 0 SPC 6 C-x C-s C-x k C-j C-j M-x r e p o r t 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))