timewarrior icon indicating copy to clipboard operation
timewarrior copied to clipboard

Assertion `is_open () || end >= start

Open Spreadcat opened this issue 1 year ago • 4 comments

Hi there,

What Version
Timewarrior 1.7.0
OS Fedora 39
Python 3.11.7

Under certain conditions and not related all commands, I get an error message as output. For Example:

When I run timew s :week :ids I should get the normal summary output. Instead I get

$ timew s :week :ids
timew: /builddir/build/BUILD/timew-1.7.0/src/Range.cpp:358: time_t Range::total() const: Assertion `is_open () || end >= start' failed.
Aborted (core dumped)

More information:

  • As soon as I drop :week, the command is working.
  • If I replace :week with :lastweek, the command is working. I could not find any other way to reproduce the problem than to include :week.
  • I can reproduce the same error on a different machine with package version.
  • The problem is persistent in 1.4.3 as well.
  • I cleared the timewarrior.cfg file of any entries and the error persists.

Spreadcat avatar Jan 18 '24 14:01 Spreadcat

It would be good to know the "certain conditions" that led to the error.

Can you provide the steps to reproduce it? What is the output when you add the :debug hint to the failing command?

lauft avatar Jan 20 '24 08:01 lauft

I know "certain conditions" would came back right at me. I meant the situation where I inlcude ":week" into the command. I'll test this on a container and provide steps on how to reproduce.

The output with the ":debug" attached

$ tm s :week :debug
CLI Parser
  _original_args
    timew s :week :debug
  _args
    word basename='timew' raw='timew' BINARY 
    word canonical='summary' raw='s' ORIGINAL EXT 
    word canonical=':week' raw=':week' ORIGINAL HINT FILTER 
    word canonical=':debug' raw=':debug' ORIGINAL HINT FILTER 

>> Hint :day expanded to 2024-01-20T00:00:00 - 2024-01-21T00:00:00
>> Hint :week expanded to 2024-01-15T00:00:00 - 2024-01-22T00:00:00
>> 2024-01.data: 41 intervals
>> Loaded 18 tracked intervals
timew: /builddir/build/BUILD/timew-1.7.0/src/Range.cpp:358: time_t Range::total() const: Assertion `is_open () || end >= start' failed.
Aborted (core dumped)

Spreadcat avatar Jan 20 '24 16:01 Spreadcat

I think I found a way to reproduce the issue:

with this data (only two lines required) the issue can be reproduced:

inc 20240116T181659Z - 20240116T151438Z # work
inc 20240117T073000Z - 20240117T150352Z # work

The issue is that the first line contains a timestamp earlier than the starting time. I'm not sure how I ended up with this line. I certainly cannot exclude any manual editing of the file, though -> Then I am probably the one to blame for this error.

Since I now know now how to find and fix this problem, I guess the issue can be closed. Alternatively you can use this to add a check/error-message to check for this constelation, caused by idiots like me typing in the wrong timestamps manually.

Spreadcat avatar Jan 20 '24 19:01 Spreadcat

Adding a error message with a hint to this probable cause might be something to consider... 🤔

lauft avatar Jan 21 '24 14:01 lauft