The following issues were found

src/third_party/IntelRDFPMathLib20U1/TESTS/readtest.c
77 issues
sscanf - The scanf() family's %s operation, without a limit specification, permits buffer overflows
Security

Line: 141 Column: 14 CWE codes: 120 20
Suggestion: Specify a limit to %s, or use a different input function

              
#define getop128(bid, dpd, op, str) \
      if (*op == '[') { \
        if ((sscanf(op+1, BID_FMT_LLX16""BID_FMT_LLX16, &(bid.w[BID_HIGH_128W]), &(bid.w[BID_LOW_128W])) == 2) || \
            (sscanf(op+1, ""BID_FMT_LLX16","BID_FMT_LLX16"", &(bid.w[BID_HIGH_128W]), &(bid.w[BID_LOW_128W])) == 2)) {\
          dpd = bid; \
          BIDECIMAL_CALL1_NORND_RESREF(bid128_to_string, str, bid); \
		  } else { \
			 printf("Internal error - can't read number form string %s\n", op+1); \

            

Reported by FlawFinder.

strcpy - Does not check for buffer overflows when copying to destination [MS-banned]
Security

Line: 153 Column: 13 CWE codes: 120
Suggestion: Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)

                      BIDECIMAL_CALL1_RESARG(bid128_from_string, (bid), (op)); \
        dpd = bid; \
        if ( !strcmp(func, "bid128_from_string") || !strcmp(func, "bid_strtod128") || !strcmp(func, "bid_wcstod128") || !strcmp(func, "bid_strtod128") || !strcmp(func, "bid128_nan") ) { \
            strcpy(str, op); \
        } else { \
            BIDECIMAL_CALL1_NORND_RESREF(bid128_to_string, str, bid); \
        } \
      } \


            

Reported by FlawFinder.

sscanf - The scanf() family's %s operation, without a limit specification, permits buffer overflows
Security

Line: 161 Column: 13 CWE codes: 120 20
Suggestion: Specify a limit to %s, or use a different input function

              
#define getop32(bid, dpd, op, str) \
      if (*op == '[') { \
        if (sscanf((op)+1, BID_FMT_X8, &(bid))) { \
          dpd = (bid); \
          BIDECIMAL_CALL1_NORND_RESREF(bid32_to_string, str, bid); \
		  } else { \
			 printf("Internal error - can't read number form string %s\n", (op)+1); \
			 exit(1); \

            

Reported by FlawFinder.

strcpy - Does not check for buffer overflows when copying to destination [MS-banned]
Security

Line: 172 Column: 13 CWE codes: 120
Suggestion: Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)

                      BIDECIMAL_CALL1_RESARG(bid32_from_string, bid, op); \
        dpd = bid; \
        if ( !strcmp(func, "bid32_from_string") || !strcmp(func, "bid_strtod32") ||  !strcmp(func, "bid_wcstod32") || !strcmp(func, "bid32_nan") ) { \
            strcpy(str, op); \
        } else { \
            BIDECIMAL_CALL1_NORND_RESREF(bid32_to_string, str, bid); \
        } \
      } \


            

Reported by FlawFinder.

sscanf - The scanf() family's %s operation, without a limit specification, permits buffer overflows
Security

Line: 181 Column: 13 CWE codes: 120 20
Suggestion: Specify a limit to %s, or use a different input function

              
#define getop64(bid, dpd, op, str) \
      if (*op == '[') { \
        if (sscanf(op+1, BID_FMT_LLX16, &bid)) { \
          dpd = bid; \
          BIDECIMAL_CALL1_NORND_RESREF(bid64_to_string, str, bid); \
		  } else { \
			 printf("Internal error - can't read number form string %s\n", (op)+1); \
			 exit(1); \

            

Reported by FlawFinder.

strcpy - Does not check for buffer overflows when copying to destination [MS-banned]
Security

Line: 192 Column: 13 CWE codes: 120
Suggestion: Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)

                      BIDECIMAL_CALL1_RESARG(bid64_from_string, bid, op); \
        dpd = bid; \
        if ( !strcmp(func, "bid64_from_string") || !strcmp(func, "bid_strtod64") ||  !strcmp(func, "bid_wcstod64") || !strcmp(func, "bid64_nan") ) { \
            strcpy(str, op); \
        } else { \
            BIDECIMAL_CALL1_NORND_RESREF(bid64_to_string, str, bid); \
        } \
      } 


            

Reported by FlawFinder.

sscanf - The scanf() family's %s operation, without a limit specification, permits buffer overflows
Security

Line: 285 Column: 14 CWE codes: 120 20
Suggestion: Specify a limit to %s, or use a different input function

              
#define getop64i(bid, op, str) \
      if (*op == '[') { \
        if (!sscanf(op+1, BID_FMT_LLX16, &bid)) { \
			 printf("Internal error - can't read number form string %s\n", (op)+1); \
			 exit(1); \
		  } \
      } else { \
        if (!sscanf(op, BID_FMT_LLD, &bid)) { \

            

Reported by FlawFinder.

sscanf - The scanf() family's %s operation, without a limit specification, permits buffer overflows
Security

Line: 290 Column: 14 CWE codes: 120 20
Suggestion: Specify a limit to %s, or use a different input function

              			 exit(1); \
		  } \
      } else { \
        if (!sscanf(op, BID_FMT_LLD, &bid)) { \
			 printf("Internal error - can't read number form string %s\n", (op)); \
			 exit(1); \
		  } \
      } \
      sprintf(str, BID_FMT_LLD, bid);

            

Reported by FlawFinder.

sprintf - Potential format string problem
Security

Line: 295 Column: 7 CWE codes: 134
Suggestion: Make format string constant

              			 exit(1); \
		  } \
      } \
      sprintf(str, BID_FMT_LLD, bid);

