[Bug 6614] New: "hg show work" silently fails on Windows when running through MSYS/Cygwin

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Thu Nov 25 20:49:29 UTC 2021


https://bz.mercurial-scm.org/show_bug.cgi?id=6614

            Bug ID: 6614
           Summary: "hg show work" silently fails on Windows when running
                    through MSYS/Cygwin
           Product: Mercurial
           Version: stable branch
          Hardware: PC
                OS: Windows
            Status: UNCONFIRMED
          Severity: feature
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at mercurial-scm.org
          Reporter: mhentges at mozilla.com
                CC: mercurial-devel at mercurial-scm.org
    Python Version: ---

To reproduce:
1. Install MSYS2 (https://www.msys2.org/)
2. Start the MSYS2 shell
3. `pacman -S python-pip gcc libcrypt-devel`
4. `pip install mercurial`
5. Rename /usr/bin/more.exe (e.g. to /usr/bin/more.exe.bak)
6. Go to an hg repo and run `hg show work`

HG will silently fail.

-----

What's going on under-the-hood is that HG's default pager is `more`, but if it
falls back to `C:\Windows\System32\more.com`, then the process halts (without
error) at this line:
https://www.mercurial-scm.org/repo/hg/file/6.0/mercurial/ui.py#l1527

The PDB backtrace is:
(Pdb) bt
  <python3>\lib\bdb.py(578)run()
-> exec(cmd, globals, locals)
  <string>(1)<module>()
  <python3>\scripts\hg(61)<module>()
-> dispatch.run()
  <python3>\lib\site-packages\mercurial\dispatch.py(144)run()
-> status = dispatch(req)
  <python3>\lib\site-packages\mercurial\dispatch.py(250)dispatch()
-> status = _rundispatch(req)
  <python3>\lib\site-packages\mercurial\dispatch.py(294)_rundispatch()
-> ret = _runcatch(req) or 0
  <python3>\lib\site-packages\mercurial\dispatch.py(470)_runcatch()
-> return _callcatch(ui, _runcatchfunc)
  <python3>\lib\site-packages\mercurial\dispatch.py(480)_callcatch()
-> return scmutil.callcatch(ui, func)
  <python3>\lib\site-packages\mercurial\scmutil.py(153)callcatch()
-> return func()
  <python3>\lib\site-packages\mercurial\dispatch.py(460)_runcatchfunc()
-> return _dispatch(req)
  <python3>\lib\site-packages\mercurial\dispatch.py(1274)_dispatch()
-> lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions
  <python3>\lib\site-packages\mercurial\dispatch.py(918)runcommand()
-> ret = _runcommand(ui, options, cmd, d)
  <python3>\lib\site-packages\mercurial\dispatch.py(1285)_runcommand()
-> return cmdfunc()
  <python3>\lib\site-packages\mercurial\dispatch.py(1271)<lambda>()
-> d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
  <python3>\lib\site-packages\mercurial\util.py(1888)check()
-> return func(*args, **kwargs)
  <python3>\lib\site-packages\hgext\show.py(155)show()
-> ui.pager(b'show')
  <python3>\lib\site-packages\mercurial\ui.py(1453)pager()
-> if self._runpager(pagercmd, pagerenv):
  <python3>\lib\site-packages\mercurial\ui.py(1527)_runpager()
-> os.dup2(pager.stdin.fileno(), procutil.stderr.fileno())

-----

Other fun details
* It works properly in the Command Prompt and Windows Terminal
* Running MSYS2 with `SET MSYS=enable_pcon` ("hey, leverage Windows' new ConPTY
feature") doesn't resolve the issue
* I don't know enough about fileno's to understand why the python process just
ends without ceremony - no error, no fanfare, just bumped back to the prompt
* This bug report's details were created against hg 6.0, but I couldn't specify
such with the `Version` field because 6.0 is hot off the presses. However, this
isn't a regression, and has been around since 5.9.3 for sure, and back to the
early 5.x releases.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list