The following issues were found

src/third_party/wiredtiger/test/3rdparty/python-subunit-0.0.16/python/subunit/__init__.py
210 issues
subprocess call with shell=True identified, security issue.
Security injection

Line: 916
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b602_subprocess_popen_with_shell_equals_true.html

              
    def _run(self, result):
        protocol = TestProtocolServer(result)
        process = subprocess.Popen(self.script, shell=True,
            stdout=subprocess.PIPE)
        make_stream_binary(process.stdout)
        output = process.communicate()[0]
        protocol.readFrom(BytesIO(output))


            

Reported by Bandit.

Starting a process with a shell, possible injection detected, security issue.
Security injection

Line: 1260
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b605_start_process_with_a_shell.html

                  """
    formatter = os.getenv("SUBUNIT_FORMATTER")
    if formatter:
        return os.popen(formatter, "w")
    else:
        stream = sys.stdout
        if sys.version_info > (3, 0):
            if safe_hasattr(stream, 'buffer'):
                stream = stream.buffer

            

Reported by Bandit.

Unable to import 'extras'
Error

Line: 129 Column: 1

              except ImportError:
    _UnsupportedOperation = AttributeError

from extras import safe_hasattr
from testtools import content, content_type, ExtendedToOriginalDecorator
from testtools.content import TracebackContent
from testtools.compat import _b, _u, BytesIO, StringIO
try:
    from testtools.testresult.real import _StringException

            

Reported by Pylint.

Unable to import 'testtools'
Error

Line: 130 Column: 1

                  _UnsupportedOperation = AttributeError

from extras import safe_hasattr
from testtools import content, content_type, ExtendedToOriginalDecorator
from testtools.content import TracebackContent
from testtools.compat import _b, _u, BytesIO, StringIO
try:
    from testtools.testresult.real import _StringException
    RemoteException = _StringException

            

Reported by Pylint.

Unable to import 'testtools.content'
Error

Line: 131 Column: 1

              
from extras import safe_hasattr
from testtools import content, content_type, ExtendedToOriginalDecorator
from testtools.content import TracebackContent
from testtools.compat import _b, _u, BytesIO, StringIO
try:
    from testtools.testresult.real import _StringException
    RemoteException = _StringException
except ImportError:

            

Reported by Pylint.

Unable to import 'testtools.compat'
Error

Line: 132 Column: 1

              from extras import safe_hasattr
from testtools import content, content_type, ExtendedToOriginalDecorator
from testtools.content import TracebackContent
from testtools.compat import _b, _u, BytesIO, StringIO
try:
    from testtools.testresult.real import _StringException
    RemoteException = _StringException
except ImportError:
    raise ImportError ("testtools.testresult.real does not contain "

            

Reported by Pylint.

Unable to import 'testtools'
Error

Line: 139 Column: 1

              except ImportError:
    raise ImportError ("testtools.testresult.real does not contain "
        "_StringException, check your version.")
from testtools import testresult, CopyStreamResult

from subunit import chunked, details, iso8601, test_results
from subunit.v2 import ByteStreamToStreamResult, StreamResultToBytes

# same format as sys.version_info: "A tuple containing the five components of

            

Reported by Pylint.

Instance of '_ParserState' has no 'addUnexpectedSuccess' member
Error

Line: 275 Column: 17

                          elif cmd in self._xfail_sym:
                self.addExpectedFail(offset, line)
            elif cmd in self._uxsuccess_sym:
                self.addUnexpectedSuccess(offset, line)
            else:
                self.parser.stdOutLineReceived(line)
        else:
            self.parser.stdOutLineReceived(line)


            

Reported by Pylint.

Instance of '_ReadingDetails' has no '_report_outcome' member
Error

Line: 399 Column: 9

                      """The end of a details section has been reached."""
        self.parser._state = self.parser._outside_test
        self.parser.current_test_description = None
        self._report_outcome()
        self.parser.client.stopTest(self.parser._current_test)

    def lineReceived(self, line):
        """a line has been received."""
        self.details_parser.lineReceived(line)

            

Reported by Pylint.

Module 'sys' has no 'exec_info' member; maybe 'exc_info'?
Error

Line: 562 Column: 26

                          event_time = iso8601.parse_date(line[offset:-1])
        except TypeError:
            raise TypeError(_u("Failed to parse %r, got %r")
                % (line, sys.exec_info[1]))
        self.client.time(event_time)

    def lineReceived(self, line):
        """Call the appropriate local method for the received line."""
        self._state.lineReceived(line)

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/wttest.py
210 issues
Chmod setting a permissive mask 0o777 on file (NOT PARSED).
Security

Line: 515
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b103_set_bad_file_permissions.html

                          os.chdir(self.origcwd)

        # Make sure no read-only files or directories were left behind
        os.chmod(self.testdir, 0o777)
        for root, dirs, files in os.walk(self.testdir):
            for d in dirs:
                os.chmod(os.path.join(root, d), 0o777)
            for f in files:
                os.chmod(os.path.join(root, f), 0o666)

            

Reported by Bandit.

Chmod setting a permissive mask 0o777 on file (NOT PARSED).
Security

Line: 518
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b103_set_bad_file_permissions.html

                      os.chmod(self.testdir, 0o777)
        for root, dirs, files in os.walk(self.testdir):
            for d in dirs:
                os.chmod(os.path.join(root, d), 0o777)
            for f in files:
                os.chmod(os.path.join(root, f), 0o666)
        self.pr('passed=' + str(passed))
        self.pr('skipped=' + str(self.skipped))


            

Reported by Bandit.

Chmod setting a permissive mask 0o666 on file (NOT PARSED).
Security

Line: 520
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b103_set_bad_file_permissions.html

                          for d in dirs:
                os.chmod(os.path.join(root, d), 0o777)
            for f in files:
                os.chmod(os.path.join(root, f), 0o666)
        self.pr('passed=' + str(passed))
        self.pr('skipped=' + str(self.skipped))

        # Clean up unless there's a failure
        if (passed and (not WiredTigerTestCase._preserveFiles)) or self.skipped:

            

Reported by Bandit.

Unable to import 'wiredtiger'
Error

Line: 46 Column: 1

              
from contextlib import contextmanager
import errno, glob, os, re, shutil, sys, time, traceback
import wiredtiger, wtscenario, wthooks

def shortenWithEllipsis(s, maxlen):
    if len(s) > maxlen:
        s = s[0:maxlen-3] + '...'
    return s

            

Reported by Pylint.

No value for argument 's' in unbound method call
Error

Line: 113 Column: 13

                      """
        if self.hasUnexpectedOutput(testcase):
            contents = self.readFileFrom(self.filename, self.expectpos, 10000)
            WiredTigerTestCase.prout('ERROR: ' + self.filename +
                                     ' unexpected ' + self.desc +
                                     ', contains:\n"' + contents + '"')
            testcase.fail('unexpected ' + self.desc + ', contains: "' +
                      contents + '"')
        self.expectpos = os.path.getsize(self.filename)

            