#define getop64u(bid, op, str) \
      if (*op == '[') { \
        if (!sscanf(op+1, BID_FMT_LLX16, &bid)) { \
			 printf("Internal error - can't read number form string %s\n", (op)+1); \

            

Reported by FlawFinder.

sscanf - The scanf() family's %s operation, without a limit specification, permits buffer overflows
Security

Line: 299 Column: 14 CWE codes: 120 20
Suggestion: Specify a limit to %s, or use a different input function

              
#define getop64u(bid, op, str) \
      if (*op == '[') { \
        if (!sscanf(op+1, BID_FMT_LLX16, &bid)) { \
			 printf("Internal error - can't read number form string %s\n", (op)+1); \
			 exit(1); \
		  } \
      } else { \
        if (!sscanf(op, BID_FMT_LLU, &bid)) { \

            

Reported by FlawFinder.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Script/__init__.py
76 issues
Module import itself
Error

Line: 75 Column: 9

                  except SCons.Warnings.Warning:
        # Some warning was thrown.  Arrange for it to be displayed
        # or not after warnings are configured.
        from . import Main
        exc_type, exc_value, tb = sys.exc_info()
        Main.delayed_warnings.append((exc_type, exc_value))
del _args

import SCons.Action

            

Reported by Pylint.

Module import itself
Error

Line: 94 Column: 1

              import SCons.Variables
import SCons.Defaults

from . import Main

main                    = Main.main

# The following are global class definitions and variables that used to
# live directly in this module back before 0.96.90, when it contained

            

Reported by Pylint.

Module import itself
Error

Line: 138 Column: 1

              #repositories            = Main.repositories

#
from . import SConscript
_SConscript = SConscript

call_stack              = _SConscript.call_stack

#

            

Reported by Pylint.

Redefining built-in 'list'
Error

Line: 190 Column: 28

              class TargetList(collections.UserList):
    def _do_nothing(self, *args, **kw):
        pass
    def _add_Default(self, list):
        self.extend(list)
    def _clear(self):
        del self[:]

ARGUMENTS               = {}

            

Reported by Pylint.

Access to a protected member _add_Default of a client class
Error

Line: 222 Column: 9

                  if tlist:
        COMMAND_LINE_TARGETS.extend(tlist)
        BUILD_TARGETS.extend(tlist)
        BUILD_TARGETS._add_Default = BUILD_TARGETS._do_nothing
        BUILD_TARGETS._clear = BUILD_TARGETS._do_nothing
        _build_plus_default.extend(tlist)
        _build_plus_default._add_Default = _build_plus_default._do_nothing
        _build_plus_default._clear = _build_plus_default._do_nothing


            

Reported by Pylint.

Access to a protected member _do_nothing of a client class
Error

Line: 222 Column: 38

                  if tlist:
        COMMAND_LINE_TARGETS.extend(tlist)
        BUILD_TARGETS.extend(tlist)
        BUILD_TARGETS._add_Default = BUILD_TARGETS._do_nothing
        BUILD_TARGETS._clear = BUILD_TARGETS._do_nothing
        _build_plus_default.extend(tlist)
        _build_plus_default._add_Default = _build_plus_default._do_nothing
        _build_plus_default._clear = _build_plus_default._do_nothing


            

Reported by Pylint.

Access to a protected member _do_nothing of a client class
Error

Line: 223 Column: 32

                      COMMAND_LINE_TARGETS.extend(tlist)
        BUILD_TARGETS.extend(tlist)
        BUILD_TARGETS._add_Default = BUILD_TARGETS._do_nothing
        BUILD_TARGETS._clear = BUILD_TARGETS._do_nothing
        _build_plus_default.extend(tlist)
        _build_plus_default._add_Default = _build_plus_default._do_nothing
        _build_plus_default._clear = _build_plus_default._do_nothing

def _Set_Default_Targets_Has_Been_Called(d, fs):

            

Reported by Pylint.

Access to a protected member _clear of a client class
Error

Line: 223 Column: 9

                      COMMAND_LINE_TARGETS.extend(tlist)
        BUILD_TARGETS.extend(tlist)
        BUILD_TARGETS._add_Default = BUILD_TARGETS._do_nothing
        BUILD_TARGETS._clear = BUILD_TARGETS._do_nothing
        _build_plus_default.extend(tlist)
        _build_plus_default._add_Default = _build_plus_default._do_nothing
        _build_plus_default._clear = _build_plus_default._do_nothing

def _Set_Default_Targets_Has_Been_Called(d, fs):

            

Reported by Pylint.

Access to a protected member _add_Default of a client class
Error

Line: 225 Column: 9

                      BUILD_TARGETS._add_Default = BUILD_TARGETS._do_nothing
        BUILD_TARGETS._clear = BUILD_TARGETS._do_nothing
        _build_plus_default.extend(tlist)
        _build_plus_default._add_Default = _build_plus_default._do_nothing
        _build_plus_default._clear = _build_plus_default._do_nothing

def _Set_Default_Targets_Has_Been_Called(d, fs):
    return DEFAULT_TARGETS


            

Reported by Pylint.

Access to a protected member _do_nothing of a client class
Error

Line: 225 Column: 44

                      BUILD_TARGETS._add_Default = BUILD_TARGETS._do_nothing
        BUILD_TARGETS._clear = BUILD_TARGETS._do_nothing
        _build_plus_default.extend(tlist)
        _build_plus_default._add_Default = _build_plus_default._do_nothing
        _build_plus_default._clear = _build_plus_default._do_nothing

def _Set_Default_Targets_Has_Been_Called(d, fs):
    return DEFAULT_TARGETS


            

Reported by Pylint.

src/third_party/wiredtiger/bench/workgen/runner/read_write_sync_short.py
76 issues
Unable to import 'wiredtiger'
Error

Line: 35 Column: 1

              import sys

from runner import *
from wiredtiger import *
from workgen import *

context = Context()
conn_config = ""
conn_config += ",cache_size=2GB,eviction=(threads_max=8),log=(enabled=true),session_max=250,statistics=(fast),statistics_log=(wait=1,json)"   # explicitly added

            

Reported by Pylint.

Unable to import 'workgen'
Error

Line: 36 Column: 1

              
from runner import *
from wiredtiger import *
from workgen import *

context = Context()
conn_config = ""
conn_config += ",cache_size=2GB,eviction=(threads_max=8),log=(enabled=true),session_max=250,statistics=(fast),statistics_log=(wait=1,json)"   # explicitly added
conn = context.wiredtiger_open("create," + conn_config)

            

Reported by Pylint.

Undefined variable 'Context'
Error

Line: 38 Column: 11

              from wiredtiger import *
from workgen import *

context = Context()
conn_config = ""
conn_config += ",cache_size=2GB,eviction=(threads_max=8),log=(enabled=true),session_max=250,statistics=(fast),statistics_log=(wait=1,json)"   # explicitly added
conn = context.wiredtiger_open("create," + conn_config)
s = conn.open_session("")


            

Reported by Pylint.

Undefined variable 'Table'
Error

Line: 53 Column: 13

              table_count = 100
for i in range(0, table_count):
    tname = "table:test" + str(i)
    table = Table(tname)
    s.create(tname, wtperf_table_config +\
             compress_table_config + table_config)
    table.options.key_size = 20
    table.options.value_size = 7000
    tables.append(table)

            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 64 Column: 21

              icount = 4000000
# There are multiple tables to be filled during populate,
# the icount is split between them all.
pop_ops = Operation(Operation.OP_INSERT, tables[0])
pop_ops = op_multi_table(pop_ops, tables)
nops_per_thread = icount // (populate_threads * table_count)
pop_thread = Thread(pop_ops * nops_per_thread)
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)

            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 64 Column: 11

              icount = 4000000
# There are multiple tables to be filled during populate,
# the icount is split between them all.
pop_ops = Operation(Operation.OP_INSERT, tables[0])
pop_ops = op_multi_table(pop_ops, tables)
nops_per_thread = icount // (populate_threads * table_count)
pop_thread = Thread(pop_ops * nops_per_thread)
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)

            

Reported by Pylint.

Undefined variable 'Thread'
Error

Line: 67 Column: 14

              pop_ops = Operation(Operation.OP_INSERT, tables[0])
pop_ops = op_multi_table(pop_ops, tables)
nops_per_thread = icount // (populate_threads * table_count)
pop_thread = Thread(pop_ops * nops_per_thread)
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)
print('populate complete')

# Log like file, requires that logging be enabled in the connection config.

            

Reported by Pylint.

Undefined variable 'Workload'
Error

Line: 68 Column: 16

              pop_ops = op_multi_table(pop_ops, tables)
nops_per_thread = icount // (populate_threads * table_count)
pop_thread = Thread(pop_ops * nops_per_thread)
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)
print('populate complete')

