all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* "Cache corruption detected" when editing CLOCK timestamp by hand
@ 2021-10-22 18:47 William Denton
  2021-10-22 18:56 ` William Denton
  2021-10-23  3:34 ` Ihor Radchenko
  0 siblings, 2 replies; 8+ messages in thread
From: William Denton @ 2021-10-22 18:47 UTC (permalink / raw)
  To: emacs-orgmode

Sometimes I edit timestamps by hand when I'm clocking things.  I had a task 
where I'd clocked in and wanted to close by hand (by adding --[2021 and so on to 
the CLOCK line) but when I started typing this popped up in a window:

Warning (emacs): org-element--cache: Cache corruption detected in work-diary.org. Resetting.
  The error was: (error #("Not an Org time string: []" 24 25 (wrap-prefix #(" 
" 0 8 (face org-indent)) line-prefix #("        " 0 8 (face org-indent)) fontified t) 25 26 (wrap-prefix #("        " 0 8 (face org-indent)) line-prefix #("        " 0 8 (face org-indent)) fontified t))) Disable showing Disable 
logging

"[2021" certainly isn't a time string, but the warning surprised me.  I presume 
it's because of the recent improvements about persistence.  I have no 
suggestions but thought I'd point it out in case it might crop up more if other 
people enter clock timestamps by hand.

Thanks,

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: "Cache corruption detected" when editing CLOCK timestamp by hand
  2021-10-22 18:47 "Cache corruption detected" when editing CLOCK timestamp by hand William Denton
@ 2021-10-22 18:56 ` William Denton
  2021-10-23  3:34 ` Ihor Radchenko
  1 sibling, 0 replies; 8+ messages in thread
From: William Denton @ 2021-10-22 18:56 UTC (permalink / raw)
  To: emacs-orgmode

On 22 October 2021, William Denton wrote:

> Sometimes I edit timestamps by hand when I'm clocking things.  I had a task 
> where I'd clocked in and wanted to close by hand (by adding --[2021 and so on 
> to the CLOCK line) but when I started typing this popped up in a window:

I think I was too hasty in sending this.  More clocking threw a couple more 
warnings that then stopped, and this one hasn't happened again, so maybe it was 
just due to cacheing being set up for the first time somehow.  Sorry about that.

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: "Cache corruption detected" when editing CLOCK timestamp by hand
  2021-10-22 18:47 "Cache corruption detected" when editing CLOCK timestamp by hand William Denton
  2021-10-22 18:56 ` William Denton
@ 2021-10-23  3:34 ` Ihor Radchenko
  2021-10-23  3:52   ` Ihor Radchenko
  1 sibling, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2021-10-23  3:34 UTC (permalink / raw)
  To: William Denton; +Cc: emacs-orgmode

William Denton <wtd@pobox.com> writes:

> Sometimes I edit timestamps by hand when I'm clocking things.  I had a task 
> where I'd clocked in and wanted to close by hand (by adding --[2021 and so on to 
> the CLOCK line) but when I started typing this popped up in a window:
>
> Warning (emacs): org-element--cache: Cache corruption detected in work-diary.org. Resetting.
>   The error was: (error #("Not an Org time string: []" 24 25 (wrap-prefix #(" 

Thanks for reporting! Such warning should not normally appear. It
_always_ indicates a bug that needs to be fixed.

Best,
Ihor


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: "Cache corruption detected" when editing CLOCK timestamp by hand
  2021-10-23  3:34 ` Ihor Radchenko
@ 2021-10-23  3:52   ` Ihor Radchenko
  2021-11-23 12:34     ` [PATCH] " Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2021-10-23  3:52 UTC (permalink / raw)
  To: William Denton; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@gmail.com> writes:

> William Denton <wtd@pobox.com> writes:
>
>> Sometimes I edit timestamps by hand when I'm clocking things.  I had a task 
>> where I'd clocked in and wanted to close by hand (by adding --[2021 and so on to 
>> the CLOCK line) but when I started typing this popped up in a window:
>>
>> Warning (emacs): org-element--cache: Cache corruption detected in work-diary.org. Resetting.
>>   The error was: (error #("Not an Org time string: []" 24 25 (wrap-prefix #(" 

Confirmed.

This looks like a bug in org-element-timestamp-parser

Minimal reproducer:

1. Create an empty org file and open it
2. Yank the following string: "CLOCK: [2021-10-22 Fri 10:41]--[2021]"
3. M-: (org-element-at-point) <RET>

Best,
Ihor


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] "Cache corruption detected" when editing CLOCK timestamp by hand
  2021-10-23  3:52   ` Ihor Radchenko
@ 2021-11-23 12:34     ` Ihor Radchenko
  2022-04-30  3:37       ` Ihor Radchenko
  2022-05-30 11:50       ` Ihor Radchenko
  0 siblings, 2 replies; 8+ messages in thread
From: Ihor Radchenko @ 2021-11-23 12:34 UTC (permalink / raw)
  To: William Denton, Nicolas Goaziou; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1109 bytes --]

Ihor Radchenko <yantar92@gmail.com> writes:

> This looks like a bug in org-element-timestamp-parser
>
> Minimal reproducer:
>
> 1. Create an empty org file and open it
> 2. Yank the following string: "CLOCK: [2021-10-22 Fri 10:41]--[2021]"
> 3. M-: (org-element-at-point) <RET>

The attached is tentative fix for cases like the above.
It gets rid of the observed error, however I am not sure if the clock
line parser returns a reasonable value is such case. With the patch,
org-element-at-point returns

