On 2023-12-11 17:47 +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).
> `----

I now had a look at the histedit code, and it does this:

,----
|         with util.with_lc_ctype():
|             rc = curses.wrapper(functools.partial(_chisteditmain, repo, 
rules))
|         curses.echo()
|         curses.endwin()
`----

AFAICS, invoking curses.echo() and curses.endwin() is superfluous
because curses.wrapper already does that for you, and calling
curses.endwin() twice throws an error with the newer ncurses.  Removing
those two lines should fix the problem.

Cheers,
       Sven

Reply via email to