# Log like file, requires that logging be enabled in the connection config.
log_name = "table:log"

            

Reported by Pylint.

Undefined variable 'Table'
Error

Line: 75 Column: 13

              # Log like file, requires that logging be enabled in the connection config.
log_name = "table:log"
s.create(log_name, wtperf_table_config + "key_format=S,value_format=S," + compress_table_config + table_config + ",log=(enabled=true)")
log_table = Table(log_name)

ops = Operation(Operation.OP_UPDATE, tables[0])
ops = op_multi_table(ops, tables, False)
ops = op_log_like(ops, log_table, 0)
thread0 = Thread(ops)

            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 77 Column: 7

              s.create(log_name, wtperf_table_config + "key_format=S,value_format=S," + compress_table_config + table_config + ",log=(enabled=true)")
log_table = Table(log_name)

ops = Operation(Operation.OP_UPDATE, tables[0])
ops = op_multi_table(ops, tables, False)
ops = op_log_like(ops, log_table, 0)
thread0 = Thread(ops)
# These operations include log_like operations, which will increase the number
# of insert/update operations by a factor of 2.0. This may cause the

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_checkpoint01.py
76 issues
Unable to import 'wiredtiger'
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
from wtdataset import SimpleDataSet, ComplexLSMDataSet
from wtscenario import make_scenarios

# test_checkpoint01.py
#    Checkpoint tests

            

Reported by Pylint.

Unused variable 'entry'
Error

Line: 70 Column: 30

                  # checkpoint the object, and verify it (which verifies all underlying
    # checkpoints individually).
    def build_file_with_checkpoints(self):
        for checkpoint_name, entry in self.checkpoints.items():
            self.add_records(checkpoint_name)
            self.session.checkpoint("name=" + checkpoint_name)

    # Create a dictionary of sorted records a checkpoint should include.
    def list_expected(self, name):

            

Reported by Pylint.

Cell variable checkpoint_name defined in loop
Error

Line: 105 Column: 53

                          if entry[1] == 0:
                self.assertRaises(wiredtiger.WiredTigerError,
                    lambda: self.session.open_cursor(
                    self.uri, None, "checkpoint=" + checkpoint_name))
            else:
                list_expected = self.list_expected(checkpoint_name)
                list_checkpoint = self.list_checkpoint(checkpoint_name)
                self.assertEqual(list_expected, list_checkpoint)


            

Reported by Pylint.

Unused variable 'entry'
Error

Line: 134 Column: 30

                      # Drop remaining checkpoints, all subsequent checkpoint opens should
        # fail.
        self.session.checkpoint("drop=(from=all)")
        for checkpoint_name, entry in self.checkpoints.items():
            self.checkpoints[checkpoint_name] =\
                (self.checkpoints[checkpoint_name][0], 0)
        self.check()

# Check some specific cursor checkpoint combinations.

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 164 Column: 9

                      c2 = self.session.open_cursor(self.uri, None, "checkpoint=checkpoint-1")
        c3 = self.session.open_cursor(self.uri, None, "checkpoint=checkpoint-1")
        c4 = self.session.open_cursor(self.uri, None, None)
        c4.close, c3.close, c2.close, c1.close

        self.session.checkpoint("name=checkpoint-2")
        c1 = self.session.open_cursor(self.uri, None, "checkpoint=checkpoint-1")
        c2 = self.session.open_cursor(self.uri, None, "checkpoint=checkpoint-2")
        c3 = self.session.open_cursor(self.uri, None, "checkpoint=checkpoint-2")

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 171 Column: 9

                      c2 = self.session.open_cursor(self.uri, None, "checkpoint=checkpoint-2")
        c3 = self.session.open_cursor(self.uri, None, "checkpoint=checkpoint-2")
        c4 = self.session.open_cursor(self.uri, None, None)
        c4.close, c3.close, c2.close, c1.close

    # Check that you cannot drop a checkpoint if it's in use.
    def test_checkpoint_inuse(self):
        SimpleDataSet(self, self.uri, 100, key_format=self.fmt).populate()
        self.session.checkpoint("name=checkpoint-1")

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 218 Column: 9

              
    def check(self, uri, ds, value):
        cursor = self.session.open_cursor(uri, None, "checkpoint=checkpoint-1")
        self.assertEquals(cursor[ds.key(10)], value)
        cursor.close()

    def test_checkpoint_target(self):
        # Create 3 objects, change one record to an easily recognizable string.
        uri = self.uri + '1'

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 273 Column: 13

                      cursor.set_value("XXX")
        msg = "/Unsupported cursor/"
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: cursor.insert(), msg)
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: cursor.remove(), msg)
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: cursor.update(), msg)
        cursor.close()

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 275 Column: 13

                      self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: cursor.insert(), msg)
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: cursor.remove(), msg)
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: cursor.update(), msg)
        cursor.close()

# Check that WiredTigerCheckpoint works as a checkpoint specifier.

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 277 Column: 13

                      self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: cursor.remove(), msg)
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: cursor.update(), msg)
        cursor.close()

# Check that WiredTigerCheckpoint works as a checkpoint specifier.
class test_checkpoint_last(wttest.WiredTigerTestCase):
    scenarios = make_scenarios([

            

Reported by Pylint.

src/third_party/mock_ocsp_responder/mock_ocsp_responder.py
75 issues
Unable to import 'asn1crypto'
Error

Line: 55 Column: 1

              from datetime import datetime, timezone, timedelta
from typing import Callable, Tuple, Optional

from asn1crypto import x509, keys, core, ocsp
from asn1crypto.ocsp import OCSPRequest, OCSPResponse
from oscrypto import asymmetric
from flask import Flask, request, Response

__version__ = '0.10.2'

            

Reported by Pylint.

Unable to import 'asn1crypto.ocsp'
Error

Line: 56 Column: 1

              from typing import Callable, Tuple, Optional

from asn1crypto import x509, keys, core, ocsp
from asn1crypto.ocsp import OCSPRequest, OCSPResponse
from oscrypto import asymmetric
from flask import Flask, request, Response

__version__ = '0.10.2'
__version_info__ = (0, 10, 2)

            

Reported by Pylint.

Unable to import 'oscrypto'
Error

Line: 57 Column: 1

              
from asn1crypto import x509, keys, core, ocsp
from asn1crypto.ocsp import OCSPRequest, OCSPResponse
from oscrypto import asymmetric
from flask import Flask, request, Response

__version__ = '0.10.2'
__version_info__ = (0, 10, 2)


            

Reported by Pylint.

NotImplemented is not callable
Error

Line: 503 Column: 19

                      elif self._fault == FAULT_UNKNOWN:
            return (CertificateStatus.unknown, None)
        elif self._fault != None:
            raise NotImplemented('Fault type could not be found')
        return (CertificateStatus.good, time)

    def _build_ocsp_response(self, ocsp_request: OCSPRequest) -> OCSPResponse:
        """
        Create and return an OCSP response from an OCSP request.

            

Reported by Pylint.

NotImplemented raised - should raise NotImplementedError
Error

Line: 503 Column: 13

                      elif self._fault == FAULT_UNKNOWN:
            return (CertificateStatus.unknown, None)
        elif self._fault != None:
            raise NotImplemented('Fault type could not be found')
        return (CertificateStatus.good, time)

    def _build_ocsp_response(self, ocsp_request: OCSPRequest) -> OCSPResponse:
        """
        Create and return an OCSP response from an OCSP request.

            

Reported by Pylint.

NotImplemented raised - should raise NotImplementedError
Error

Line: 515 Column: 13

                      request_list = tbs_request['request_list']
        if len(request_list) < 1:
            logger.warning('Received OCSP request with no requests')
            raise NotImplemented('Empty requests not supported')

        single_request = request_list[0]  # TODO: Support more than one request
        req_cert = single_request['req_cert']
        serial = req_cert['serial_number'].native


            

Reported by Pylint.

NotImplemented is not callable
Error

Line: 515 Column: 19

                      request_list = tbs_request['request_list']
        if len(request_list) < 1:
            logger.warning('Received OCSP request with no requests')
            raise NotImplemented('Empty requests not supported')

        single_request = request_list[0]  # TODO: Support more than one request
        req_cert = single_request['req_cert']
        serial = req_cert['serial_number'].native


            

Reported by Pylint.

Unused Callable imported from typing
Error

Line: 53 Column: 1

              import textwrap
import time
from datetime import datetime, timezone, timedelta
from typing import Callable, Tuple, Optional

from asn1crypto import x509, keys, core, ocsp
from asn1crypto.ocsp import OCSPRequest, OCSPResponse
from oscrypto import asymmetric
from flask import Flask, request, Response

            

Reported by Pylint.

Unused Optional imported from typing
Error

Line: 53 Column: 1

              import textwrap
import time
from datetime import datetime, timezone, timedelta
from typing import Callable, Tuple, Optional

from asn1crypto import x509, keys, core, ocsp
from asn1crypto.ocsp import OCSPRequest, OCSPResponse
from oscrypto import asymmetric
from flask import Flask, request, Response

            

Reported by Pylint.

Unused Tuple imported from typing
Error

Line: 53 Column: 1

              import textwrap
import time
from datetime import datetime, timezone, timedelta
from typing import Callable, Tuple, Optional

from asn1crypto import x509, keys, core, ocsp
from asn1crypto.ocsp import OCSPRequest, OCSPResponse
from oscrypto import asymmetric
from flask import Flask, request, Response

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/suite_subprocess.py
74 issues
Instance of 'suite_subprocess' has no 'fail' member
Error

Line: 81 Column: 13

                          if hasNext:
                print('...')
            print('********************************')
            self.fail('ERROR found in output file: ' + filename)

    # If the string is of the form '/.../', then return just the embedded
    # pattern, otherwise, return None
    def convert_to_pattern(self, s):
        if len(s) >= 2 and s[0] == '/' and s[-1] == '/':

            

Reported by Pylint.

Instance of 'suite_subprocess' has no 'assertEqual' member
Error

Line: 94 Column: 13

                  def check_file_content(self, filename, expect):
        with open(filename, 'r') as f:
            got = f.read(len(expect) + 100)
            self.assertEqual(got, expect, filename + ': does not contain expected:\n\'' + expect + '\', but contains:\n\'' + got + '\'.')

    # Check contents of the file against a provided checklist. Expected is used as a bool to either
    # ensure checklist is included or ensure the checklist is not included in the file.
    def check_file_contains_one_of(self, filename, checklist, expected):
        """

            

Reported by Pylint.

Instance of 'suite_subprocess' has no 'fail' member
Error

Line: 114 Column: 29

                                      if expected:
                            break
                        else:
                            self.fail("Did not expect: " + got)
                else:
                    if re.search(pat, got):
                        found = True
                        if expected:
                            break

            

Reported by Pylint.

Instance of 'suite_subprocess' has no 'fail' member
Error

Line: 121 Column: 29

                                      if expected:
                            break
                        else:
                            self.fail("Did not expect: " + got)
            if not found and expected:
                if len(checklist) == 1:
                    expect = '\'' + checklist[0] + '\''
                else:
                    expect = str(checklist)

            

Reported by Pylint.

Instance of 'suite_subprocess' has no 'fail' member
Error

Line: 130 Column: 21

                              gotstr = '\'' + \
                    (got if len(got) < 1000 else (got[0:1000] + '...')) + '\''
                if len(got) >= maxbytes:
                    self.fail(filename + ': does not contain expected ' + expect + ', or output is too large, got ' + gotstr)
                else:
                    self.fail(filename + ': does not contain expected ' + expect + ', got ' + gotstr)

    def check_file_contains(self, filename, content):
        self.check_file_contains_one_of(filename, [content], True)

            

Reported by Pylint.

Instance of 'suite_subprocess' has no 'fail' member
Error

Line: 132 Column: 21

                              if len(got) >= maxbytes:
                    self.fail(filename + ': does not contain expected ' + expect + ', or output is too large, got ' + gotstr)
                else:
                    self.fail(filename + ': does not contain expected ' + expect + ', got ' + gotstr)

    def check_file_contains(self, filename, content):
        self.check_file_contains_one_of(filename, [content], True)

    def check_file_not_contains(self, filename, content):

            

Reported by Pylint.

Instance of 'suite_subprocess' has no 'assertEqual' member
Error

Line: 150 Column: 9

                              contents = f.read(1000)
                print('ERROR: ' + filename + ' expected to be empty, but contains:\n')
                print(contents + '...\n')
        self.assertEqual(filesize, 0, filename + ': expected to be empty')

    def check_non_empty_file(self, filename):
        """
        Raise an error if the file is empty
        """

            

Reported by Pylint.

Instance of 'suite_subprocess' has no 'assertNotEqual' member
Error

Line: 159 Column: 9

                      filesize = os.path.getsize(filename)
        if filesize == 0:
            print('ERROR: ' + filename + ' should not be empty (this command expected error output)')
        self.assertNotEqual(filesize, 0, filename + ': expected to not be empty')

    def verbose_env(self, envvar):
        return envvar + '=' + str(os.environ.get(envvar)) + '\n'

    def show_outputs(self, procargs, message, filenames):

            

Reported by Pylint.

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

Line: 172 Column: 9

                            self.verbose_env('DYLD_LIBRARY_PATH') + \
              self.verbose_env('PYTHONPATH') + \
              'output files follow:'
        WiredTigerTestCase.prout(out)
        for filename in filenames:
            maxbytes = 1024*100
            with open(filename, 'r') as f:
                contents = f.read(maxbytes)
                if len(contents) > 0:

            

Reported by Pylint.

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

Line: 182 Column: 21

                                      contents += '...\n'
                    sepline = '*' * 50 + '\n'
                    out = sepline + filename + '\n' + sepline + contents
                    WiredTigerTestCase.prout(out)

    # Run a method as a subprocess using the run.py machinery.
    # Return the process exit status and the the WiredTiger
    # home directory used by the subprocess.
    def run_subprocess_function(self, directory, funcname):

            

Reported by Pylint.

src/third_party/wiredtiger/bench/workgen/runner/evict-btree-hs.py
73 issues
Unable to import 'wiredtiger'
Error

Line: 78 Column: 1

              ###################################################################################################

from runner import *
from wiredtiger import *
from workgen import *

context = Context()
conn_config =   "cache_size=1G,checkpoint=(wait=60,log_size=2GB),\
                eviction=(threads_min=12,threads_max=12),log=(enabled=true),session_max=800,\

            

Reported by Pylint.

Unable to import 'workgen'
Error

Line: 79 Column: 1

              
from runner import *
from wiredtiger import *
from workgen import *

context = Context()
conn_config =   "cache_size=1G,checkpoint=(wait=60,log_size=2GB),\
                eviction=(threads_min=12,threads_max=12),log=(enabled=true),session_max=800,\
                eviction_target=60,statistics=(fast),statistics_log=(wait=1,json)"# explicitly added

            

Reported by Pylint.

Undefined variable 'Context'
Error

Line: 81 Column: 11

              from wiredtiger import *
from workgen import *

context = Context()
conn_config =   "cache_size=1G,checkpoint=(wait=60,log_size=2GB),\
                eviction=(threads_min=12,threads_max=12),log=(enabled=true),session_max=800,\
                eviction_target=60,statistics=(fast),statistics_log=(wait=1,json)"# explicitly added
conn = context.wiredtiger_open("create," + conn_config)
s = conn.open_session("")

            

Reported by Pylint.

Undefined variable 'Table'
Error

Line: 97 Column: 13

              table_count = 1
for i in range(0, table_count):
    tname = "table:test" + str(i)
    table = Table(tname)
    s.create(tname, wtperf_table_config +\
             compress_table_config + table_config)
    table.options.key_size = 200
    table.options.value_size = 5000
    tables.append(table)

            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 108 Column: 21

              icount = 500000
# If there are multiple tables to be filled during populate,
# the icount is split between them all.
pop_ops = Operation(Operation.OP_INSERT, tables[0])
pop_ops = op_multi_table(pop_ops, tables)
nops_per_thread = icount // (populate_threads * table_count)
pop_thread = Thread(pop_ops * nops_per_thread)
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)

            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 108 Column: 11

              icount = 500000
# If there are multiple tables to be filled during populate,
# the icount is split between them all.
pop_ops = Operation(Operation.OP_INSERT, tables[0])
pop_ops = op_multi_table(pop_ops, tables)
nops_per_thread = icount // (populate_threads * table_count)
pop_thread = Thread(pop_ops * nops_per_thread)
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)

            

Reported by Pylint.

Undefined variable 'Thread'
Error

Line: 111 Column: 14

              pop_ops = Operation(Operation.OP_INSERT, tables[0])
pop_ops = op_multi_table(pop_ops, tables)
nops_per_thread = icount // (populate_threads * table_count)
pop_thread = Thread(pop_ops * nops_per_thread)
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)

# Log like file, requires that logging be enabled in the connection config.
log_name = "table:log"

            

Reported by Pylint.

Undefined variable 'Workload'
Error

Line: 112 Column: 16

              pop_ops = op_multi_table(pop_ops, tables)
nops_per_thread = icount // (populate_threads * table_count)
pop_thread = Thread(pop_ops * nops_per_thread)
pop_workload = Workload(context, populate_threads * pop_thread)
pop_workload.run(conn)

# Log like file, requires that logging be enabled in the connection config.
log_name = "table:log"
s.create(log_name, wtperf_table_config + "key_format=S,value_format=S," +\

            

Reported by Pylint.

Undefined variable 'Table'
Error

Line: 119 Column: 13

              log_name = "table:log"
s.create(log_name, wtperf_table_config + "key_format=S,value_format=S," +\
        compress_table_config + table_config + ",log=(enabled=true)")
log_table = Table(log_name)

ops = Operation(Operation.OP_SEARCH, tables[0],Key(Key.KEYGEN_PARETO, 0, ParetoOptions(1)))
ops = op_multi_table(ops, tables, False)
ops = op_log_like(ops, log_table, 0)
thread0 = Thread(ops)

            

Reported by Pylint.

Undefined variable 'Key'
Error

Line: 121 Column: 48

                      compress_table_config + table_config + ",log=(enabled=true)")
log_table = Table(log_name)

ops = Operation(Operation.OP_SEARCH, tables[0],Key(Key.KEYGEN_PARETO, 0, ParetoOptions(1)))
ops = op_multi_table(ops, tables, False)
ops = op_log_like(ops, log_table, 0)
thread0 = Thread(ops)

ops = Operation(Operation.OP_INSERT, tables[0])

            

Reported by Pylint.

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

Line: 8 Column: 1

              import os
import signal

from extras import try_import

from testtools import (
    skipIf,
    TestCase,
    )

            

Reported by Pylint.

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

Line: 212 Column: 16

                      # returns an empty list.
        reactor = self.make_reactor()
        spinner = self.make_spinner(reactor)
        call = reactor.callLater(10, lambda: None)
        results = spinner._clean()
        self.assertThat(results, Equals([call]))
        self.assertThat(call.active(), Equals(False))

    def test_clean_delayed_call_cancelled(self):

            

Reported by Pylint.

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

Line: 222 Column: 16

                      # longer there.
        reactor = self.make_reactor()
        spinner = self.make_spinner(reactor)
        call = reactor.callLater(10, lambda: None)
        call.cancel()
        results = spinner._clean()
        self.assertThat(results, Equals([]))

    def test_clean_selectables(self):

            

Reported by Pylint.

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

Line: 235 Column: 16

                      from twisted.internet.protocol import ServerFactory
        reactor = self.make_reactor()
        spinner = self.make_spinner(reactor)
        port = reactor.listenTCP(0, ServerFactory(), interface='127.0.0.1')
        spinner.run(self.make_timeout(), lambda: None)
        results = spinner.get_junk()
        self.assertThat(results, Equals([port]))

    def test_clean_running_threads(self):

            

Reported by Pylint.

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

Line: 247 Column: 30

                      reactor = self.make_reactor()
        timeout = self.make_timeout()
        spinner = self.make_spinner(reactor)
        spinner.run(timeout, reactor.callInThread, time.sleep, timeout / 2.0)
        # Python before 2.5 has a race condition with thread handling where
        # join() does not remove threads from enumerate before returning - the
        # thread being joined does the removal. This was fixed in Python 2.5
        # but we still support 2.4, so we have to workaround the issue.
        # http://bugs.python.org/issue1703448.

            

Reported by Pylint.

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

Line: 265 Column: 34

                      reactor = self.make_reactor()
        spinner = self.make_spinner(reactor)
        port = spinner.run(
            self.make_timeout(), reactor.listenTCP, 0, ServerFactory(), interface='127.0.0.1')
        self.assertThat(spinner.get_junk(), Equals([port]))

    def test_will_not_run_with_previous_junk(self):
        # If 'run' is called and there's still junk in the spinner's junk
        # list, then the spinner will refuse to run.

            

Reported by Pylint.

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

Line: 275 Column: 30

                      reactor = self.make_reactor()
        spinner = self.make_spinner(reactor)
        timeout = self.make_timeout()
        spinner.run(timeout, reactor.listenTCP, 0, ServerFactory(), interface='127.0.0.1')
        self.assertThat(lambda: spinner.run(timeout, lambda: None),
            Raises(MatchesException(_spinner.StaleJunkError)))

    def test_clear_junk_clears_previous_junk(self):
        # If 'run' is called and there's still junk in the spinner's junk

            

Reported by Pylint.

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

Line: 286 Column: 37

                      reactor = self.make_reactor()
        spinner = self.make_spinner(reactor)
        timeout = self.make_timeout()
        port = spinner.run(timeout, reactor.listenTCP, 0, ServerFactory(), interface='127.0.0.1')
        junk = spinner.clear_junk()
        self.assertThat(junk, Equals([port]))
        self.assertThat(spinner.get_junk(), Equals([]))

    @skipIf(os.name != "posix", "Sending SIGINT with os.kill is posix only")

            

Reported by Pylint.

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

Line: 300 Column: 9

                      reactor = self.make_reactor()
        spinner = self.make_spinner(reactor)
        timeout = self.make_timeout()
        reactor.callLater(timeout, os.kill, os.getpid(), SIGINT)
        self.assertThat(lambda:spinner.run(timeout * 5, defer.Deferred),
            Raises(MatchesException(_spinner.NoResultError)))
        self.assertEqual([], spinner._clean())

    @skipIf(os.name != "posix", "Sending SIGINT with os.kill is posix only")

            

Reported by Pylint.

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

Line: 321 Column: 9

                      reactor = self.make_reactor()
        spinner = self.make_spinner(reactor)
        timeout = self.make_timeout()
        reactor.callWhenRunning(os.kill, os.getpid(), SIGINT)
        self.assertThat(lambda:spinner.run(timeout * 5, defer.Deferred),
            Raises(MatchesException(_spinner.NoResultError)))
        self.assertEqual([], spinner._clean())

    @skipIf(os.name != "posix", "Sending SIGINT with os.kill is posix only")

            

Reported by Pylint.

src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid128_div.c
71 issues
Shifting 32-bit value by 49 bits is undefined behaviour
Error

Line: 110 CWE codes: 758

                  exponent_x = DECIMAL_MAX_EXPON_128;
  else if (exponent_x < 0)
    exponent_x = 0;
  res.w[1] |= (((BID_UINT64) exponent_x) << 49);
  res.w[0] = 0;
  BID_RETURN (res);
}
}
if (!valid_y) {

            

Reported by Cppcheck.

Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 163 CWE codes: 758

              
  if (CX.w[1]) {
    T = bid_power10_index_binexp_128[bin_index].w[0];
    __mul_64x128_short (CA, T, CX);
  } else {
    T128 = bid_power10_index_binexp_128[bin_index];
    __mul_64x128_short (CA, CX.w[0], T128);
  }


            

Reported by Cppcheck.

Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 166 CWE codes: 758

                  __mul_64x128_short (CA, T, CX);
  } else {
    T128 = bid_power10_index_binexp_128[bin_index];
    __mul_64x128_short (CA, CX.w[0], T128);
  }

  ed2 = 33;
  if (__unsigned_compare_gt_128 (CY, CA))
    ed2++;

            

Reported by Cppcheck.

Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 174 CWE codes: 758

                  ed2++;

  T128 = bid_power10_table_128[ed2];
  __mul_128x128_to_256 (CA4, CA, T128);

  ed2 += bid_estimate_decimal_digits[bin_index];
  CQ.w[0] = CQ.w[1] = 0;
  diff_expon = diff_expon - ed2;


            

Reported by Cppcheck.

Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 208 CWE codes: 758

                ed2 = 34 - digits_q;
  T128.w[0] = bid_power10_table_128[ed2].w[0];
  T128.w[1] = bid_power10_table_128[ed2].w[1];
  __mul_128x128_to_256 (CA4, CR, T128);
  diff_expon = diff_expon - ed2;
  __mul_128x128_low (CQ, CQ, T128);

}


            

Reported by Cppcheck.

Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 210 CWE codes: 758

                T128.w[1] = bid_power10_table_128[ed2].w[1];
  __mul_128x128_to_256 (CA4, CR, T128);
  diff_expon = diff_expon - ed2;
  __mul_128x128_low (CQ, CQ, T128);

}

bid___div_256_by_128 (&CQ, &CA4, CY);


            

Reported by Cppcheck.

Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 243 CWE codes: 758

                  if (d5 < nzeros)
      nzeros = d5;
    // get P*(2^M[extra_digits])/10^extra_digits
    __mul_128x128_full (Qh, Ql, CQ, bid_reciprocals10_128[nzeros]);

    // now get P/10^extra_digits: shift Q_high right by M[extra_digits]-128
    amount = bid_recip_scale[nzeros];
    __shr_128_long (CQ, Qh, amount);


            

Reported by Cppcheck.

Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 255 CWE codes: 758

                  //T128 = bid_reciprocals10_128[17];
    T128.w[0] = 0x44909befeb9fad49ull;
    T128.w[1] = 0x000b877aa3236a4bull;
    __mul_128x128_to_256 (P256, CQ, T128);
    //amount = bid_recip_scale[17];
    Q_high = (P256.w[2] >> 44) | (P256.w[3] << (64 - 44));
    Q_low = CQ.w[0] - Q_high * 100000000000000000ull;

    if (!Q_low) {

            

Reported by Cppcheck.

Shifting 32-bit value by 44 bits is undefined behaviour
Error

Line: 257 CWE codes: 758

                  T128.w[1] = 0x000b877aa3236a4bull;
    __mul_128x128_to_256 (P256, CQ, T128);
    //amount = bid_recip_scale[17];
    Q_high = (P256.w[2] >> 44) | (P256.w[3] << (64 - 44));
    Q_low = CQ.w[0] - Q_high * 100000000000000000ull;

    if (!Q_low) {
      diff_expon += 17;


            

Reported by Cppcheck.

Shifting 32-bit value by 40 bits is undefined behaviour
Error

Line: 295 CWE codes: 758

              	}
	// decompose digit
	PD = (BID_UINT64) digit *0x068DB8BBull;
	digit_h = (BID_UINT32) (PD >> 40);
	digit_low = digit - digit_h * 10000;

	if (!digit_low)
	  nzeros += 4;
	else

            

Reported by Cppcheck.

src/third_party/wiredtiger/test/suite/test_assert04.py
71 issues
Unable to import 'wiredtiger'
Error

Line: 34 Column: 1

              #

from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios

class test_assert04(wttest.WiredTigerTestCase, suite_subprocess):
    session_config = 'isolation=snapshot'


            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 124 Column: 13

                          'commit_timestamp=' + self.timestamp_str(4))
        c[key_ts1] = 'value4'
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.commit_transaction(), msg_ooo)
        c.close()

        # Detect not using a timestamp.
        c = self.session.open_cursor(uri)
        self.session.begin_transaction()

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 132 Column: 13

                      self.session.begin_transaction()
        c[key_ts1] = 'value_nots3'
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.commit_transaction(), msg_usage)
        c.close()

        # Detect using a timestamp on the non-timestamp key.
        # We must first use a non timestamped operation on the key
        # in order to violate the key consistency condition in the

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 151 Column: 13

                          'commit_timestamp=' + self.timestamp_str(3))
        c[key_nots] = 'value3'
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.commit_transaction(), msg_usage)
        c.close()

        c = self.session.open_cursor(uri)
        self.assertEquals(c[key_ts1], 'value5')
        self.assertEquals(c[key_nots], 'value_nots3')

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 155 Column: 9

                      c.close()

        c = self.session.open_cursor(uri)
        self.assertEquals(c[key_ts1], 'value5')
        self.assertEquals(c[key_nots], 'value_nots3')
        c.close()

        # Now alter the setting again and detection is off.
        self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(5))

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 156 Column: 9

              
        c = self.session.open_cursor(uri)
        self.assertEquals(c[key_ts1], 'value5')
        self.assertEquals(c[key_nots], 'value_nots3')
        c.close()

        # Now alter the setting again and detection is off.
        self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(5))
        self.session.alter(uri, cfg_off)

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 215 Column: 13

                          'commit_timestamp=' + self.timestamp_str(1))
        c[key_ts1] = 'value1'
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.commit_transaction(), msg_ooo)
        c.close()

        # Make sure we can successfully add a different key at timestamp 1.
        c = self.session.open_cursor(uri)
        self.session.begin_transaction()

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 252 Column: 13

                      c[key_ts3] = 'value13'
        c[key_ts4] = 'value13'
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.commit_transaction(), msg_ooo)
        c.close()

        c = self.session.open_cursor(uri)
        self.assertEquals(c[key_ts3], 'value10')
        self.assertEquals(c[key_ts4], 'value15')

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 256 Column: 9

                      c.close()

        c = self.session.open_cursor(uri)
        self.assertEquals(c[key_ts3], 'value10')
        self.assertEquals(c[key_ts4], 'value15')
        c.close()

        #
        # Separately, we should be able to update key_ts3 at timestamp 10

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 257 Column: 9

              
        c = self.session.open_cursor(uri)
        self.assertEquals(c[key_ts3], 'value10')
        self.assertEquals(c[key_ts4], 'value15')
        c.close()

        #
        # Separately, we should be able to update key_ts3 at timestamp 10
        # but not update key_ts4 inserted at timestamp 15.

            

Reported by Pylint.