Reported by Pylint.

Undefined variable 'ext'
Error

Line: 304 Column: 53

                              dirname, libname, 'libwiredtiger_*.so')
        filenames = glob.glob(pat)
        if len(filenames) > 1:
            raise Exception(self.shortid() + ": " + ext +
                ": multiple extensions libraries found matching: " + pat)
        return filenames

    # Return the wiredtiger_open extension argument for
    # any needed shared library.

            

Reported by Pylint.

Undefined variable 'self'
Error

Line: 304 Column: 29

                              dirname, libname, 'libwiredtiger_*.so')
        filenames = glob.glob(pat)
        if len(filenames) > 1:
            raise Exception(self.shortid() + ": " + ext +
                ": multiple extensions libraries found matching: " + pat)
        return filenames

    # Return the wiredtiger_open extension argument for
    # any needed shared library.

            

Reported by Pylint.

self.conn_extensions is not callable
Error

Line: 314 Column: 13

                      exts = self.conn_extensions
        if hasattr(exts, '__call__'):
            exts = ExtensionList()
            self.conn_extensions(exts)
        result = ''
        extfiles = {}
        skipIfMissing = False
        earlyLoading = ''
        if hasattr(exts, 'skip_if_missing'):

            

Reported by Pylint.

Instance of 'tuple' has no 'skip_if_missing' member
Error

Line: 320 Column: 29

                      skipIfMissing = False
        earlyLoading = ''
        if hasattr(exts, 'skip_if_missing'):
            skipIfMissing = exts.skip_if_missing
        if hasattr(exts, 'early_load_ext') and exts.early_load_ext == True:
            earlyLoading = '=(early_load=true)'
        for ext in exts:
            extconf = ''
            if '=' in ext:

            

Reported by Pylint.

Instance of 'ExtensionList' has no 'skip_if_missing' member
Error

Line: 320 Column: 29

                      skipIfMissing = False
        earlyLoading = ''
        if hasattr(exts, 'skip_if_missing'):
            skipIfMissing = exts.skip_if_missing
        if hasattr(exts, 'early_load_ext') and exts.early_load_ext == True:
            earlyLoading = '=(early_load=true)'
        for ext in exts:
            extconf = ''
            if '=' in ext:

            

Reported by Pylint.

src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tests/test_deferredruntest.py
204 issues
Unable to import 'extras'
Error

Line: 8 Column: 1

              import os
import signal

from extras import try_import

from testtools import (
    skipIf,
    TestCase,
    TestResult,

            

Reported by Pylint.

Instance of 'TestIntegration' has no 'runner' member
Error

Line: 105 Column: 64

              
        def test_runner(self):
            result = ExtendedTestResult()
            test = self.test_factory('test_something', runTest=self.runner)
            test.run(result)
            self.assertEqual(test.calls, self.test_factory.expected_calls)
            self.assertResultsMatch(test, result)



            

Reported by Pylint.

Instance of 'TestIntegration' has no 'test_factory' member
Error

Line: 105 Column: 20

              
        def test_runner(self):
            result = ExtendedTestResult()
            test = self.test_factory('test_something', runTest=self.runner)
            test.run(result)
            self.assertEqual(test.calls, self.test_factory.expected_calls)
            self.assertResultsMatch(test, result)



            

Reported by Pylint.

Instance of 'TestIntegration' has no 'test_factory' member
Error

Line: 107 Column: 42

                          result = ExtendedTestResult()
            test = self.test_factory('test_something', runTest=self.runner)
            test.run(result)
            self.assertEqual(test.calls, self.test_factory.expected_calls)
            self.assertResultsMatch(test, result)


def make_integration_tests():
    from unittest import TestSuite

            

Reported by Pylint.

Module 'twisted.internet.reactor' has no 'callLater' member
Error

Line: 236 Column: 9

                      runner = self.make_runner(test, timeout=timeout)
        result = self.make_result()
        reactor = self.make_reactor()
        reactor.callLater(timeout, fire_deferred)
        runner.run(result)
        self.assertThat(call_log, Equals(['setUp', marker, 'test']))

    def test_calls_setUp_test_tearDown_in_sequence(self):
        # setUp, the test method and tearDown can all return

            

Reported by Pylint.

Module 'twisted.internet.reactor' has no 'callLater' member
Error

Line: 279 Column: 9

                          self.assertThat(
                call_log, Equals(['setUp', 'a', 'test', 'b', 'tearDown']))
            c.callback(None)
        reactor.callLater(timeout * 0.25, fire_a)
        reactor.callLater(timeout * 0.5, fire_b)
        reactor.callLater(timeout * 0.75, fire_c)
        runner.run(result)
        self.assertThat(
            call_log, Equals(['setUp', 'a', 'test', 'b', 'tearDown', 'c']))

            

Reported by Pylint.

Module 'twisted.internet.reactor' has no 'callLater' member
Error

Line: 280 Column: 9

                              call_log, Equals(['setUp', 'a', 'test', 'b', 'tearDown']))
            c.callback(None)
        reactor.callLater(timeout * 0.25, fire_a)
        reactor.callLater(timeout * 0.5, fire_b)
        reactor.callLater(timeout * 0.75, fire_c)
        runner.run(result)
        self.assertThat(
            call_log, Equals(['setUp', 'a', 'test', 'b', 'tearDown', 'c']))


            

