taskwarrior-tui icon indicating copy to clipboard operation
taskwarrior-tui copied to clipboard

Reimplement projects name without using `task summary`

Open lucaschamorrotuduri opened this issue 4 years ago • 10 comments
trafficstars

Hi! It's me again. This time the application panics.

The good news is that I've narrowed it down to a single task, thanks to divide and conquer. My guess is the acute accent in "Lógica" in the project name. If I remove the accent, taskwarrior-tui works again. I've attached data.zip with good.data and bad.data, both containing the same task, but bad.data has "CNC.Lógica" as the project name and good.data has "CNC.Logica" as its project name: data.zip

The following stacktrace is produced:

$ taskwarrior-tui --version
taskwarrior-tui 0.14.8

$ RUST_BACKTRACE=full taskwarrior-tui
Backtrace (most recent call first):
  File "<unknown>", line 0, in __libc_start_main

The application panicked (crashed).
  called `Result::unwrap()` on an `Err` value: ParseIntError { kind: Empty }
in src/pane/project.rs, line 144
thread: main

Taskwarrior behaves normally:

$ task --version
2.6.1

$ task next

ID Age   Project    Tag   Description              Urg
 1 10w   CNC.Lógica T cnc Implementar el algoritmo 2.29

1 task

It happens on version 0.14.6 from the Arch repo and the git version 0.14.8. The OS is Artix Linux.

lucaschamorrotuduri avatar Nov 04 '21 09:11 lucaschamorrotuduri

I also have a crash, although just in the previous line :)

➜  ~ RUST_BACKTRACE=full taskwarrior-tui~ 
  File "rust:library/std/src/thread/local.rs", line 375, in std::thread::local::LocalKey<T>::with
  File "/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/builder.rs", line 161, in async_std::task::builder::Builder::blocking
  File "/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/block_on.rs", line 33, in async_std::task::block_on::block_on
  File "/home/runner/work/taskwarrior-tui/taskwarrior-tui/src/main.rs", line 68, in taskwarrior_tui::main
  File "rust:library/core/src/ops/function.rs", line 227, in core::ops::function::FnOnce::call_once
  File "rust:library/std/src/sys_common/backtrace.rs", line 125, in std::sys_common::backtrace::__rust_begin_short_backtrace

The application panicked (crashed).
  byte index 16 is out of bounds of `life`
in src/pane/project.rs, line 143
thread: main

Petemir avatar Nov 08 '21 14:11 Petemir

Can you both share the output of task summary?

kdheepak avatar Nov 08 '21 14:11 kdheepak

Project         Remaining Avg age Complete 0%                        100%
life                   18      4w      79%                               
  italian               1     6mo       0%                               
  chores                9      2w      84%                               
  books                 8     4mo      20%                               
research               18     12d      74%                               
  zettelkasten          3      6w      50%                               
  recall                4      2w      71%                               
    har_journal         3     12w       0%                               
    har                 1      2w      80%                               
  student_group         7      2w      22%                               
    protocol            2      5d       0%                               
    docs                3      3w      40%                               
    devices             2      5d       0%                               
                

summary.txt

edit: fyi, I had this problem with v2.5.3 of Taskwarrior. Now I installed v2.6.1 and I have other problems, will do a reboot just in case and see if they persist, and report if it is needed :) .

Petemir avatar Nov 08 '21 14:11 Petemir

Thanks for sharing the task summary. Yeah, only the latest taskwarrior version is well supported. Older versions of taskwarrior are supported at a “best effort” level. Can you try with the latest version and let me know what happens? And please report any issues!

kdheepak avatar Nov 08 '21 15:11 kdheepak

Sorry, you can omit my crash then as it was fixed with taskwarrior 2.6.1 :) (but the OP one would still remain). The other issue I had was from a dirty shell environment, solved by a reboot.

(I do have to re-check a context issue though, as switching contexts in taskwarrior-tui shows me the same tasks, but if I change the context via task context X and then show the tasks, they are different.)

Petemir avatar Nov 08 '21 15:11 Petemir

The context issue might be related to what is going on in #318

kdheepak avatar Nov 08 '21 15:11 kdheepak

Dunno if you still need it, but:

$ task --version
2.6.1

$ task summary

Project      Remaining Avg age Complete 0%                        100%
(none)              22      7d      91%
CNC                  3      4w      57%
  Lógica             3      4w      57%
Discrete             6      2w      57%
Optimization
  Mochila            3      3w      62%
PIC                  4     9mo      50%
  LEDBlinker         4     9mo      50%
Parcial             14      2w      22%
Laminar
TFM                  2      5w      81%
  Fotodiodo          2     10w      60%
Tendedero            2      7w      50%

11 projects

lucaschamorrotuduri avatar Nov 08 '21 22:11 lucaschamorrotuduri

I made a new release that should prevent taskwarrior-tui from crashing. You can try it out here: https://github.com/kdheepak/taskwarrior-tui/releases/tag/v0.14.9

However, I think I have to reimplement the projects pane entirely. I think the output of task summary may just be too complicated to parse reliably. So I'll leave this issue open, and rename it appropriately.

kdheepak avatar Nov 09 '21 11:11 kdheepak

To build the project representation, can you use a hash map from project names to a structure recording information for that project, like parent, children, number of tasks, number of subtasks, etc?

bradyt avatar Feb 16 '22 02:02 bradyt

Yeah that’d be the way to do it! But I’m swamped with work at the moment and can’t devote any time to any significant changes for a little while. Happy to review PRs from anyone though :)

kdheepak avatar Feb 16 '22 02:02 kdheepak