contrib/showstack.py
author Yuya Nishihara <yuya@tcha.org>
Mon, 07 Aug 2017 22:22:28 +0900
branchstable
changeset 33644 943c91326b23
parent 28522 f2fe7b199bb4
child 35656 c9eb92fb87b7
permissions -rw-r--r--
ssh: unban the use of pipe character in user@host:port string This vulnerability was fixed by the previous patch and there were more ways to exploit than using '|shellcmd'. So it doesn't make sense to reject only pipe character. Test cases are updated to actually try to exploit the bug. As the SSH bridge of git/svn subrepos are not managed by our code, the tests for non-hg subrepos are just removed. This may be folded into the original patches.

# showstack.py - extension to dump a Python stack trace on signal
#
# binds to both SIGQUIT (Ctrl-\) and SIGINFO (Ctrl-T on BSDs)

from __future__ import absolute_import
import signal
import sys
import traceback

def sigshow(*args):
    sys.stderr.write("\n")
    traceback.print_stack(args[1], limit=10, file=sys.stderr)
    sys.stderr.write("----\n")

def extsetup(ui):
    signal.signal(signal.SIGQUIT, sigshow)
    try:
        signal.signal(signal.SIGINFO, sigshow)
    except AttributeError:
        pass