On Mon, Dec 11, 2023 at 05:47:23PM +0100, Sven Joachim wrote:
> On 2023-12-11 16:22 +0100, Julien Cristau wrote:
> 
> > Source: ncurses
> > Version: 6.4+20231121-1
> > Severity: important
> > Control: affects -1 mercurial
> > X-Debbugs-Cc: jcris...@debian.org
> >
> > Hi,
> >
> > Since a ncurses upgrade in testing recently `hg histedit` seems to
> > crash consistently, upon trying to apply the changes:
> >
> >> Traceback (most recent call last):
> >>   File "/usr/bin/hg", line 59, in <module>
> >>     dispatch.run()
> >>   File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 142, 
> >> in run
> >>     status = dispatch(req)
> >>              ^^^^^^^^^^^^^
> >>   File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 231, 
> >> in dispatch
> >>     status = _rundispatch(req)
> >>              ^^^^^^^^^^^^^^^^^
> >>   File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 275, 
> >> in _rundispatch
> >>     ret = _runcatch(req) or 0
> >>           ^^^^^^^^^^^^^^
> >>   File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 456, 
> >> in _runcatch
> >>     return _callcatch(ui, _runcatchfunc)
> >>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >>   File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 466, 
> >> in _callcatch
> >>     return scmutil.callcatch(ui, func)
> >>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >>   File "/usr/lib/python3/dist-packages/mercurial/scmutil.py", line 152, in 
> >> callcatch
> >>     return func()
> >>            ^^^^^^
> >>   File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 446, 
> >> in _runcatchfunc
> >>     return _dispatch(req)
> >>            ^^^^^^^^^^^^^^
> >>   File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 1271, 
> >> in _dispatch
> >>     return runcommand(
> >>            ^^^^^^^^^^^
> >>   File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 904, 
> >> in runcommand
> >>     ret = _runcommand(ui, options, cmd, d)
> >>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >>   File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 1283, 
> >> in _runcommand
> >>     return cmdfunc()
> >>            ^^^^^^^^^
> >>   File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 1269, 
> >> in <lambda>
> >>     d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
> >>                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >>   File "/usr/lib/python3/dist-packages/mercurial/util.py", line 1878, in 
> >> check
> >>     return func(*args, **kwargs)
> >>            ^^^^^^^^^^^^^^^^^^^^^
> >>   File "/usr/lib/python3/dist-packages/hgext/histedit.py", line 1918, in 
> >> histedit
> >>     return _chistedit(ui, repo, freeargs, opts)
> >>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >>   File "/usr/lib/python3/dist-packages/hgext/histedit.py", line 1764, in 
> >> _chistedit
> >>     curses.endwin()
> >> _curses.error: endwin() returned ERR
> 
> I am not familiar with Mercurial, but most likely this has been
> triggered by the following change in the 2023111 patchlevel:
> 
> ,----
> | 20231111
> |     + modify endwin() to return an error if it is called again without an
> |       intervening screen update (report by Rajeev Pillai, NetBSD #57592).
> `----
> 
> NetBSD #57592 is
> https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=57592 .

sounds plausible.  fwiw, handling error returns (other than throwing an
exception) is something that developers should do.

I suspect that making ncurses not return error-codes is a step in the wrong
direction.  The example in the NetBSD bug report was clearly a defect in
the application using ncurses.

In this case, I chose to make it behave like SVr4 curses.  Explaining this
nicely in a portability section of the manpage is still on my to-do list,
but it's clear in the note that I made.  NetBSD curses returns no error,
but it's based on some code to handle SIGTSTP.

-- 
Thomas E. Dickey <dic...@invisible-island.net>
https://invisible-island.net

Attachment: signature.asc
Description: PGP signature

Reply via email to