Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ikhal crashes to create new events #1334

Closed
d4rios opened this issue Feb 8, 2024 · 12 comments · Fixed by urwid/urwid#798
Closed

Ikhal crashes to create new events #1334

d4rios opened this issue Feb 8, 2024 · 12 comments · Fixed by urwid/urwid#798

Comments

@d4rios
Copy link

d4rios commented Feb 8, 2024

Describe the bug

Hi,
When I try to create new events in ikhal, it crashes miserably.

If applicable: Stack Trace:
This is the output on my terminal

Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/khal/ui/init.py", line 1363, in start_pane
loop.run()
File "/usr/lib/python3.11/site-packages/urwid/event_loop/main_loop.py", line 343, in run
self._run()
File "/usr/lib/python3.11/site-packages/urwid/event_loop/main_loop.py", line 445, in _run
self.event_loop.run()
File "/usr/lib/python3.11/site-packages/urwid/event_loop/select_loop.py", line 182, in run
self._loop()
File "/usr/lib/python3.11/site-packages/urwid/event_loop/select_loop.py", line 218, in _loop
self._entering_idle()
File "/usr/lib/python3.11/site-packages/urwid/event_loop/select_loop.py", line 171, in _entering_idle
callback()
File "/usr/lib/python3.11/site-packages/urwid/event_loop/main_loop.py", line 652, in entering_idle
self.draw_screen()
File "/usr/lib/python3.11/site-packages/urwid/event_loop/main_loop.py", line 669, in draw_screen
canvas = self._topmost_widget.render(self.screen_size, focus=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 112, in cached_render
canv = fn(self, size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/popup.py", line 118, in render
self._update_overlay(size, focus)
File "/usr/lib/python3.11/site-packages/urwid/widget/popup.py", line 91, in _update_overlay
canv = self._original_widget.render(size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 112, in cached_render
canv = fn(self, size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/frame.py", line 408, in render
body = self.body.render((maxcol, maxrow - ftrim - htrim), focus and self.focus_part == "body")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 112, in cached_render
canv = fn(self, size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/columns.py", line 938, in render
w.render(w_size, focus=focus and self.focus_position == i),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 112, in cached_render
canv = fn(self, size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/khal/ui/widgets.py", line 672, in render
return super().render(size, focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 112, in cached_render
canv = fn(self, size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 718, in render
canv = get_delegate(self).render(size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 112, in cached_render
canv = fn(self, size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/pile.py", line 817, in render
canv = w.render(w_size, focus=focus and item_focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 112, in cached_render
canv = fn(self, size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/columns.py", line 938, in render
w.render(w_size, focus=focus and self.focus_position == i),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 112, in cached_render
canv = fn(self, size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 718, in render
canv = get_delegate(self).render(size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 112, in cached_render
canv = fn(self, size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/listbox.py", line 640, in render
canvas = widget.render((maxcol,))
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 112, in cached_render
canv = fn(self, size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 718, in render
canv = get_delegate(self).render(size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 112, in cached_render
canv = fn(self, size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/pile.py", line 817, in render
canv = w.render(w_size, focus=focus and item_focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 112, in cached_render
canv = fn(self, size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/columns.py", line 938, in render
w.render(w_size, focus=focus and self.focus_position == i),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 112, in cached_render
canv = fn(self, size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 718, in render
canv = get_delegate(self).render(size, focus=focus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 113, in cached_render
validate_size(self, size, canv)
File "/usr/lib/python3.11/site-packages/urwid/widget/widget.py", line 92, in validate_size
raise WidgetError(
urwid.widget.widget.WidgetError: Widget <Padding selectable fixed/flow widget <CalendarPopUp selectable flow widget > right=1 width=11> rendered (11 x 1) canvas when passed size (10,)!

Expected behavior
A clear and concise description of what you expected to happen.

That new events in ikhal can be created.

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

The output of khal --version: 0.11.2: 
Installation method: pacman
python version: Python 3.11.6
OS: Archlinux 2024.02.01
Your khal config file:

[calendars]

[[Casa]]
path = ~/.calendars/6C43D0F9-7DE6-4D08-BE77-5A8FC3C30429
type = discover
color = light red

[[Personal]]
path = ~/.calendars/D411412F-AA58-4602-8D3B-4C9AC6FBE4C5
type = discover
color = light green

[[Trabajo]]
path = ~/.calendars/154B5BEC-34AF-43A8-B23B-1D171FFE8A5F
type = discover
color = dark blue

[[Planning]]
path = ~/.calendars/A462C994-F46D-4AF9-8EE0-120104BD5D67
type = discover
color = light cyan

[locale]
firstweekday = 0
timeformat = %H:%M
dateformat = %d/%m/%Y
longdateformat = %d/%m/%Y
datetimeformat = %d/%m/%Y %H:%M
longdatetimeformat = %d/%m/%Y %H:%M

[default]
default_calendar = D411412F-AA58-4602-8D3B-4C9AC6FBE4C5
highlight_event_days = True

[highlight_days]
color = light magenta
method = fg

[view]
dynamic_days = True
frame = color

Thanks

@d4rios d4rios changed the title Ikhal crushes to create new events Ikhal crashes to create new events Feb 9, 2024
@d4rios
Copy link
Author

d4rios commented Feb 10, 2024

Sorry for that.
Updating urwid to 2.4.1 versión my problem is gone. Ikhal is now working properly.
Thank you in advance and I hope you will take this into account for future versions.

@andrewferrier
Copy link

I have the exact same issue (same error message), however for me using python-urwid 2.5.1 triggers the problem. If I downgrade to 2.4.1, then I can add events without the issue.

@dvzrv
Copy link

dvzrv commented Feb 12, 2024

Hi! I have just opened a downstream issue about this, since with python-urwid 2.5.1-1 on Arch Linux khal is now broken: https://gitlab.archlinux.org/archlinux/packaging/packages/python-urwid/-/issues/1

@dvzrv
Copy link

dvzrv commented Feb 12, 2024

Pinging @penguinolog for good measure (in case this has been triggered by a regression in urwid).

@penguinolog
Copy link

debugging, looks weird

@WhyNotHugo
Copy link
Member

I'm pretty sure that this was fixed in master a few weeks ago.

@penguinolog
Copy link

penguinolog commented Feb 12, 2024

I'm pretty sure that this was fixed in master a few weeks ago.

No, regression present and not covered by tests. Fix will be done ASAP (today) with extra tests for such scenario.
Shrot details:
Padding widget incorrectly calculate render size for Selectable Flow when no padding needed (input widget using full width).

UP: extra details: this happend, when Padding configured for bigger width, than in arguments for render:
khal request Padding over widget with fixed width = 11 and then render with width = 10.

penguinolog pushed a commit to penguinolog/urwid that referenced this issue Feb 12, 2024
Allow to render `Padding` with GIVEN width > size.
Produce a log message (not warning to not confuse end users)

Fix: pimutils/khal#1334
@penguinolog
Copy link

Technically urwid should not crash if behavior was supported before.
Last refactoring exposed a lot of incorrect usage cases, which worked due to skipped validation (even if correct usage was explained many years ago).
I see #1328 fix in khal, but other packages with the same issues may be available.

penguinolog pushed a commit to penguinolog/urwid that referenced this issue Feb 12, 2024
Allow to render `Padding` with GIVEN width > size.
Warn about incorrect size

Fix: pimutils/khal#1334
@dvzrv
Copy link

dvzrv commented Feb 12, 2024

I'm pretty sure that this was fixed in master a few weeks ago.

It would be great to see a release for this fix!
In the meantime this has been patched on the downstream khal package: https://gitlab.archlinux.org/archlinux/packaging/packages/khal/-/commit/8b110226353dbb8caec2c06184df541da01386da

@penguinolog Thanks for the investigation and background info!

penguinolog added a commit to urwid/urwid that referenced this issue Feb 12, 2024
Allow to render `Padding` with GIVEN width > size.
Warn about incorrect size

Fix: pimutils/khal#1334

Co-authored-by: Aleksei Stepanov <[email protected]>
@penguinolog
Copy link

Urwid 2.5.3 was released specially for this case.
(BTW, new khal release with #1328 will be great)

@geier
Copy link
Member

geier commented Feb 12, 2024

Should be fixed with https://github.com/pimutils/khal/releases/tag/v0.11.3

@geier
Copy link
Member

geier commented Feb 12, 2024

@penguinolog thanks for taking care of this in urwid!

@geier geier closed this as completed Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants