The following issues were found
src/third_party/wiredtiger/bench/workgen/runner/small_btree_reopen.py
41 issues
Line: 31
Column: 1
#
from runner import *
from wiredtiger import *
from workgen import *
context = Context()
conn = context.wiredtiger_open("create,cache_size=500MB")
s = conn.open_session()
Reported by Pylint.
Line: 32
Column: 1
from runner import *
from wiredtiger import *
from workgen import *
context = Context()
conn = context.wiredtiger_open("create,cache_size=500MB")
s = conn.open_session()
tname = "file:test.wt"
Reported by Pylint.
Line: 34
Column: 11
from wiredtiger import *
from workgen import *
context = Context()
conn = context.wiredtiger_open("create,cache_size=500MB")
s = conn.open_session()
tname = "file:test.wt"
s.create(tname, 'key_format=S,value_format=S')
table = Table(tname)
Reported by Pylint.
Line: 39
Column: 9
s = conn.open_session()
tname = "file:test.wt"
s.create(tname, 'key_format=S,value_format=S')
table = Table(tname)
table.options.key_size = 20
table.options.value_size = 100
op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
Reported by Pylint.
Line: 43
Column: 16
table.options.key_size = 20
table.options.value_size = 100
op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)
Reported by Pylint.
Line: 43
Column: 6
table.options.key_size = 20
table.options.value_size = 100
op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)
Reported by Pylint.
Line: 44
Column: 10
table.options.value_size = 100
op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)
op = Operation(Operation.OP_SEARCH, table)
Reported by Pylint.
Line: 45
Column: 16
op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)
op = Operation(Operation.OP_SEARCH, table)
op._config = 'reopen'
Reported by Pylint.
Line: 49
Column: 6
print('populate:')
pop_workload.run(conn)
op = Operation(Operation.OP_SEARCH, table)
op._config = 'reopen'
t = Thread(op)
workload = Workload(context, t * 8)
workload.options.run_time = 120
workload.options.report_interval = 5
Reported by Pylint.
Line: 49
Column: 16
print('populate:')
pop_workload.run(conn)
op = Operation(Operation.OP_SEARCH, table)
op._config = 'reopen'
t = Thread(op)
workload = Workload(context, t * 8)
workload.options.run_time = 120
workload.options.report_interval = 5
Reported by Pylint.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Job.py
41 issues
Line: 141
Column: 21
SCons forks before executing another process. In that case, we
want the child to exit immediately.
"""
def handler(signum, stack, self=self, parentpid=os.getpid()):
if os.getpid() == parentpid:
self.job.taskmaster.stop()
self.job.interrupted.set()
else:
os._exit(2)
Reported by Pylint.
Line: 141
Column: 29
SCons forks before executing another process. In that case, we
want the child to exit immediately.
"""
def handler(signum, stack, self=self, parentpid=os.getpid()):
if os.getpid() == parentpid:
self.job.taskmaster.stop()
self.job.interrupted.set()
else:
os._exit(2)
Reported by Pylint.
Line: 146
Column: 17
self.job.taskmaster.stop()
self.job.interrupted.set()
else:
os._exit(2)
self.old_sigint = signal.signal(signal.SIGINT, handler)
self.old_sigterm = signal.signal(signal.SIGTERM, handler)
try:
self.old_sighup = signal.signal(signal.SIGHUP, handler)
Reported by Pylint.
Line: 148
Column: 9
else:
os._exit(2)
self.old_sigint = signal.signal(signal.SIGINT, handler)
self.old_sigterm = signal.signal(signal.SIGTERM, handler)
try:
self.old_sighup = signal.signal(signal.SIGHUP, handler)
except AttributeError:
pass
Reported by Pylint.
Line: 149
Column: 9
os._exit(2)
self.old_sigint = signal.signal(signal.SIGINT, handler)
self.old_sigterm = signal.signal(signal.SIGTERM, handler)
try:
self.old_sighup = signal.signal(signal.SIGHUP, handler)
except AttributeError:
pass
Reported by Pylint.
Line: 151
Column: 13
self.old_sigint = signal.signal(signal.SIGINT, handler)
self.old_sigterm = signal.signal(signal.SIGTERM, handler)
try:
self.old_sighup = signal.signal(signal.SIGHUP, handler)
except AttributeError:
pass
def _reset_sig_handler(self):
"""Restore the signal handlers to their previous state (before the
Reported by Pylint.
Line: 202
Column: 20
task.prepare()
if task.needs_execute():
task.execute()
except Exception:
if self.interrupted():
try:
raise SCons.Errors.BuildError(
task.targets[0], errstr=interrupt_msg)
except:
Reported by Pylint.
Line: 205
Column: 25
except Exception:
if self.interrupted():
try:
raise SCons.Errors.BuildError(
task.targets[0], errstr=interrupt_msg)
except:
task.exception_set()
else:
task.exception_set()
Reported by Pylint.
Line: 207
Column: 21
try:
raise SCons.Errors.BuildError(
task.targets[0], errstr=interrupt_msg)
except:
task.exception_set()
else:
task.exception_set()
# Let the failed() callback function arrange for the
Reported by Pylint.
Line: 259
Column: 17
raise SCons.Errors.BuildError(
task.targets[0], errstr=interrupt_msg)
task.execute()
except:
task.exception_set()
ok = False
else:
ok = True
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_stat02.py
41 issues
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import itertools, wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtdataset import SimpleDataSet, SimpleLSMDataSet, ComplexDataSet, \
ComplexLSMDataSet
from wtscenario import make_scenarios
from wiredtiger import stat
Reported by Pylint.
Line: 34
Column: 1
from wtdataset import SimpleDataSet, SimpleLSMDataSet, ComplexDataSet, \
ComplexLSMDataSet
from wtscenario import make_scenarios
from wiredtiger import stat
# test_stat02.py
# Statistics cursor configurations.
class test_stat_cursor_config(wttest.WiredTigerTestCase):
pfx = 'test_stat_cursor_config'
Reported by Pylint.
Line: 62
Column: 5
scenarios = make_scenarios(uri, data_config, cursor_config)
# Turn on statistics for this test.
def conn_config(self):
return 'statistics=(%s)' % self.data_config
# For each database/cursor configuration, confirm the right combinations
# succeed or fail.
def test_stat_cursor_config(self):
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import itertools, wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtdataset import SimpleDataSet, SimpleLSMDataSet, ComplexDataSet, \
ComplexLSMDataSet
from wtscenario import make_scenarios
from wiredtiger import stat
Reported by Pylint.
Line: 158
Column: 35
# Test connection error combinations.
class test_stat_cursor_conn_error(wttest.WiredTigerTestCase):
def setUpConnectionOpen(self, dir):
return None
def setUpSessionOpen(self, conn):
return None
def test_stat_cursor_conn_error(self):
Reported by Pylint.
Line: 158
Column: 35
# Test connection error combinations.
class test_stat_cursor_conn_error(wttest.WiredTigerTestCase):
def setUpConnectionOpen(self, dir):
return None
def setUpSessionOpen(self, conn):
return None
def test_stat_cursor_conn_error(self):
Reported by Pylint.
Line: 158
Column: 5
# Test connection error combinations.
class test_stat_cursor_conn_error(wttest.WiredTigerTestCase):
def setUpConnectionOpen(self, dir):
return None
def setUpSessionOpen(self, conn):
return None
def test_stat_cursor_conn_error(self):
Reported by Pylint.
Line: 169
Column: 51
config = 'create,statistics=(' + i[0] + ',' + i[1] + ')'
msg = '/Only one of/'
self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
lambda: self.wiredtiger_open('.', config), msg)
# Test data-source error combinations.
class test_stat_cursor_dsrc_error(wttest.WiredTigerTestCase):
pfx = 'test_stat_cursor_dsrc_error'
Reported by Pylint.
Line: 193
Column: 49
msg = '/Only one of/'
self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
lambda: self.session.open_cursor(
'statistics:' + self.uri, None, config), msg)
# Test data-source cache walk statistics
class test_stat_cursor_dsrc_cache_walk(wttest.WiredTigerTestCase):
uri = 'file:test_stat_cursor_dsrc_cache_walk'
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
Reported by Pylint.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid128_round_integral.c
40 issues
Line: 193
CWE codes:
758
if (C1.w[1] == 0) {
if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
// split the 64-bit value in two 32-bit halves to avoid rounding errors
tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
} else { // if x < 2^53
tmp1.d = (double) C1.w[0]; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
Reported by Cppcheck.
Line: 194
CWE codes:
758
if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
// split the 64-bit value in two 32-bit halves to avoid rounding errors
tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
} else { // if x < 2^53
tmp1.d = (double) C1.w[0]; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
}
Reported by Cppcheck.
Line: 198
CWE codes:
758
} else { // if x < 2^53
tmp1.d = (double) C1.w[0]; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
}
} else { // C1.w[1] != 0 => nr. bits = 64 + nr_bits (C1.w[1])
tmp1.d = (double) C1.w[1]; // exact conversion
x_nr_bits =
65 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
Reported by Cppcheck.
Line: 203
CWE codes:
758
} else { // C1.w[1] != 0 => nr. bits = 64 + nr_bits (C1.w[1])
tmp1.d = (double) C1.w[1]; // exact conversion
x_nr_bits =
65 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
}
q = bid_nr_digits[x_nr_bits - 1].digits;
if (q == 0) {
q = bid_nr_digits[x_nr_bits - 1].digits1;
Reported by Cppcheck.
Line: 214
CWE codes:
758
C1.w[0] >= bid_nr_digits[x_nr_bits - 1].threshold_lo))
q++;
}
exp = (x_exp >> 49) - 6176;
if (exp >= 0) { // -exp <= 0
// the argument is an integer already
res.w[1] = x.w[1];
res.w[0] = x.w[0];
BID_RETURN (res);
Reported by Cppcheck.
Line: 246
CWE codes:
758
// kx = 10^(-x) = bid_ten2mk128[ind - 1]
// C* = (C1 + 1/2 * 10^x) * 10^(-x)
// the approximation of 10^(-x) was rounded up to 118 bits
__mul_128x128_to_256 (P256, C1, bid_ten2mk128[ind - 1]);
// determine the value of res and fstar
// determine inexactness of the rounding of C*
// if (0 < f* - 1/2 < 10^(-x)) then
// the result is exact
Reported by Cppcheck.
Line: 393
CWE codes:
758
// kx = 10^(-x) = bid_ten2mk128[ind - 1]
// C* = (C1 + 1/2 * 10^x) * 10^(-x)
// the approximation of 10^(-x) was rounded up to 118 bits
__mul_128x128_to_256 (P256, C1, bid_ten2mk128[ind - 1]);
// the top Ex bits of 10^(-x) are T* = bid_ten2mk128trunc[ind], e.g.
// if x=1, T*=bid_ten2mk128trunc[0]=0x19999999999999999999999999999999
// if (0 < f* < 10^(-x)) then the result is a midpoint
// if floor(C*) is even then C* = floor(C*) - logical right
// shift; C* has p decimal digits, correct by Prop. 1)
Reported by Cppcheck.
Line: 523
CWE codes:
758
// kx = 10^(-x) = bid_ten2mk128[ind - 1]
// C* = (C1 + 1/2 * 10^x) * 10^(-x)
// the approximation of 10^(-x) was rounded up to 118 bits
__mul_128x128_to_256 (P256, C1, bid_ten2mk128[ind - 1]);
if (ind - 1 <= 2) { // 0 <= ind - 1 <= 2 => shift = 0
res.w[1] = P256.w[3];
res.w[0] = P256.w[2];
// redundant fstar.w[3] = 0;
// redundant fstar.w[2] = 0;
Reported by Cppcheck.
Line: 632
CWE codes:
758
// kx = 10^(-x) = bid_ten2mk128[ind - 1]
// C* = C1 * 10^(-x)
// the approximation of 10^(-x) was rounded up to 118 bits
__mul_128x128_to_256 (P256, C1, bid_ten2mk128[ind - 1]);
if (ind - 1 <= 2) { // 0 <= ind - 1 <= 2 => shift = 0
res.w[1] = P256.w[3];
res.w[0] = P256.w[2];
// redundant fstar.w[3] = 0;
// redundant fstar.w[2] = 0;
Reported by Cppcheck.
Line: 741
CWE codes:
758
// kx = 10^(-x) = bid_ten2mk128[ind - 1]
// C* = (C1 + 1/2 * 10^x) * 10^(-x)
// the approximation of 10^(-x) was rounded up to 118 bits
__mul_128x128_to_256 (P256, C1, bid_ten2mk128[ind - 1]);
if (ind - 1 <= 2) { // 0 <= ind - 1 <= 2 => shift = 0
res.w[1] = P256.w[3];
res.w[0] = P256.w[2];
// redundant fstar.w[3] = 0;
// redundant fstar.w[2] = 0;
Reported by Cppcheck.
src/third_party/wiredtiger/test/suite/test_prepare08.py
40 issues
Line: 31
Column: 1
import fnmatch, os, shutil, time
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
# test_prepare08.py
# Test to ensure prepared tombstones are properly aborted/committed even when they are written
Reported by Pylint.
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import fnmatch, os, shutil, time
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
Reported by Pylint.
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import fnmatch, os, shutil, time
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
Reported by Pylint.
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import fnmatch, os, shutil, time
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
Reported by Pylint.
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import fnmatch, os, shutil, time
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import fnmatch, os, shutil, time
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
# test_prepare08.py
Reported by Pylint.
Line: 55
Column: 13
for i in range(1, nrows):
cursor.set_key(ds.key(i))
cursor.set_value(value)
self.assertEquals(cursor.update(), 0)
self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(ts))
cursor.close()
def removes(self, ds, uri, nrows, ts):
cursor = self.session.open_cursor(uri)
Reported by Pylint.
Line: 64
Column: 13
self.session.begin_transaction('isolation=snapshot')
for i in range(1, nrows):
cursor.set_key(ds.key(i))
self.assertEquals(cursor.remove(), 0)
self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(ts))
cursor.close()
def check(self, ds, uri, nrows, value, ts, release_evict):
if release_evict:
Reported by Pylint.
Line: 79
Column: 17
if value == None:
self.assertEqual(cursor.search(), wiredtiger.WT_NOTFOUND)
else:
self.assertEquals(cursor.search(), 0)
self.assertEquals(cursor.get_value(),value)
cursor.reset()
self.session.commit_transaction()
cursor.close()
Reported by Pylint.
Line: 80
Column: 17
self.assertEqual(cursor.search(), wiredtiger.WT_NOTFOUND)
else:
self.assertEquals(cursor.search(), 0)
self.assertEquals(cursor.get_value(),value)
cursor.reset()
self.session.commit_transaction()
cursor.close()
def test_prepare_delete_rollback(self):
Reported by Pylint.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid64_to_uint32.c
40 issues
Line: 98
CWE codes:
758
// determine first the nr. of bits in x
if (C1 >= 0x0020000000000000ull) { // x >= 2^53
// split the 64-bit value in two 32-bit halves to avoid rounding errors
tmp1.d = (double) (C1 >> 32); // exact conversion
x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
} else { // if x < 2^53
tmp1.d = (double) C1; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
Reported by Cppcheck.
Line: 99
CWE codes:
758
if (C1 >= 0x0020000000000000ull) { // x >= 2^53
// split the 64-bit value in two 32-bit halves to avoid rounding errors
tmp1.d = (double) (C1 >> 32); // exact conversion
x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
} else { // if x < 2^53
tmp1.d = (double) C1; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
}
Reported by Cppcheck.
Line: 103
CWE codes:
758
} else { // if x < 2^53
tmp1.d = (double) C1; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
}
q = bid_nr_digits[x_nr_bits - 1].digits;
if (q == 0) {
q = bid_nr_digits[x_nr_bits - 1].digits1;
if (C1 >= bid_nr_digits[x_nr_bits - 1].threshold_lo)
Reported by Cppcheck.
Line: 217
CWE codes:
758
// kx = 10^(-x) = bid_ten2mk64[ind - 1]
// C* = (C1 + 1/2 * 10^x) * 10^(-x)
// the approximation of 10^(-x) was rounded up to 54 bits
__mul_64x64_to_128MACH (P128, C1, bid_ten2mk64[ind - 1]);
Cstar = P128.w[1];
fstar.w[1] = P128.w[1] & bid_maskhigh128[ind - 1];
fstar.w[0] = P128.w[0];
// the top Ex bits of 10^(-x) are T* = bid_ten2mk128trunc[ind].w[0], e.g.
// if x=1, T*=bid_ten2mk128trunc[0].w[0]=0x1999999999999999
Reported by Cppcheck.
Line: 329
CWE codes:
758
// determine first the nr. of bits in x
if (C1 >= 0x0020000000000000ull) { // x >= 2^53
// split the 64-bit value in two 32-bit halves to avoid rounding errors
tmp1.d = (double) (C1 >> 32); // exact conversion
x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
} else { // if x < 2^53
tmp1.d = (double) C1; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
Reported by Cppcheck.
Line: 330
CWE codes:
758
if (C1 >= 0x0020000000000000ull) { // x >= 2^53
// split the 64-bit value in two 32-bit halves to avoid rounding errors
tmp1.d = (double) (C1 >> 32); // exact conversion
x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
} else { // if x < 2^53
tmp1.d = (double) C1; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
}
Reported by Cppcheck.
Line: 334
CWE codes:
758
} else { // if x < 2^53
tmp1.d = (double) C1; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
}
q = bid_nr_digits[x_nr_bits - 1].digits;
if (q == 0) {
q = bid_nr_digits[x_nr_bits - 1].digits1;
if (C1 >= bid_nr_digits[x_nr_bits - 1].threshold_lo)
Reported by Cppcheck.
Line: 452
CWE codes:
758
// kx = 10^(-x) = bid_ten2mk64[ind - 1]
// C* = (C1 + 1/2 * 10^x) * 10^(-x)
// the approximation of 10^(-x) was rounded up to 54 bits
__mul_64x64_to_128MACH (P128, C1, bid_ten2mk64[ind - 1]);
Cstar = P128.w[1];
fstar.w[1] = P128.w[1] & bid_maskhigh128[ind - 1];
fstar.w[0] = P128.w[0];
// the top Ex bits of 10^(-x) are T* = bid_ten2mk128trunc[ind].w[0], e.g.
// if x=1, T*=bid_ten2mk128trunc[0].w[0]=0x1999999999999999
Reported by Cppcheck.
Line: 606
CWE codes:
758
// determine first the nr. of bits in x
if (C1 >= 0x0020000000000000ull) { // x >= 2^53
// split the 64-bit value in two 32-bit halves to avoid rounding errors
tmp1.d = (double) (C1 >> 32); // exact conversion
x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
} else { // if x < 2^53
tmp1.d = (double) C1; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
Reported by Cppcheck.
Line: 607
CWE codes:
758
if (C1 >= 0x0020000000000000ull) { // x >= 2^53
// split the 64-bit value in two 32-bit halves to avoid rounding errors
tmp1.d = (double) (C1 >> 32); // exact conversion
x_nr_bits = 33 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
} else { // if x < 2^53
tmp1.d = (double) C1; // exact conversion
x_nr_bits =
1 + ((((unsigned int) (tmp1.ui64 >> 52)) & 0x7ff) - 0x3ff);
}
Reported by Cppcheck.
src/third_party/wiredtiger/bench/workgen/runner/small_btree.py
40 issues
Line: 31
Column: 1
#
from runner import *
from wiredtiger import *
from workgen import *
context = Context()
conn = context.wiredtiger_open("create,cache_size=500MB")
s = conn.open_session()
Reported by Pylint.
Line: 32
Column: 1
from runner import *
from wiredtiger import *
from workgen import *
context = Context()
conn = context.wiredtiger_open("create,cache_size=500MB")
s = conn.open_session()
tname = "file:test.wt"
Reported by Pylint.
Line: 34
Column: 11
from wiredtiger import *
from workgen import *
context = Context()
conn = context.wiredtiger_open("create,cache_size=500MB")
s = conn.open_session()
tname = "file:test.wt"
s.create(tname, 'key_format=S,value_format=S')
table = Table(tname)
Reported by Pylint.
Line: 39
Column: 9
s = conn.open_session()
tname = "file:test.wt"
s.create(tname, 'key_format=S,value_format=S')
table = Table(tname)
table.options.key_size = 20
table.options.value_size = 100
op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
Reported by Pylint.
Line: 43
Column: 6
table.options.key_size = 20
table.options.value_size = 100
op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)
Reported by Pylint.
Line: 43
Column: 16
table.options.key_size = 20
table.options.value_size = 100
op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)
Reported by Pylint.
Line: 44
Column: 10
table.options.value_size = 100
op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)
op = Operation(Operation.OP_SEARCH, table)
Reported by Pylint.
Line: 45
Column: 16
op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)
op = Operation(Operation.OP_SEARCH, table)
t = Thread(op)
Reported by Pylint.
Line: 49
Column: 6
print('populate:')
pop_workload.run(conn)
op = Operation(Operation.OP_SEARCH, table)
t = Thread(op)
workload = Workload(context, t * 8)
workload.options.run_time = 120
workload.options.report_interval = 5
print('read workload:')
Reported by Pylint.
Line: 49
Column: 16
print('populate:')
pop_workload.run(conn)
op = Operation(Operation.OP_SEARCH, table)
t = Thread(op)
workload = Workload(context, t * 8)
workload.options.run_time = 120
workload.options.report_interval = 5
print('read workload:')
Reported by Pylint.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/javac.py
40 issues
Line: 79
Column: 25
def find_java_files(arg, dirpath, filenames):
java_files = sorted([n for n in filenames
if _my_normcase(n).endswith(js)])
mydir = dirnode.Dir(dirpath)
java_paths = [mydir.File(f) for f in java_files]
for jp in java_paths:
arg[jp] = True
for dirpath, dirnames, filenames in os.walk(dirnode.get_abspath()):
find_java_files(result, dirpath, filenames)
Reported by Pylint.
Line: 83
Column: 26
java_paths = [mydir.File(f) for f in java_files]
for jp in java_paths:
arg[jp] = True
for dirpath, dirnames, filenames in os.walk(dirnode.get_abspath()):
find_java_files(result, dirpath, filenames)
entry.walk(find_java_files, result)
slist.extend(list(result.keys()))
else:
Reported by Pylint.
Line: 202
Column: 5
def generate(env):
"""Add Builders and construction variables for javac to an Environment."""
java_file = SCons.Tool.CreateJavaFileBuilder(env)
java_class = SCons.Tool.CreateJavaClassFileBuilder(env)
java_class_dir = SCons.Tool.CreateJavaClassDirBuilder(env)
java_class.add_emitter(None, emit_java_classes)
java_class.add_emitter(env.subst('$JAVASUFFIX'), emit_java_classes)
java_class_dir.emitter = emit_java_classes
Reported by Pylint.
Line: 241
Column: 12
env['JAVACLASSSUFFIX'] = '.class'
env['JAVASUFFIX'] = '.java'
def exists(env):
return 1
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
Reported by Pylint.
Line: 33
Column: 1
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/javac.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
import os
import os.path
from collections import OrderedDict
Reported by Pylint.
Line: 49
Column: 1
"""Turn a string (path name) into a Java class name."""
return os.path.normpath(path).replace(os.sep, '.')
def emit_java_classes(target, source, env):
"""Create and return lists of source java files
and their corresponding target class files.
"""
java_suffix = env.get('JAVASUFFIX', '.java')
class_suffix = env.get('JAVACLASSSUFFIX', '.class')
Reported by Pylint.
Line: 49
Column: 1
"""Turn a string (path name) into a Java class name."""
return os.path.normpath(path).replace(os.sep, '.')
def emit_java_classes(target, source, env):
"""Create and return lists of source java files
and their corresponding target class files.
"""
java_suffix = env.get('JAVASUFFIX', '.java')
class_suffix = env.get('JAVACLASSSUFFIX', '.class')
Reported by Pylint.
Line: 49
Column: 1
"""Turn a string (path name) into a Java class name."""
return os.path.normpath(path).replace(os.sep, '.')
def emit_java_classes(target, source, env):
"""Create and return lists of source java files
and their corresponding target class files.
"""
java_suffix = env.get('JAVASUFFIX', '.java')
class_suffix = env.get('JAVACLASSSUFFIX', '.class')
Reported by Pylint.
Line: 59
Column: 5
target[0].must_be_same(SCons.Node.FS.Dir)
classdir = target[0]
s = source[0].rentry().disambiguate()
if isinstance(s, SCons.Node.FS.File):
sourcedir = s.dir.rdir()
elif isinstance(s, SCons.Node.FS.Dir):
sourcedir = s.rdir()
else:
Reported by Pylint.
Line: 68
Column: 5
raise SCons.Errors.UserError("Java source must be File or Dir, not '%s'" % s.__class__)
slist = []
js = _my_normcase(java_suffix)
for entry in source:
entry = entry.rentry().disambiguate()
if isinstance(entry, SCons.Node.FS.File):
slist.append(entry)
elif isinstance(entry, SCons.Node.FS.Dir):
Reported by Pylint.
src/third_party/wiredtiger/test/suite/wtscenario.py
40 issues
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import testscenarios
import suite_random
# wtscenarios.py
# Support scenarios based testing
def powerrange(start, stop, mult):
Reported by Pylint.
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import testscenarios
import suite_random
# wtscenarios.py
# Support scenarios based testing
def powerrange(start, stop, mult):
Reported by Pylint.
Line: 154
Column: 5
return scene[1]['_order']
def set_long_run(islong):
global _is_long_run
_is_long_run = islong
def prune_scenarios(scenes, default_count = -1, long_count = -1):
"""
Use listed probabilities for pruning the list of scenarios.
Reported by Pylint.
Line: 166
Column: 5
limits the number of scenarios. When a third argument is present,
it is a separate limit for a long run.
"""
global _is_long_run
r = suite_random.suite_random()
result = []
if default_count == -1:
# Missing second arg - return those with P == .3 at
# 30% probability, for example.
Reported by Pylint.
Line: 272
Column: 29
for lmax in powerrange(lmin, 512*megabyte, 1024):
for cache in [megabyte, 32*megabyte, 1000*megabyte]:
scen = wtscenario()
scen.ioverflow = max(imin // 40, 40)
scen.imax = imax
scen.loverflow = max(lmin // 40, 40)
scen.lmax = lmax
scen.cache_size = cache
s.append((scen.shortName(), dict(session_create_scenario=scen)))
Reported by Pylint.
Line: 273
Column: 29
for cache in [megabyte, 32*megabyte, 1000*megabyte]:
scen = wtscenario()
scen.ioverflow = max(imin // 40, 40)
scen.imax = imax
scen.loverflow = max(lmin // 40, 40)
scen.lmax = lmax
scen.cache_size = cache
s.append((scen.shortName(), dict(session_create_scenario=scen)))
return make_scenarios(s)
Reported by Pylint.
Line: 274
Column: 29
scen = wtscenario()
scen.ioverflow = max(imin // 40, 40)
scen.imax = imax
scen.loverflow = max(lmin // 40, 40)
scen.lmax = lmax
scen.cache_size = cache
s.append((scen.shortName(), dict(session_create_scenario=scen)))
return make_scenarios(s)
Reported by Pylint.
Line: 275
Column: 29
scen.ioverflow = max(imin // 40, 40)
scen.imax = imax
scen.loverflow = max(lmin // 40, 40)
scen.lmax = lmax
scen.cache_size = cache
s.append((scen.shortName(), dict(session_create_scenario=scen)))
return make_scenarios(s)
def shortName(self):
Reported by Pylint.
Line: 276
Column: 29
scen.imax = imax
scen.loverflow = max(lmin // 40, 40)
scen.lmax = lmax
scen.cache_size = cache
s.append((scen.shortName(), dict(session_create_scenario=scen)))
return make_scenarios(s)
def shortName(self):
"""
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
Reported by Pylint.
src/third_party/wiredtiger/test/evergreen/evg_cfg.py
40 issues
Line: 145
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b602_subprocess_popen_with_shell_equals_true.html
# Search keyword in Makefile.am to identify directories that involve test configuration.
# Need to use subprocess 'shell=True' to get the expected shell command output.
cmd = "find . -name Makefile.am -exec grep -H -e '^TESTS =' {} \; | cut -d: -f1 | cut -c3-"
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
mkfiles_with_tests = p.stdout.readlines()
# Need some string manipulation work here against the subprocess output.
# Cast elements to string, and strip the ending from the string to get directory names.
ending = '/Makefile.am\n'
Reported by Bandit.
Line: 13
Column: 5
import subprocess
try:
import docopt
except Exception as e:
modules = "docopt"
print("ERROR [%s]: %s" % (sys.argv[0], e))
print("Use pip to install the required library:")
print(" pip install %s" % modules)
Reported by Pylint.
Line: 14
Column: 8
try:
import docopt
except Exception as e:
modules = "docopt"
print("ERROR [%s]: %s" % (sys.argv[0], e))
print("Use pip to install the required library:")
print(" pip install %s" % modules)
sys.exit(0)
Reported by Pylint.
Line: 71
Column: 12
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip().decode()
except Exception as e:
sys.exit("ERROR [%s]: %s" % (prog, e))
return output
def find_tests_missing_evg_cfg(test_type, dirs, evg_cfg_file):
Reported by Pylint.
Line: 76
Column: 32
return output
def find_tests_missing_evg_cfg(test_type, dirs, evg_cfg_file):
"""
Check the list of 'make check' directories to find out those
that are missing from the Evergreen configuration file.
The existing Evergreen configuration is expected to have
Reported by Pylint.
Line: 93
Column: 9
assert os.path.isfile(evg_cfg_file), "'%s' does not exist" % evg_cfg_file
with open(evg_cfg_file, 'r') as f:
evg_cfg = f.readlines()
debug('\n')
missing_tests = {}
for d in dirs:
# Figure out the Evergreen task name from the directory name
Reported by Pylint.
Line: 144
Column: 68
# Search keyword in Makefile.am to identify directories that involve test configuration.
# Need to use subprocess 'shell=True' to get the expected shell command output.
cmd = "find . -name Makefile.am -exec grep -H -e '^TESTS =' {} \; | cut -d: -f1 | cut -c3-"
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
mkfiles_with_tests = p.stdout.readlines()
# Need some string manipulation work here against the subprocess output.
# Cast elements to string, and strip the ending from the string to get directory names.
Reported by Pylint.
Line: 180
Column: 25
return csuite_dirs
def check_missing_tests(test_type):
"""
Check to see if any tests are missing from the Evergreen configuration.
Loop through the list of directories in 'Make.subdirs' file and skip a few known
directories that do not require any test.
"""
Reported by Pylint.
Line: 197
Column: 27
return find_tests_missing_evg_cfg(test_type, test_dirs, EVG_CFG_FILE)
def get_evg_task_template(test_type):
""" Retrieve the Evergreen task template based on test type """
if test_type == 'make_check':
template_file = MAKE_CHECK_TEST_TMPLT
elif test_type == 'csuite':
Reported by Pylint.
Line: 214
Column: 23
return template
def get_search_string(test_type):
""" Retrieve the search string based on test_type """
if test_type == 'make_check':
search_str = MAKE_CHECK_TEST_SEARCH_STR
elif test_type == 'csuite':
Reported by Pylint.