GothenburgBitFactory / timewarrior

Timewarrior - Commandline Time Tracking and Reporting
https://timewarrior.net
MIT License
1.25k stars 94 forks source link

Assertion `is_open () || end >= start #586

Open Spreadcat opened 8 months ago

Spreadcat commented 8 months ago

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:

lauft commented 8 months ago

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?

Spreadcat commented 8 months ago

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 commented 8 months ago

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.

lauft commented 8 months ago

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