Reported by Pylint.

Module 'twisted.internet.reactor' has no 'callLater' member
Error

Line: 281 Column: 9

                          c.callback(None)
        reactor.callLater(timeout * 0.25, fire_a)
        reactor.callLater(timeout * 0.5, fire_b)
        reactor.callLater(timeout * 0.75, fire_c)
        runner.run(result)
        self.assertThat(
            call_log, Equals(['setUp', 'a', 'test', 'b', 'tearDown', 'c']))

    def test_async_cleanups(self):

            

Reported by Pylint.

Module 'twisted.internet.reactor' has no 'callLater' member
Error

Line: 312 Column: 9

                          c.callback(None)
        timeout = self.make_timeout()
        reactor = self.make_reactor()
        reactor.callLater(timeout * 0.25, fire_a)
        reactor.callLater(timeout * 0.5, fire_b)
        reactor.callLater(timeout * 0.75, fire_c)
        runner = self.make_runner(test, timeout)
        result = self.make_result()
        runner.run(result)

            

Reported by Pylint.

Module 'twisted.internet.reactor' has no 'callLater' member
Error

Line: 313 Column: 9

                      timeout = self.make_timeout()
        reactor = self.make_reactor()
        reactor.callLater(timeout * 0.25, fire_a)
        reactor.callLater(timeout * 0.5, fire_b)
        reactor.callLater(timeout * 0.75, fire_c)
        runner = self.make_runner(test, timeout)
        result = self.make_result()
        runner.run(result)
        self.assertThat(call_log, Equals(['a', 'b', 'c']))

            

Reported by Pylint.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/__init__.py
181 issues
Module 'zipimport' has no 'zipimporter' member
Error

Line: 167 Column: 44

                                  else:
                        for aPath in self.toolpath:
                            try:
                                importer = zipimport.zipimporter(aPath)
                                return importer.load_module(self.name)
                            except ImportError as e:
                                pass
            finally:
                sys.path = oldpythonpath

            

Reported by Pylint.

Module 'zipimport' has no 'zipimporter' member
Error

Line: 271 Column: 36

                                      raise SCons.Errors.SConsEnvironmentError(e)
                    try:
                        import zipimport
                        importer = zipimport.zipimporter(sys.modules['SCons.Tool'].__path__[0])
                        module = importer.load_module(full_name)
                        setattr(SCons.Tool, self.name, module)
                        return module
                    except ImportError as e:
                        m = "No tool named '%s': %s" % (self.name, e)

            

Reported by Pylint.

FIXME: what should be done here? Two scanners scan the same extensions,
Error

Line: 94 Column: 3

              for suffix in SWIGSuffixes:
    SourceFileScanner.add_scanner(suffix, SWIGScanner)

# FIXME: what should be done here? Two scanners scan the same extensions,
# but look for different files, e.g., "picture.eps" vs. "picture.pdf".
# The builders for DVI and PDF explicitly reference their scanners
# I think that means this is not needed???
for suffix in LaTeXSuffixes:
    SourceFileScanner.add_scanner(suffix, LaTeXScanner)

            

Reported by Pylint.

Unused variable 'index'
Error

Line: 132 Column: 9

                      import imp

        splitname = short_name.split('.')
        index = 0
        srchpths = searchpaths
        for item in splitname:
            file, path, desc = imp.find_module(item, srchpths)
            mod = imp.load_module(full_name, file, path, desc)
            srchpths = [path]

            

Reported by Pylint.

Redefining name 'SCons' from outer scope (line 45)
Error

Line: 294 Column: 13

                              kw = self.init_kw
        env.Append(TOOLS=[self.name])
        if hasattr(self, 'options'):
            import SCons.Variables
            if 'options' not in env:
                from SCons.Script import ARGUMENTS
                env['options'] = SCons.Variables.Variables(args=ARGUMENTS)
            opts = env['options']


            

Reported by Pylint.

Redefining name 'SCons' from outer scope (line 45)
Error

