# HG changeset patch # User Mateusz Kwapich # Date 1458691511 25200 # Node ID b732e7f2aba4c4c417278c7c7488006301551855 # Parent cdda7b96afff3433eafdeeb83ded83a5b25b7a5b convert: dead code removal - old git calling functions (SEC) CVE-2016-3069 (3/5) diff -r cdda7b96afff -r b732e7f2aba4 hgext/convert/git.py --- a/hgext/convert/git.py Tue Mar 22 17:05:11 2016 -0700 +++ b/hgext/convert/git.py Tue Mar 22 17:05:11 2016 -0700 @@ -30,23 +30,6 @@ # cannot remove environment variable. Just assume none have # both issues. if util.safehasattr(os, 'unsetenv'): - def gitopen(self, s, err=None): - prevgitdir = os.environ.get('GIT_DIR') - os.environ['GIT_DIR'] = self.path - try: - if err == subprocess.PIPE: - (stdin, stdout, stderr) = util.popen3(s) - return stdout - elif err == subprocess.STDOUT: - return self.popen_with_stderr(s) - else: - return util.popen(s, 'rb') - finally: - if prevgitdir is None: - del os.environ['GIT_DIR'] - else: - os.environ['GIT_DIR'] = prevgitdir - def gitpipe(self, s): prevgitdir = os.environ.get('GIT_DIR') os.environ['GIT_DIR'] = self.path @@ -59,15 +42,6 @@ os.environ['GIT_DIR'] = prevgitdir else: - def gitopen(self, s, err=None): - if err == subprocess.PIPE: - (sin, so, se) = util.popen3('GIT_DIR=%s %s' % (self.path, s)) - return so - elif err == subprocess.STDOUT: - return self.popen_with_stderr(s) - else: - return util.popen('GIT_DIR=%s %s' % (self.path, s), 'rb') - def gitpipe(self, s): return util.popen3('GIT_DIR=%s %s' % (self.path, s)) @@ -86,16 +60,6 @@ def gitrunlines(self, *args, **kwargs): return self._gitcmd(self.runlines, *args, **kwargs) - def popen_with_stderr(self, s): - p = subprocess.Popen(s, shell=True, bufsize=-1, - close_fds=util.closefds, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - universal_newlines=False, - env=None) - return p.stdout - def gitread(self, s): fh = self.gitopen(s) data = fh.read()