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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Oleg Katsitadze <olegkat@HIDDEN>; dated Thu, 3 Mar 2016 00:41:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 22887 <at> debbugs.gnu.org:


Received: (at 22887) by debbugs.gnu.org; 29 Jul 2019 13:22:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 29 09:22:39 2019
Received: from localhost ([127.0.0.1]:47839 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hs5bq-0001q0-Uq
	for submit <at> debbugs.gnu.org; Mon, 29 Jul 2019 09:22:39 -0400
Received: from quimby.gnus.org ([80.91.231.51]:43336)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1hs5bp-0001pq-44
 for 22887 <at> debbugs.gnu.org; Mon, 29 Jul 2019 09:22:37 -0400
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie)
 by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.89) (envelope-from <larsi@HIDDEN>)
 id 1hs5bl-0002Hz-Fx; Mon, 29 Jul 2019 15:22:35 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Oleg Katsitadze <olegkat@HIDDEN>
Subject: Re: bug#22887: 24.4; Bug in timeclock-day-* functions (timeclock.el)
References: <CAK4OEYKLvZ7M90EcJPcNLUFRF9SoMBPo4bN2AQAfVqK_F7H2=Q@HIDDEN>
Date: Mon, 29 Jul 2019 15:22:32 +0200
In-Reply-To: <CAK4OEYKLvZ7M90EcJPcNLUFRF9SoMBPo4bN2AQAfVqK_F7H2=Q@HIDDEN>
 (Oleg Katsitadze's message of "Wed, 2 Mar 2016 14:51:10 -0800")
Message-ID: <87d0ht7z6v.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: (I'm going through old Emacs bug reports that haven't
 received
 any response.) Oleg Katsitadze <olegkat@HIDDEN> writes: > 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. Fo [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 22887
Cc: 22887 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

(I'm going through old Emacs bug reports that haven't received any
response.)

Oleg Katsitadze <olegkat@HIDDEN> writes:

> 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)

I'm unable to reproduce this.  Could you supply a ~/.emacs.d/timelog
file that displays this problem?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#22887; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Mar 2016 00:40:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 02 19:40:29 2016
Received: from localhost ([127.0.0.1]:58323 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1abHJc-0007da-QJ
	for submit <at> debbugs.gnu.org; Wed, 02 Mar 2016 19:40:29 -0500
Received: from eggs.gnu.org ([208.118.235.92]:46276)
 by debbugs.gnu.org with esmtp (Exim 4.84)
 (envelope-from <olegkat@HIDDEN>) id 1abFc1-00055Q-V9
 for submit <at> debbugs.gnu.org; Wed, 02 Mar 2016 17:51:22 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <olegkat@HIDDEN>) id 1abFbv-0001rG-Br
 for submit <at> debbugs.gnu.org; Wed, 02 Mar 2016 17:51:16 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:57434)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <olegkat@HIDDEN>) id 1abFbv-0001r2-8R
 for submit <at> debbugs.gnu.org; Wed, 02 Mar 2016 17:51:15 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:37246)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <olegkat@HIDDEN>) id 1abFbt-0001q4-JQ
 for bug-gnu-emacs@HIDDEN; Wed, 02 Mar 2016 17:51:15 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <olegkat@HIDDEN>) id 1abFbr-0001q1-WF
 for bug-gnu-emacs@HIDDEN; Wed, 02 Mar 2016 17:51:13 -0500
Received: from mail-io0-x22d.google.com ([2607:f8b0:4001:c06::22d]:34653)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <olegkat@HIDDEN>) id 1abFbr-0001pq-Ox
 for bug-gnu-emacs@HIDDEN; Wed, 02 Mar 2016 17:51:11 -0500
Received: by mail-io0-x22d.google.com with SMTP id m184so8594278iof.1
 for <bug-gnu-emacs@HIDDEN>; 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==
MIME-Version: 1.0
X-Received: by 10.107.137.146 with SMTP id t18mr12750615ioi.147.1456959070843; 
 Wed, 02 Mar 2016 14:51:10 -0800 (PST)
Received: by 10.107.48.10 with HTTP; Wed, 2 Mar 2016 14:51:10 -0800 (PST)
Date: Wed, 2 Mar 2016 14:51:10 -0800
Message-ID: <CAK4OEYKLvZ7M90EcJPcNLUFRF9SoMBPo4bN2AQAfVqK_F7H2=Q@HIDDEN>
Subject: 24.4; Bug in timeclock-day-* functions (timeclock.el)
From: Oleg Katsitadze <olegkat@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset=UTF-8
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-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Wed, 02 Mar 2016 19:40:27 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

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))




Acknowledgement sent to Oleg Katsitadze <olegkat@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#22887; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 29 Jul 2019 13:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.