Wed, 12 Apr 2017 11:23:55 -0700 dispatch: protect against malicious 'hg serve --stdio' invocations (sec) stable 4.1.3
Augie Fackler <augie@google.com> [Wed, 12 Apr 2017 11:23:55 -0700] rev 32050
dispatch: protect against malicious 'hg serve --stdio' invocations (sec) Some shared-ssh installations assume that 'hg serve --stdio' is a safe command to run for minimally trusted users. Unfortunately, the messy implementation of argument parsing here meant that trying to access a repo named '--debugger' would give the user a pdb prompt, thereby sidestepping any hoped-for sandboxing. Serving repositories over HTTP(S) is unaffected. We're not currently hardening any subcommands other than 'serve'. If your service exposes other commands to users with arbitrary repository names, it is imperative that you defend against repository names of '--debugger' and anything starting with '--config'. The read-only mode of hg-ssh stopped working because it provided its hook configuration to "hg serve --stdio" via --config parameter. This is banned for security reasons now. This patch switches it to directly call ui.setconfig(). If your custom hosting infrastructure relies on passing --config to "hg serve --stdio", you'll need to find a different way to get that configuration into Mercurial, either by using ui.setconfig() as hg-ssh does in this patch, or by placing an hgrc file someplace where Mercurial will read it. mitrandir@fb.com provided some extra fixes for the dispatch code and for hg-ssh in places that I overlooked.
Thu, 13 Apr 2017 22:31:17 +0900 progress: retry ferr.flush() and .write() on EINTR (issue5532)
Yuya Nishihara <yuya@tcha.org> [Thu, 13 Apr 2017 22:31:17 +0900] rev 32049
progress: retry ferr.flush() and .write() on EINTR (issue5532) See the inline comment how this could mitigate the issue. I couldn't reproduce the exact problem on my Linux machine, but there are at least two people who got EINTR in progress.py, and it seems file_write() of Python 2 is fundamentally broken [1]. Let's make something in on 4.2. [1]: https://hg.python.org/cpython/file/v2.7.13/Objects/fileobject.c#l1850
Thu, 13 Apr 2017 22:27:25 +0900 progress: extract stubs to restart ferr.flush() and .write() on EINTR
Yuya Nishihara <yuya@tcha.org> [Thu, 13 Apr 2017 22:27:25 +0900] rev 32048
progress: extract stubs to restart ferr.flush() and .write() on EINTR
Sat, 25 Feb 2017 19:36:02 +0900 filemerge: optionally strip quotes from merge marker template (BC)
Yuya Nishihara <yuya@tcha.org> [Sat, 25 Feb 2017 19:36:02 +0900] rev 32047
filemerge: optionally strip quotes from merge marker template (BC) For consistency with the other template options. Quotes are necessary if you want to preserve leading/trailing whitespace, which would be stripped by config parser.
Sat, 25 Feb 2017 19:32:39 +0900 commit: optionally strip quotes from commit template (BC)
Yuya Nishihara <yuya@tcha.org> [Sat, 25 Feb 2017 19:32:39 +0900] rev 32046
commit: optionally strip quotes from commit template (BC) For consistency with the other template options.
Sat, 25 Feb 2017 19:28:16 +0900 graphlog: optionally strip quotes from graphnode template (BC)
Yuya Nishihara <yuya@tcha.org> [Sat, 25 Feb 2017 19:28:16 +0900] rev 32045
graphlog: optionally strip quotes from graphnode template (BC) For consistency with the other template options.
Mon, 17 Apr 2017 23:53:19 +0900 dispatch: ignore further SIGPIPE while handling KeyboardInterrupt
Yuya Nishihara <yuya@tcha.org> [Mon, 17 Apr 2017 23:53:19 +0900] rev 32044
dispatch: ignore further SIGPIPE while handling KeyboardInterrupt I got the following error by running "hg log" and quitting the pager immediately. Any output here may trigger another SIGPIPE, so only thing we can do is to swallow the exception and exit with an error status. Traceback (most recent call last): File "./hg", line 45, in <module> mercurial.dispatch.run() File "mercurial/dispatch.py", line 83, in run status = (dispatch(req) or 0) & 255 File "mercurial/dispatch.py", line 167, in dispatch req.ui.warn(_("interrupted!\n")) File "mercurial/ui.py", line 1224, in warn self.write_err(*msg, **opts) File "mercurial/ui.py", line 790, in write_err self._write_err(*msgs, **opts) File "mercurial/ui.py", line 798, in _write_err self.ferr.write(a) File "mercurial/ui.py", line 129, in _catchterm raise error.SignalInterrupt mercurial.error.SignalInterrupt Perhaps this wasn't visible before de5c9d0e02ea because the original stderr handle was restored very late.
Sat, 15 Apr 2017 13:04:55 +0900 worker: print traceback for uncaught exception unconditionally
Yuya Nishihara <yuya@tcha.org> [Sat, 15 Apr 2017 13:04:55 +0900] rev 32043
worker: print traceback for uncaught exception unconditionally This is what a Python interpreter would do if there were no os._exit().
Sat, 15 Apr 2017 13:27:44 +0900 worker: propagate exit code to main process
Yuya Nishihara <yuya@tcha.org> [Sat, 15 Apr 2017 13:27:44 +0900] rev 32042
worker: propagate exit code to main process Follows up 86cd09bc13ba.
Sat, 15 Apr 2017 13:02:34 +0900 dispatch: print traceback in scmutil.callcatch() if --traceback specified
Yuya Nishihara <yuya@tcha.org> [Sat, 15 Apr 2017 13:02:34 +0900] rev 32041
dispatch: print traceback in scmutil.callcatch() if --traceback specified Otherwise, traceback wouldn't be printed for a known exception occurred in worker processes.
(0) -30000 -10000 -3000 -1000 -300 -100 -10 +10 +100 +300 +1000 +3000 +10000 tip