emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Gregor Zattler <grfz@gmx.de>
Cc: emacs-orgmode@gnu.org
Subject: [BUG, confirmed] org-clock-in calling org-clock-sum fails leaving incomplete CLOCK line when encountering existing malformed CLOCK lines
Date: Fri, 03 Jun 2022 14:04:04 +0800	[thread overview]
Message-ID: <87y1yecmgb.fsf@localhost> (raw)
In-Reply-To: <87h754bdlk.fsf@no.workgroup>

Gregor Zattler <grfz@gmx.de> writes:

>>> org-parse-time-string: Not an Org time string: [20zznn22-05-30 Mo 11:34]
>>>
>>> And then there is a dangling
>>>
>>> CLOCK:
>>>
>>> line without timestamps at the expected line in my org file.
>>>
>>> It took a while till I realized that there was a corrupted
>>> timestamp in my org file a few clock lines below.
>>
>> Could you please create an example file and detail the steps how you got
>> the error?
>
> Please see the attached test.org and call Emacs like so:
>
>
> /usr/local/bin/emacs-29.0.50 -Q -L ~/src/org-mode/lisp /tmp/test.org --eval '(switch-to-buffer "test.org")' -f org-clock-in

Thanks!
Confirmed using the described steps.

This is an omission in org-clock-sum.
When parsing clock lines (which org-clock-sum considers as any line
starting from word CLOCK:), org-clock-sum calls org-parse-time-string.
The latter throws the error you are seeing.

The problem have been present at lest since Org 9.1.9.
An easy fix would be catching the error and ignoring erroneous headline.
An alternative could be also throwing a warning or more informative
error.
Another alternative could be using org-element and only parsing real
clock objects + adding org-lint checker for malformed clock lines.
org-lint checker will be useful in any case though.

I do not consider this as a pressing issue, so I am just leaving the
possible solutions above. And patches are welcome :)

Best,
Ihor


  reply	other threads:[~2022-06-03  6:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-30 10:02 [BUG] org-element-warnings when accidentially inserting "z" into timestamp [9.5.3 (release_9.5.3-471-gebbef7.dirty @ /home/grfz/src/org-mode/lisp/)] Gregor Zattler
2022-05-30 11:51 ` Ihor Radchenko
2022-05-30 14:42   ` Gregor Zattler
2022-05-31  5:01     ` Ihor Radchenko
2022-06-01 15:36       ` Gregor Zattler
2022-06-03  6:04         ` Ihor Radchenko [this message]
2022-10-13  6:15           ` [BUG, confirmed] org-clock-in calling org-clock-sum fails leaving incomplete CLOCK line when encountering existing malformed CLOCK lines Ihor Radchenko
2022-10-14 18:52             ` Gregor Zattler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1yecmgb.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=grfz@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).