pimutils / pimutils/khal

Invalid value for field alarm when using khal new -i leads to crash

Open
#1,391 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
Python
Stars
3.1k
Forks
233
Avg merge
1h 44m
Merged PRs (30d)
1

Description

Describe the bug
Invalid value for field alarm when using khal new -i leads to crash.

If applicable: Stack Trace

Traceback (most recent call last):
  File "/nix/store/2ksnys3k9gfvfd864d2cqybzm18qbwa2-khal-0.11.3/bin/.khal-wrapped", line 9, in <module>
    sys.exit(main_khal())
             ^^^^^^^^^^^
  File "/nix/store/9l7cdymnw9ck7l7hk1d7n6yc2ql3a0j0-python3.12-click-8.1.7/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/9l7cdymnw9ck7l7hk1d7n6yc2ql3a0j0-python3.12-click-8.1.7/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/nix/store/9l7cdymnw9ck7l7hk1d7n6yc2ql3a0j0-python3.12-click-8.1.7/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/9l7cdymnw9ck7l7hk1d7n6yc2ql3a0j0-python3.12-click-8.1.7/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/9l7cdymnw9ck7l7hk1d7n6yc2ql3a0j0-python3.12-click-8.1.7/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/9l7cdymnw9ck7l7hk1d7n6yc2ql3a0j0-python3.12-click-8.1.7/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/2ksnys3k9gfvfd864d2cqybzm18qbwa2-khal-0.11.3/lib/python3.12/site-packages/khal/cli.py", line 393, in new
    new_func(
  File "/nix/store/2ksnys3k9gfvfd864d2cqybzm18qbwa2-khal-0.11.3/lib/python3.12/site-packages/khal/controllers.py", line 378, in new_interactive
    edit_event(event, collection, conf['locale'], width=term_width)
  File "/nix/store/2ksnys3k9gfvfd864d2cqybzm18qbwa2-khal-0.11.3/lib/python3.12/site-packages/khal/controllers.py", line 535, in edit_event
    alarm_trig = -1 * parse_datetime.guesstimedeltafstr(a.strip())
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/2ksnys3k9gfvfd864d2cqybzm18qbwa2-khal-0.11.3/lib/python3.12/site-packages/khal/parse_datetime.py", line 296, in guesstimedeltafstr
    raise ValueError(f'Invalid beginning of timedelta string "{delta_string}": "{tups[0]}"')
ValueError: Invalid beginning of timedelta string "alarm": "alarm"

To Reproduce

khal new -i
summary: test3
datetime range: now tomorrow
timezone [Europe/Berlin]: 
description (or 'None'): None
event saved
Edit?  do[n]e  [s]ummary  [d]escription  da[t]etime range  re[p]eat  [l]ocation  [c]ategories  [a]larm  [D]elete  [u]rl: a
alarm (or "None") [None]: alarm

OS, version, khal version and how you installed it:

  • khal, version 0.11.3
  • Python 3.12.7
  • OS: NixOS
  • installed via nixpkgs (nix-shell -p khal)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in khal/controllers.py at edit_event and follow its call to parse_datetime.py:guesstimedeltafstr. Reproduce the issue with khal new -i and an invalid alarm value; done means that input is handled without an unhandled traceback, with the expected behavior established from the surrounding code.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.