(clock (:status running
       :value
       (timestamp (
                  :type inactive
                  :raw-value "[2021-10-22 Fri 10:41]"
                  :year-start 2021 :month-start 10 :day-start 22
                  :hour-start 10 :minute-start 41 :year-end 2021
                  :month-end 10 :day-end 22 :hour-end 10 :minute-end 41
                  :begin 301 :end 323 :post-blank 0))
        :duration nil :begin 294 :end 331 :post-blank 0 :post-affiliated 294))

Should we consider the above CLOCK line as a valid running clock or
maybe it should be parsed as a paragraph?

Best,
Ihor


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-element-Fix-org-element-timestamp-parser-for-inc.patch --]
[-- Type: text/x-diff, Size: 1257 bytes --]

From 91749491eb95cf1088fbe5a479eb30816478dba7 Mon Sep 17 00:00:00 2001
Message-Id: <91749491eb95cf1088fbe5a479eb30816478dba7.1637670436.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Tue, 23 Nov 2021 20:25:41 +0800
Subject: [PATCH] org-element: Fix org-element-timestamp-parser for incomplete
 ranges

* lisp/org-element.el (org-element-timestamp-parser): Use more strict
regexp to match second timestamp in timestamp--timestamp range.

Fixes https://list.orgmode.org/orgmode/87tuh88kjv.fsf@localhost/
---
 lisp/org-element.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index b47fba9eb..b40ff2d33 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -3900,7 +3900,9 @@ (defun org-element-timestamp-parser ()
 	     (activep (eq (char-after) ?<))
 	     (raw-value
 	      (progn
-		(looking-at "\\([<[]\\(%%\\)?.*?\\)[]>]\\(?:--\\([<[].*?[]>]\\)\\)?")
+		(looking-at (concat "\\([<[]\\(%%\\)?.*?\\)[]>]\\(?:--\\("
+                                    org-ts-regexp-both
+                                    "\\)\\)?"))
 		(match-string-no-properties 0)))
 	     (date-start (match-string-no-properties 1))
 	     (date-end (match-string 3))
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] "Cache corruption detected" when editing CLOCK timestamp by hand
  2021-11-23 12:34     ` [PATCH] " Ihor Radchenko
@ 2022-04-30  3:37       ` Ihor Radchenko
  2022-05-30 11:50       ` Ihor Radchenko
  1 sibling, 0 replies; 8+ messages in thread
From: Ihor Radchenko @ 2022-04-30  3:37 UTC (permalink / raw)
  To: William Denton; +Cc: emacs-orgmode, Nicolas Goaziou

Ihor Radchenko <yantar92@gmail.com> writes:

> Should we consider the above CLOCK line as a valid running clock or
> maybe it should be parsed as a paragraph?

Nicolas, do you have any comment on this? I am inclined to treat

CLOCK: [2021-10-22 Fri 10:41]--[2021]

as a paragraph, not a clock line.

Best,
Ihor


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] "Cache corruption detected" when editing CLOCK timestamp by hand
  2021-11-23 12:34     ` [PATCH] " Ihor Radchenko
  2022-04-30  3:37       ` Ihor Radchenko
@ 2022-05-30 11:50       ` Ihor Radchenko
  2022-10-05  4:55         ` Ihor Radchenko
  1 sibling, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2022-05-30 11:50 UTC (permalink / raw)
  To: William Denton; +Cc: Nicolas Goaziou, emacs-orgmode

Ihor Radchenko <yantar92@gmail.com> writes:

>> Minimal reproducer:
>>
>> 1. Create an empty org file and open it
>> 2. Yank the following string: "CLOCK: [2021-10-22 Fri 10:41]--[2021]"
>> 3. M-: (org-element-at-point) <RET>
>
> The attached is tentative fix for cases like the above.

Applied onto main via 4dda0d7a8. This may also fix
https://list.orgmode.org/8735grjq2e.fsf@no.workgroup/T/#u

> Should we consider the above CLOCK line as a valid running clock or
> maybe it should be parsed as a paragraph?

I am still leaving this question open despite applying the above patch.
At least, we need to get the bug fixed.

Best,
Ihor


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] "Cache corruption detected" when editing CLOCK timestamp by hand
  2022-05-30 11:50       ` Ihor Radchenko
@ 2022-10-05  4:55         ` Ihor Radchenko
  0 siblings, 0 replies; 8+ messages in thread
From: Ihor Radchenko @ 2022-10-05  4:55 UTC (permalink / raw)
  To: William Denton; +Cc: Nicolas Goaziou, emacs-orgmode

Ihor Radchenko <yantar92@gmail.com> writes:

>> Should we consider the above CLOCK line as a valid running clock or
>> maybe it should be parsed as a paragraph?
>
> I am still leaving this question open despite applying the above patch.
> At least, we need to get the bug fixed.

I now made Org parse malformed CLOCK lines as paragraphs.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=e305755b1a7ac41c74ebf9a39e8b9d547acb523d

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-10-05  4:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-22 18:47 "Cache corruption detected" when editing CLOCK timestamp by hand William Denton
2021-10-22 18:56 ` William Denton
2021-10-23  3:34 ` Ihor Radchenko
2021-10-23  3:52   ` Ihor Radchenko
2021-11-23 12:34     ` [PATCH] " Ihor Radchenko
2022-04-30  3:37       ` Ihor Radchenko
2022-05-30 11:50       ` Ihor Radchenko
2022-10-05  4:55         ` Ihor Radchenko

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.