Line: 322 Column: 9

                  try:
        program = env['BUILDERS']['Program']
    except KeyError:
        import SCons.Defaults
        program = SCons.Builder.Builder(action=SCons.Defaults.LinkAction,
                                        emitter='$PROGEMITTER',
                                        prefix='$PROGPREFIX',
                                        suffix='$PROGSUFFIX',
                                        src_suffix='$OBJSUFFIX',

            

Reported by Pylint.

Unnecessary pass statement
Error

Line: 381 Column: 9

                  except (KeyError, TypeError):
        if Verbose:
            print('_call_linker_cb: env["LINKCALLBACKS"][%r] not found or can not be used' % callback)
        pass
    else:
        if Verbose:
            print('_call_linker_cb: env["LINKCALLBACKS"][%r] found' % callback)
            print('_call_linker_cb: env["LINKCALLBACKS"][%r]=%r' % (callback, cbfun))
        if isinstance(cbfun, Callable):

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 505 Column: 13

                      try:
            support_class = self._support_classes[libtype]
        except KeyError:
            raise ValueError('unsupported libtype %r' % libtype)
        self._support = support_class()

    def get_lib_prefix(self, env, *args, **kw):
        return self._support.get_lib_prefix(env, *args, **kw)


            

Reported by Pylint.

Redefining name 'suffix' from outer scope (line 85)
Error

Line: 588 Column: 9

                      else:
            kw2 = kw

        suffix = self.get_lib_suffix(env, **kw2)
        if Verbose:
            print("_LibSuffixGenerator: input suffix=%r" % suffix)

        version = self.get_lib_version(env, **kw2)
        if Verbose:

            

Reported by Pylint.

Redefining name 'suffix' from outer scope (line 85)
Error

Line: 638 Column: 13

              
        if version and not disable:
            prefix = self.get_lib_prefix(env, **kw2)
            suffix = self.get_lib_suffix(env, **kw2)
            symlinks = self.generate_versioned_lib_info(env, [libnode, version, prefix, suffix], **kw2)

        if Verbose:
            print('_LibSymlinkGenerator: return symlinks=%r' % StringizeLibSymlinks(symlinks))
        return symlinks

            

Reported by Pylint.

src/third_party/wiredtiger/bench/workgen/wtperf.py
176 issues
Undefined variable 'line'
Error

Line: 151 Column: 51

                  def split_assign(self, s):
        equalpos = s.find('=')
        if equalpos < 0:
            self.error("missing '=' for line: " + line)
            return (None, None)
        else:
            return s.split('=', 1)

    # Split a config string honoring nesting e.g.

            

Reported by Pylint.

Redefining name 'verbose' from outer scope (line 636)
Error

Line: 55 Column: 42

                  pass

class Translator:
    def __init__(self, filename, prefix, verbose, homedir):
        self.filename = filename
        self.prefix = prefix
        self.verbose = verbose
        self.homedir = homedir
        self.linenum = 0

            

Reported by Pylint.

Redefining name 'prefix' from outer scope (line 640)
Error

Line: 55 Column: 34

                  pass

class Translator:
    def __init__(self, filename, prefix, verbose, homedir):
        self.filename = filename
        self.prefix = prefix
        self.verbose = verbose
        self.homedir = homedir
        self.linenum = 0

            

Reported by Pylint.

Redefining name 'homedir' from outer scope (line 646)
Error

Line: 55 Column: 51

                  pass

class Translator:
    def __init__(self, filename, prefix, verbose, homedir):
        self.filename = filename
        self.prefix = prefix
        self.verbose = verbose
        self.homedir = homedir
        self.linenum = 0

            

Reported by Pylint.

Redefining name 'ret' from outer scope (line 670)
Error

Line: 113 Column: 13

              
    def _get_opt(self, optname, dfault):
        if optname in self.opts_map:
            ret = self.opts_map[optname]
            self.filename = ret.filename
            self.linenum = ret.linenum
            self.opts_used[optname] = 1
            return ret.value
        else:

            

Reported by Pylint.

Attribute 'count' defined outside __init__
Error

Line: 272 Column: 13

              
            # For wtperf compatibility, we allow both 'insert/inserts' etc.
            topts = Options()
            topts.count = 1
            topts.insert = 0
            topts.inserts = 0
            topts.ops_per_txn = 0
            topts.read = 0
            topts.reads = 0

            

Reported by Pylint.

Attribute 'insert' defined outside __init__
Error

Line: 273 Column: 13

                          # For wtperf compatibility, we allow both 'insert/inserts' etc.
            topts = Options()
            topts.count = 1
            topts.insert = 0
            topts.inserts = 0
            topts.ops_per_txn = 0
            topts.read = 0
            topts.reads = 0
            topts.throttle = 0

            

Reported by Pylint.

Attribute 'inserts' defined outside __init__
Error

Line: 274 Column: 13

                          topts = Options()
            topts.count = 1
            topts.insert = 0
            topts.inserts = 0
            topts.ops_per_txn = 0
            topts.read = 0
            topts.reads = 0
            topts.throttle = 0
            # Workgen's throttle_burst variable has a default of 1.0 .  Since we

            

Reported by Pylint.

Attribute 'ops_per_txn' defined outside __init__
Error

Line: 275 Column: 13

                          topts.count = 1
            topts.insert = 0
            topts.inserts = 0
            topts.ops_per_txn = 0
            topts.read = 0
            topts.reads = 0
            topts.throttle = 0
            # Workgen's throttle_burst variable has a default of 1.0 .  Since we
            # are always explicitly setting it, set our own value to the same.

            

Reported by Pylint.

Attribute 'read' defined outside __init__
Error

Line: 276 Column: 13

                          topts.insert = 0
            topts.inserts = 0
            topts.ops_per_txn = 0
            topts.read = 0
            topts.reads = 0
            topts.throttle = 0
            # Workgen's throttle_burst variable has a default of 1.0 .  Since we
            # are always explicitly setting it, set our own value to the same.
            topts.throttle_burst = 1.0

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_prepare_cursor01.py
176 issues
Unable to import 'wiredtiger'
Error

Line: 33 Column: 1

              # cursors:prepare
# [END_TAGS]

import wiredtiger, wttest
from wtdataset import SimpleDataSet, SimpleIndexDataSet
from wtdataset import SimpleLSMDataSet, ComplexDataSet, ComplexLSMDataSet
from wtscenario import make_scenarios

# test_prepare_cursor01.py

            

Reported by Pylint.

Unused SimpleIndexDataSet imported from wtdataset
Error

Line: 34 Column: 1

              # [END_TAGS]

import wiredtiger, wttest
from wtdataset import SimpleDataSet, SimpleIndexDataSet
from wtdataset import SimpleLSMDataSet, ComplexDataSet, ComplexLSMDataSet
from wtscenario import make_scenarios

# test_prepare_cursor01.py
#    WT_CURSOR navigation (next/prev) tests with prepared transactions

            

Reported by Pylint.

Unused ComplexLSMDataSet imported from wtdataset
Error

Line: 35 Column: 1

              
import wiredtiger, wttest
from wtdataset import SimpleDataSet, SimpleIndexDataSet
from wtdataset import SimpleLSMDataSet, ComplexDataSet, ComplexLSMDataSet
from wtscenario import make_scenarios

# test_prepare_cursor01.py
#    WT_CURSOR navigation (next/prev) tests with prepared transactions
class test_prepare_cursor01(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused ComplexDataSet imported from wtdataset
Error

Line: 35 Column: 1

              
import wiredtiger, wttest
from wtdataset import SimpleDataSet, SimpleIndexDataSet
from wtdataset import SimpleLSMDataSet, ComplexDataSet, ComplexLSMDataSet
from wtscenario import make_scenarios

# test_prepare_cursor01.py
#    WT_CURSOR navigation (next/prev) tests with prepared transactions
class test_prepare_cursor01(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused SimpleLSMDataSet imported from wtdataset
Error

Line: 35 Column: 1

              
import wiredtiger, wttest
from wtdataset import SimpleDataSet, SimpleIndexDataSet
from wtdataset import SimpleLSMDataSet, ComplexDataSet, ComplexLSMDataSet
from wtscenario import make_scenarios

# test_prepare_cursor01.py
#    WT_CURSOR navigation (next/prev) tests with prepared transactions
class test_prepare_cursor01(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 108 Column: 9

                      # Point all cursors to key 50.
        before_ts_s.begin_transaction('isolation=' + self.isolation + ',read_timestamp=' + self.timestamp_str(50))
        before_ts_c.set_key(ds.key(50))
        self.assertEquals(before_ts_c.search(), 0)

        between_ts_s.begin_transaction('isolation=' + self.isolation + ',read_timestamp=' + self.timestamp_str(150))
        between_ts_c.set_key(ds.key(50))
        self.assertEquals(between_ts_c.search(), 0)


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 112 Column: 9

              
        between_ts_s.begin_transaction('isolation=' + self.isolation + ',read_timestamp=' + self.timestamp_str(150))
        between_ts_c.set_key(ds.key(50))
        self.assertEquals(between_ts_c.search(), 0)

        after_ts_s.begin_transaction('isolation=' + self.isolation + ',read_timestamp=' + self.timestamp_str(250))
        after_ts_c.set_key(ds.key(50))
        self.assertEquals(after_ts_c.search(), 0)


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 116 Column: 9

              
        after_ts_s.begin_transaction('isolation=' + self.isolation + ',read_timestamp=' + self.timestamp_str(250))
        after_ts_c.set_key(ds.key(50))
        self.assertEquals(after_ts_c.search(), 0)

        session.begin_transaction('isolation=' + self.isolation)
        cursor.set_key(ds.key(50))
        self.assertEquals(cursor.search(), 0)


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 120 Column: 9

              
        session.begin_transaction('isolation=' + self.isolation)
        cursor.set_key(ds.key(50))
        self.assertEquals(cursor.search(), 0)

        # Check the visibility of newly inserted, prepared update.

        # As read is before prepare timestamp, next is not found.
        self.assertEquals(before_ts_c.next(), wiredtiger.WT_NOTFOUND)

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 125 Column: 9

                      # Check the visibility of newly inserted, prepared update.

        # As read is before prepare timestamp, next is not found.
        self.assertEquals(before_ts_c.next(), wiredtiger.WT_NOTFOUND)
        # As read is between, next will point to prepared update.
        self.assertRaisesException(wiredtiger.WiredTigerError, lambda: between_ts_c.next())
        # Check to see prev works when a next returns prepare conflict.
        self.assertEquals(between_ts_c.prev(), 0)
        self.assertEquals(between_ts_c.get_key(), ds.key(50))

            

Reported by Pylint.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/packaging/msi.py
174 issues
Instance of 'Element' has no 'attributes' member
Error

Line: 197 Column: 9

                      # Create a document with the Wix root tag
        doc  = Document()
        root = doc.createElement( 'Wix' )
        root.attributes['xmlns']='http://schemas.microsoft.com/wix/2003/01/wi'
        doc.appendChild( root )

        filename_set = [] # this is to circumvent duplicates in the shortnames
        id_set       = {} # this is to circumvent duplicates in the ids


            

Reported by Pylint.

Instance of 'Element' has no 'attributes' member
Error

Line: 242 Column: 5

                  """
    doc = Document()
    d1  = doc.createElement( 'Directory' )
    d1.attributes['Id']   = 'TARGETDIR'
    d1.attributes['Name'] = 'SourceDir'

    d2  = doc.createElement( 'Directory' )
    d2.attributes['Id']   = 'ProgramFilesFolder'
    d2.attributes['Name'] = 'PFiles'

            

Reported by Pylint.

Instance of 'Element' has no 'attributes' member
Error

Line: 243 Column: 5

                  doc = Document()
    d1  = doc.createElement( 'Directory' )
    d1.attributes['Id']   = 'TARGETDIR'
    d1.attributes['Name'] = 'SourceDir'

    d2  = doc.createElement( 'Directory' )
    d2.attributes['Id']   = 'ProgramFilesFolder'
    d2.attributes['Name'] = 'PFiles'


            

Reported by Pylint.

Instance of 'Element' has no 'attributes' member
Error

Line: 246 Column: 5

                  d1.attributes['Name'] = 'SourceDir'

    d2  = doc.createElement( 'Directory' )
    d2.attributes['Id']   = 'ProgramFilesFolder'
    d2.attributes['Name'] = 'PFiles'

    d3 = doc.createElement( 'Directory' )
    d3.attributes['Id']       = 'VENDOR_folder'
    d3.attributes['Name']     = escape( gen_dos_short_file_name( VENDOR, filename_set ) )

            

Reported by Pylint.

Instance of 'Element' has no 'attributes' member
Error

Line: 247 Column: 5

              
    d2  = doc.createElement( 'Directory' )
    d2.attributes['Id']   = 'ProgramFilesFolder'
    d2.attributes['Name'] = 'PFiles'

    d3 = doc.createElement( 'Directory' )
    d3.attributes['Id']       = 'VENDOR_folder'
    d3.attributes['Name']     = escape( gen_dos_short_file_name( VENDOR, filename_set ) )
    d3.attributes['LongName'] = escape( VENDOR )

            

Reported by Pylint.

Instance of 'Element' has no 'attributes' member
Error

Line: 250 Column: 5

                  d2.attributes['Name'] = 'PFiles'

    d3 = doc.createElement( 'Directory' )
    d3.attributes['Id']       = 'VENDOR_folder'
    d3.attributes['Name']     = escape( gen_dos_short_file_name( VENDOR, filename_set ) )
    d3.attributes['LongName'] = escape( VENDOR )

    d4 = doc.createElement( 'Directory' )
    project_folder            = "%s-%s" % ( NAME, VERSION )

            

Reported by Pylint.

Instance of 'Element' has no 'attributes' member
Error

Line: 251 Column: 5

              
    d3 = doc.createElement( 'Directory' )
    d3.attributes['Id']       = 'VENDOR_folder'
    d3.attributes['Name']     = escape( gen_dos_short_file_name( VENDOR, filename_set ) )
    d3.attributes['LongName'] = escape( VENDOR )

    d4 = doc.createElement( 'Directory' )
    project_folder            = "%s-%s" % ( NAME, VERSION )
    d4.attributes['Id']       = 'MY_DEFAULT_FOLDER'

            

Reported by Pylint.

Instance of 'Element' has no 'attributes' member
Error

Line: 252 Column: 5

                  d3 = doc.createElement( 'Directory' )
    d3.attributes['Id']       = 'VENDOR_folder'
    d3.attributes['Name']     = escape( gen_dos_short_file_name( VENDOR, filename_set ) )
    d3.attributes['LongName'] = escape( VENDOR )

    d4 = doc.createElement( 'Directory' )
    project_folder            = "%s-%s" % ( NAME, VERSION )
    d4.attributes['Id']       = 'MY_DEFAULT_FOLDER'
    d4.attributes['Name']     = escape( gen_dos_short_file_name( project_folder, filename_set ) )

            

Reported by Pylint.

Instance of 'Element' has no 'attributes' member
Error

Line: 256 Column: 5

              
    d4 = doc.createElement( 'Directory' )
    project_folder            = "%s-%s" % ( NAME, VERSION )
    d4.attributes['Id']       = 'MY_DEFAULT_FOLDER'
    d4.attributes['Name']     = escape( gen_dos_short_file_name( project_folder, filename_set ) )
    d4.attributes['LongName'] = escape( project_folder )

    d1.childNodes.append( d2 )
    d2.childNodes.append( d3 )

            

Reported by Pylint.

Instance of 'Element' has no 'attributes' member
Error

Line: 257 Column: 5

                  d4 = doc.createElement( 'Directory' )
    project_folder            = "%s-%s" % ( NAME, VERSION )
    d4.attributes['Id']       = 'MY_DEFAULT_FOLDER'
    d4.attributes['Name']     = escape( gen_dos_short_file_name( project_folder, filename_set ) )
    d4.attributes['LongName'] = escape( project_folder )

    d1.childNodes.append( d2 )
    d2.childNodes.append( d3 )
    d3.childNodes.append( d4 )

            

Reported by Pylint.

src/third_party/zstandard-1.4.4/zstd/tests/test-zstd-speed.py
165 issues
subprocess call with shell=True identified, security issue.
Security injection

Line: 52
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b602_subprocess_popen_with_shell_equals_true.html

              def execute(command, print_command=True, print_output=False, print_error=True, param_shell=True):
    if print_command:
        log("> " + command)
    popen = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=param_shell, cwd=execute.cwd)
    stdout_lines, stderr_lines = popen.communicate(timeout=args.timeout)
    stderr_lines = stderr_lines.decode("utf-8")
    stdout_lines = stdout_lines.decode("utf-8")
    if print_output:
        if stdout_lines:

            

Reported by Bandit.

Unused import string
Error

Line: 18 Column: 1

              
import argparse
import os           # getloadavg
import string
import subprocess
import time         # strftime
import traceback
import hashlib
import platform     # system

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 72 Column: 12

              def does_command_exist(command):
    try:
        execute(command, verbose, False, False)
    except Exception:
        return False
    return True


def send_email(emails, topic, text, have_mutt, have_mail):

            

Reported by Pylint.

Redefining name 'have_mutt' from outer scope (line 294)
Error

Line: 77 Column: 37

                  return True


def send_email(emails, topic, text, have_mutt, have_mail):
    logFileName = working_path + '/' + 'tmpEmailContent'
    with open(logFileName, "w") as myfile:
        myfile.writelines(text)
        myfile.close()
        if have_mutt:

            

Reported by Pylint.

Redefining name 'have_mail' from outer scope (line 295)
Error

Line: 77 Column: 48

                  return True


def send_email(emails, topic, text, have_mutt, have_mail):
    logFileName = working_path + '/' + 'tmpEmailContent'
    with open(logFileName, "w") as myfile:
        myfile.writelines(text)
        myfile.close()
        if have_mutt:

            

Reported by Pylint.

Redefining name 'commit' from outer scope (line 343)
Error

Line: 90 Column: 41

                          log("e-mail cannot be sent (mail or mutt not found)")


def send_email_with_attachments(branch, commit, last_commit, args, text, results_files,
                                logFileName, have_mutt, have_mail):
    with open(logFileName, "w") as myfile:
        myfile.writelines(text)
        myfile.close()
        email_topic = '[%s:%s] Warning for %s:%s last_commit=%s speed<%s ratio<%s' \

            

Reported by Pylint.

Redefining name 'branch' from outer scope (line 342)
Error

Line: 90 Column: 33

                          log("e-mail cannot be sent (mail or mutt not found)")


def send_email_with_attachments(branch, commit, last_commit, args, text, results_files,
                                logFileName, have_mutt, have_mail):
    with open(logFileName, "w") as myfile:
        myfile.writelines(text)
        myfile.close()
        email_topic = '[%s:%s] Warning for %s:%s last_commit=%s speed<%s ratio<%s' \

            

Reported by Pylint.

Redefining name 'args' from outer scope (line 35)
Error

Line: 90 Column: 62

                          log("e-mail cannot be sent (mail or mutt not found)")


def send_email_with_attachments(branch, commit, last_commit, args, text, results_files,
                                logFileName, have_mutt, have_mail):
    with open(logFileName, "w") as myfile:
        myfile.writelines(text)
        myfile.close()
        email_topic = '[%s:%s] Warning for %s:%s last_commit=%s speed<%s ratio<%s' \

            

Reported by Pylint.

Redefining name 'last_commit' from outer scope (line 356)
Error

Line: 90 Column: 49

                          log("e-mail cannot be sent (mail or mutt not found)")


def send_email_with_attachments(branch, commit, last_commit, args, text, results_files,
                                logFileName, have_mutt, have_mail):
    with open(logFileName, "w") as myfile:
        myfile.writelines(text)
        myfile.close()
        email_topic = '[%s:%s] Warning for %s:%s last_commit=%s speed<%s ratio<%s' \

            

Reported by Pylint.

Redefining name 'have_mail' from outer scope (line 295)
Error

Line: 91 Column: 57

              

def send_email_with_attachments(branch, commit, last_commit, args, text, results_files,
                                logFileName, have_mutt, have_mail):
    with open(logFileName, "w") as myfile:
        myfile.writelines(text)
        myfile.close()
        email_topic = '[%s:%s] Warning for %s:%s last_commit=%s speed<%s ratio<%s' \
                      % (email_header, pid, branch, commit, last_commit,

            

Reported by Pylint.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Taskmaster.py
158 issues
Instance of 'Task' has no 'options' member
Error

Line: 316 Column: 58

                              t.built()
                t.visited()
                if (not print_prepare and
                    (not hasattr(self, 'options') or not self.options.debug_includes)):
                    t.release_target_info()
            else:
                t.visited()

    executed = executed_with_callbacks

            

Reported by Pylint.

Instance of 'Task' has no 'options' member
Error

Line: 434 Column: 58

                              t.visited()
                t.set_state(NODE_UP_TO_DATE)
                if (not print_prepare and
                    (not hasattr(self, 'options') or not self.options.debug_includes)):
                    t.release_target_info()

    make_ready = make_ready_current

    def postprocess(self):

            

Reported by Pylint.

Unused import operator
Error

Line: 60 Column: 1

              __revision__ = "src/engine/SCons/Taskmaster.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"

from itertools import chain
import operator
import sys
import traceback

import SCons.Errors
import SCons.Node

            

Reported by Pylint.

Reimport 'sys' (imported line 25)
Error

Line: 61 Column: 1

              
from itertools import chain
import operator
import sys
import traceback

import SCons.Errors
import SCons.Node
import SCons.Warnings

            

Reported by Pylint.

Unused import traceback
Error

Line: 62 Column: 1

              from itertools import chain
import operator
import sys
import traceback

import SCons.Errors
import SCons.Node
import SCons.Warnings


            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 116 Column: 37

                    "%(build)3d "

def dump_stats():
    for n in sorted(StatsNodes, key=lambda a: str(a)):
        print((fmt % n.attributes.stats.__dict__) + str(n))



class Task(object):

            

Reported by Pylint.

Redefining name 'fmt' from outer scope (line 107)
Error

Line: 148 Column: 9

                      self.exc_clear()

    def trace_message(self, method, node, description='node'):
        fmt = '%-20s %s %s\n'
        return fmt % (method + ':', description, self.tm.trace_node(node))

    def display(self, message):
        """
        Hook to allow the calling interface to display a message.

            

Reported by Pylint.

Unnecessary pass statement
Error

Line: 162 Column: 9

                      interface can subclass Task and provide a concrete implementation
        of this method to see those messages.
        """
        pass

    def prepare(self):
        """
        Called just before the task is executed.


            

Reported by Pylint.

Using the global statement
Error

Line: 172 Column: 9

                      unlink underlying files and make all necessary directories before
        the Action is actually called to build the targets.
        """
        global print_prepare
        T = self.tm.trace
        if T: T.write(self.trace_message(u'Task.prepare()', self.node))

        # Now that it's the appropriate time, give the TaskMaster a
        # chance to raise any exceptions it encountered while preparing

            

Reported by Pylint.

TODO(deprecate): "return True" is the old default behavior;
Error

Line: 216 Column: 3

                      return self.node

    def needs_execute(self):
        # TODO(deprecate):  "return True" is the old default behavior;
        # change it to NotImplementedError (after running through the
        # Deprecation Cycle) so the desired behavior is explicitly
        # determined by which concrete subclass is used.
        #raise NotImplementedError
        msg = ('Taskmaster.Task is an abstract base class; instead of\n'

            

Reported by Pylint.

src/third_party/wiredtiger/test/syscall/syscall.py
150 issues
Explicit return in __init__
Error

Line: 343 Column: 5

              
# Read from a regular file.
class FileReader(Reader):
    def __init__(self, wttop, filename, raw = True):
        return super(FileReader, self).__init__(wttop, filename,
                                                open(filename), raw, False)

# Read from the C preprocessor run on a file.
class PreprocessedReader(Reader):

            

Reported by Pylint.

Unused argument 'args'
Error

Line: 229 Column: 1

              class FileLine(str):
    filename = None
    linenum = 0
    def __new__(cls, filename, linenum, value, *args, **kwargs):
        result = super(FileLine, cls).__new__(cls, value)
        result.filename = filename
        result.linenum = linenum
        return result


            

Reported by Pylint.

Unused argument 'kwargs'
Error

Line: 229 Column: 1

              class FileLine(str):
    filename = None
    linenum = 0
    def __new__(cls, filename, linenum, value, *args, **kwargs):
        result = super(FileLine, cls).__new__(cls, value)
        result.filename = filename
        result.linenum = linenum
        return result


            

Reported by Pylint.

Redefining name 'cmd' from outer scope (line 986)
Error

Line: 351 Column: 9

              class PreprocessedReader(Reader):
    def __init__(self, wttop, filename, predefines, raw = True):
        sourcedir = os.path.dirname(filename)
        cmd = ['cc', '-E', '-I' + sourcedir]
        for name in dir(predefines):
            if not name.startswith('__'):
                cmd.append('-D' + name + '=' + str(predefines[name]))
        cmd.append('-')
        proc = subprocess.Popen(cmd, stdin=open(filename),

            

Reported by Pylint.

Attribute 'runargs' defined outside __init__
Error

Line: 425 Column: 9

                                  "': Missing double quotes in RUN arguments")
                return [ False, False ]
            runargs = runargs[1:-1]
        self.runargs = runargs.split()
        #print("SYSCALLS: " + self.headopts.trace_syscalls
        if self.headopts.required_system != None and \
            self.headopts.required_system != systemtype:
            msg("skipping '" + self.runfile.filename + "': for '" +
                self.headopts.required_system + "', this system is '"

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 446 Column: 9

                      # make it work if line is None or is a plain string.
        try:
            prefix = simplify_path(self.wttopdir, line.prefix())
        except:
            prefix = 'syscall.py: '
        print(prefix + s, file=sys.stderr)

    def failrange(self, errfile, line, lineto, s):
        # make it work if line is None or is a plain string.

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 454 Column: 9

                      # make it work if line is None or is a plain string.
        try:
            prefix = simplify_path(self.wttopdir, line.range_prefix(lineto))
        except:
            prefix = 'syscall.py: '
        print(prefix + s + '\n' + errfile.get_context(), file=sys.stderr)

    def str_match(self, s1, s2):
        fuzzyRight = False

            

Reported by Pylint.

Use of possibly insecure function - consider using safer ast.literal_eval.
Security blacklist

Line: 482
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b307-eval

                          return s1 == s2

    def expr_eval(self, s):
        return eval(s, {}, self.variables)

    def arg_match(self, a1, a2):
        a1 = a1.strip()
        a2 = a2.strip()
        if a1 == a2:

            

Reported by Bandit.

Use of eval
Error

Line: 482 Column: 16

                          return s1 == s2

    def expr_eval(self, s):
        return eval(s, {}, self.variables)

    def arg_match(self, a1, a2):
        a1 = a1.strip()
        a2 = a2.strip()
        if a1 == a2:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 496 Column: 16

                      #print('  arg_match: <' + a1 + '> <' + a2 + '>')
        try:
            a1value = self.expr_eval(a1)
        except Exception:
            self.fail(a1, 'unknown expression: ' + a1)
            return False
        try:
            a2value = self.expr_eval(a2)
        except Exception:

            

Reported by Pylint.