The following issues were found
src/third_party/wiredtiger/test/suite/test_durable_rollback_to_stable.py
38 issues
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
# test_durable_rollback_to_stable.py
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.
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
# test_durable_rollback_to_stable.py
Reported by Pylint.
Line: 82
Column: 9
# Update all values with value 111 i.e. first update value.
session.begin_transaction()
self.assertEquals(cursor.next(), 0)
for i in range(1, 50):
cursor.set_value(ds.value(111))
self.assertEquals(cursor.update(), 0)
self.assertEquals(cursor.next(), 0)
Reported by Pylint.
Line: 85
Column: 13
self.assertEquals(cursor.next(), 0)
for i in range(1, 50):
cursor.set_value(ds.value(111))
self.assertEquals(cursor.update(), 0)
self.assertEquals(cursor.next(), 0)
session.prepare_transaction('prepare_timestamp=' + self.timestamp_str(150))
session.timestamp_transaction('commit_timestamp=' + self.timestamp_str(200))
session.timestamp_transaction('durable_timestamp=' + self.timestamp_str(220))
Reported by Pylint.
Line: 86
Column: 13
for i in range(1, 50):
cursor.set_value(ds.value(111))
self.assertEquals(cursor.update(), 0)
self.assertEquals(cursor.next(), 0)
session.prepare_transaction('prepare_timestamp=' + self.timestamp_str(150))
session.timestamp_transaction('commit_timestamp=' + self.timestamp_str(200))
session.timestamp_transaction('durable_timestamp=' + self.timestamp_str(220))
session.commit_transaction()
Reported by Pylint.
Line: 95
Column: 9
# Check the values read are correct with different timestamps.
# Read the initial dataset.
self.assertEquals(cursor.reset(), 0)
session.begin_transaction('read_timestamp=' + self.timestamp_str(150))
self.assertEquals(cursor.next(), 0)
for i in range(1, 50):
self.assertEquals(cursor.get_value(), ds.value(i))
self.assertEquals(cursor.next(), 0)
Reported by Pylint.
Line: 97
Column: 9
# Read the initial dataset.
self.assertEquals(cursor.reset(), 0)
session.begin_transaction('read_timestamp=' + self.timestamp_str(150))
self.assertEquals(cursor.next(), 0)
for i in range(1, 50):
self.assertEquals(cursor.get_value(), ds.value(i))
self.assertEquals(cursor.next(), 0)
session.commit_transaction()
Reported by Pylint.
Line: 99
Column: 13
session.begin_transaction('read_timestamp=' + self.timestamp_str(150))
self.assertEquals(cursor.next(), 0)
for i in range(1, 50):
self.assertEquals(cursor.get_value(), ds.value(i))
self.assertEquals(cursor.next(), 0)
session.commit_transaction()
# Read the first update value with timestamp.
self.assertEquals(cursor.reset(), 0)
Reported by Pylint.
Line: 100
Column: 13
self.assertEquals(cursor.next(), 0)
for i in range(1, 50):
self.assertEquals(cursor.get_value(), ds.value(i))
self.assertEquals(cursor.next(), 0)
session.commit_transaction()
# Read the first update value with timestamp.
self.assertEquals(cursor.reset(), 0)
session.begin_transaction('read_timestamp=' + self.timestamp_str(200))
Reported by Pylint.
src/third_party/zstandard-1.4.4/zstd/programs/fileio.c
38 issues
Line: 505
Column: 5
CWE codes:
362
Suggestion:
Use fchmod( ) instead
#if defined(_WIN32) || defined(WIN32)
/* windows doesn't allow remove read-only files,
* so try to make it writable first */
chmod(path, _S_IWRITE);
#endif
return remove(path);
}
/** FIO_openSrcFile() :
Reported by FlawFinder.
Line: 613
Column: 13
CWE codes:
362
Suggestion:
Use fchmod( ) instead
if (f == NULL) {
DISPLAYLEVEL(1, "zstd: %s: %s\n", dstFileName, strerror(errno));
} else if(srcFileName != NULL && strcmp (srcFileName, stdinmark)) {
chmod(dstFileName, 00600);
}
return f;
}
}
Reported by FlawFinder.
Line: 92
Column: 30
CWE codes:
134
Suggestion:
Use a constant for the format specification
static FIO_display_prefs_t g_display_prefs = {2, 0};
#define DISPLAY(...) fprintf(stderr, __VA_ARGS__)
#define DISPLAYOUT(...) fprintf(stdout, __VA_ARGS__)
#define DISPLAYLEVEL(l, ...) { if (g_display_prefs.displayLevel>=l) { DISPLAY(__VA_ARGS__); } }
static const U64 g_refreshRate = SEC_TO_MICRO / 6;
static UTIL_time_t g_displayClock = UTIL_TIME_INITIALIZER;
Reported by FlawFinder.
Line: 93
Column: 30
CWE codes:
134
Suggestion:
Use a constant for the format specification
static FIO_display_prefs_t g_display_prefs = {2, 0};
#define DISPLAY(...) fprintf(stderr, __VA_ARGS__)
#define DISPLAYOUT(...) fprintf(stdout, __VA_ARGS__)
#define DISPLAYLEVEL(l, ...) { if (g_display_prefs.displayLevel>=l) { DISPLAY(__VA_ARGS__); } }
static const U64 g_refreshRate = SEC_TO_MICRO / 6;
static UTIL_time_t g_displayClock = UTIL_TIME_INITIALIZER;
Reported by FlawFinder.
Line: 2435
Column: 5
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
/* The short tar extensions tzst, tgz, txz and tlz4 files should have "tar"
* extension on decompression. Also writes terminating null. */
strcpy(dstFileNameBuffer + dstFileNameEndPos, dstSuffix);
return dstFileNameBuffer;
/* note : dstFileNameBuffer memory is not going to be free */
}
Reported by FlawFinder.
Line: 538
Column: 25
CWE codes:
362
return NULL;
}
{ FILE* const f = fopen(srcFileName, "rb");
if (f == NULL)
DISPLAYLEVEL(1, "zstd: %s: %s \n", srcFileName, strerror(errno));
return f;
}
}
Reported by FlawFinder.
Line: 577
Column: 30
CWE codes:
362
if (UTIL_isRegularFile(dstFileName)) {
/* Check if destination file already exists */
FILE* const fCheck = fopen( dstFileName, "rb" );
#if !defined(_WIN32)
/* this test does not work on Windows :
* `NUL` and `nul` are detected as regular files */
if (!strcmp(dstFileName, nulmark)) {
EXM_THROW(40, "%s is unexpectedly categorized as a regular file",
Reported by FlawFinder.
Line: 609
Column: 25
CWE codes:
362
FIO_remove(dstFileName);
} }
{ FILE* const f = fopen( dstFileName, "wb" );
if (f == NULL) {
DISPLAYLEVEL(1, "zstd: %s: %s\n", dstFileName, strerror(errno));
} else if(srcFileName != NULL && strcmp (srcFileName, stdinmark)) {
chmod(dstFileName, 00600);
}
Reported by FlawFinder.
Line: 636
Column: 18
CWE codes:
362
if (fileName == NULL) return 0;
DISPLAYLEVEL(4,"Loading %s as dictionary \n", fileName);
fileHandle = fopen(fileName, "rb");
if (fileHandle==NULL) EXM_THROW(31, "%s: %s", fileName, strerror(errno));
fileSize = UTIL_getFileSize(fileName);
if (fileSize > DICTSIZE_MAX) {
EXM_THROW(32, "Dictionary file %s is too large (> %u MB)",
Reported by FlawFinder.
Line: 734
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
EXM_THROW(30, "zstd: FIO_createFilename_fromOutDir: %s", strerror(errno));
}
memcpy(result, outDirName, strlen(outDirName));
if (outDirName[strlen(outDirName)-1] == separator) {
memcpy(result + strlen(outDirName), filenameStart, strlen(filenameStart));
} else {
memcpy(result + strlen(outDirName), &separator, 1);
memcpy(result + strlen(outDirName) + 1, filenameStart, strlen(filenameStart));
Reported by FlawFinder.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/packaging/rpm.py
38 issues
Line: 30
Column: 1
__revision__ = "src/engine/SCons/Tool/packaging/rpm.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
import os
import SCons.Builder
import SCons.Tool.rpmutils
from SCons.Environment import OverrideEnvironment
Reported by Pylint.
Line: 39
Column: 34
from SCons.Tool.packaging import stripinstallbuilder, src_targz
from SCons.Errors import UserError
def package(env, target, source, PACKAGEROOT, NAME, VERSION,
PACKAGEVERSION, DESCRIPTION, SUMMARY, X_RPM_GROUP, LICENSE,
**kw):
# initialize the rpm tool
SCons.Tool.Tool('rpm').generate(env)
Reported by Pylint.
Line: 40
Column: 29
from SCons.Errors import UserError
def package(env, target, source, PACKAGEROOT, NAME, VERSION,
PACKAGEVERSION, DESCRIPTION, SUMMARY, X_RPM_GROUP, LICENSE,
**kw):
# initialize the rpm tool
SCons.Tool.Tool('rpm').generate(env)
bld = env['BUILDERS']['Rpm']
Reported by Pylint.
Line: 40
Column: 64
from SCons.Errors import UserError
def package(env, target, source, PACKAGEROOT, NAME, VERSION,
PACKAGEVERSION, DESCRIPTION, SUMMARY, X_RPM_GROUP, LICENSE,
**kw):
# initialize the rpm tool
SCons.Tool.Tool('rpm').generate(env)
bld = env['BUILDERS']['Rpm']
Reported by Pylint.
Line: 40
Column: 51
from SCons.Errors import UserError
def package(env, target, source, PACKAGEROOT, NAME, VERSION,
PACKAGEVERSION, DESCRIPTION, SUMMARY, X_RPM_GROUP, LICENSE,
**kw):
# initialize the rpm tool
SCons.Tool.Tool('rpm').generate(env)
bld = env['BUILDERS']['Rpm']
Reported by Pylint.
Line: 40
Column: 42
from SCons.Errors import UserError
def package(env, target, source, PACKAGEROOT, NAME, VERSION,
PACKAGEVERSION, DESCRIPTION, SUMMARY, X_RPM_GROUP, LICENSE,
**kw):
# initialize the rpm tool
SCons.Tool.Tool('rpm').generate(env)
bld = env['BUILDERS']['Rpm']
Reported by Pylint.
Line: 148
Column: 5
def build_specfile_sections(spec):
""" Builds the sections of a rpm specfile.
"""
str = ""
mandatory_sections = {
'DESCRIPTION' : '\n%%description\n%s\n\n', }
str = str + SimpleTagCompiler(mandatory_sections).compile( spec )
Reported by Pylint.
Line: 172
Column: 3
}
# Default prep, build, install and clean rules
# TODO: optimize those build steps, to not compile the project a second time
if 'X_RPM_PREP' not in spec:
spec['X_RPM_PREP'] = '[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"' + '\n%setup -q'
if 'X_RPM_BUILD' not in spec:
spec['X_RPM_BUILD'] = '[ ! -e "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && mkdir "$RPM_BUILD_ROOT"'
Reported by Pylint.
Line: 192
Column: 5
def build_specfile_header(spec):
""" Builds all sections but the %file of a rpm specfile
"""
str = ""
# first the mandatory sections
mandatory_header_fields = {
'NAME' : '%%define name %s\nName: %%{name}\n',
'VERSION' : '%%define version %s\nVersion: %%{version}\n',
Reported by Pylint.
Line: 266
Column: 5
def build_specfile_filesection(spec, files):
""" builds the %file section of the specfile
"""
str = '%files\n'
if 'X_RPM_DEFATTR' not in spec:
spec['X_RPM_DEFATTR'] = '(-,root,root)'
str = str + '%%defattr %s\n' % spec['X_RPM_DEFATTR']
Reported by Pylint.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Scanner/LaTeX.py
38 issues
Line: 87
Column: 29
"""
def __init__(self, variable):
self.variable = variable
def __call__(self, env, dir=None, target=None, source=None, argument=None):
import SCons.PathList
try:
path = env['ENV'][self.variable]
except KeyError:
return ()
Reported by Pylint.
Line: 88
Column: 9
def __init__(self, variable):
self.variable = variable
def __call__(self, env, dir=None, target=None, source=None, argument=None):
import SCons.PathList
try:
path = env['ENV'][self.variable]
except KeyError:
return ()
Reported by Pylint.
Line: 208
Column: 25
self.graphics_extensions = graphics_extensions
def _scan(node, env, path=(), self=self):
node = node.rfile()
if not node.exists():
return []
return self.scan_recurse(node, path)
Reported by Pylint.
Line: 231
Column: 37
self.dictionary[k] = ( SCons.Scanner.FindPathDirs(n),
FindENVPathDirs(n) )
def __call__(self, env, dir=None, target=None, source=None,
argument=None):
di = {}
for k,(c,cENV) in self.dictionary.items():
di[k] = ( c(env, dir=None, target=None, source=None,
argument=None) ,
Reported by Pylint.
Line: 265
Column: 13
def _latex_names(self, include_type, filename):
if include_type == 'input':
base, ext = os.path.splitext( filename )
if ext == "":
return [filename + '.tex']
if include_type in ('include', 'import', 'subimport',
'includefrom', 'subincludefrom',
'inputfrom', 'subinputfrom'):
Reported by Pylint.
Line: 294
Column: 16
return [filename]
def sort_key(self, include):
return SCons.Node.FS._my_normcase(str(include))
def find_include(self, include, source_dir, path):
inc_type, inc_subdir, inc_filename = include
try:
sub_paths = path[inc_type]
Reported by Pylint.
Line: 389
Column: 3
# This is a hand-coded DSU (decorate-sort-undecorate, or
# Schwartzian transform) pattern. The sort key is the raw name
# of the file as specifed on the \include, \input, etc. line.
# TODO: what about the comment in the original Classic scanner:
# """which lets
# us keep the sort order constant regardless of whether the file
# is actually found in a Repository or locally."""
nodes = []
source_dir = node.get_dir()
Reported by Pylint.
Line: 1
Column: 1
"""SCons.Scanner.LaTeX
This module implements the dependency scanner for LaTeX code.
"""
#
# Copyright (c) 2001 - 2019 The SCons Foundation
#
Reported by Pylint.
Line: 30
Column: 1
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Scanner/LaTeX.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
import os.path
import re
import SCons.Scanner
Reported by Pylint.
Line: 45
Column: 1
# Used as a return value of modify_env_var if the variable is not set.
class _Null(object):
pass
_null = _Null
# The user specifies the paths in env[variable], similar to other builders.
# They may be relative and must be converted to absolute, as expected
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_timestamp03.py
37 issues
Line: 36
Column: 1
from helper import copy_wiredtiger_home
import random
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_timestamp03(wttest.WiredTigerTestCase, suite_subprocess):
table_ts_log = 'ts03_ts_logged'
table_ts_nolog = 'ts03_ts_nologged'
Reported by Pylint.
Line: 36
Column: 1
from helper import copy_wiredtiger_home
import random
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_timestamp03(wttest.WiredTigerTestCase, suite_subprocess):
table_ts_log = 'ts03_ts_logged'
table_ts_nolog = 'ts03_ts_nologged'
Reported by Pylint.
Line: 111
Column: 13
# Count how many times the check_value is present in the
# logged timestamp table.
actual_ts_log = 0
for k, v in cur_ts_log:
if check_value in str(v):
actual_ts_log += 1
cur_ts_log.close()
# Count how many times the check_value is present in the
# not logged timestamp table
Reported by Pylint.
Line: 168
Column: 9
# 3. Table is logged and does not use timestamps.
# 4. Table is not logged and does not use timestamps.
#
format = 'key_format={},value_format=S'.format(self.key_format)
self.session.create(uri_ts_log, format)
cur_ts_log = self.session.open_cursor(uri_ts_log)
self.session.create(uri_ts_nolog, format + ',log=(enabled=false)')
cur_ts_nolog = self.session.open_cursor(uri_ts_nolog)
self.session.create(uri_nots_log, format)
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.
Line: 34
Column: 1
#
from helper import copy_wiredtiger_home
import random
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_timestamp03(wttest.WiredTigerTestCase, suite_subprocess):
Reported by Pylint.
Line: 36
Column: 1
from helper import copy_wiredtiger_home
import random
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_timestamp03(wttest.WiredTigerTestCase, suite_subprocess):
table_ts_log = 'ts03_ts_logged'
table_ts_nolog = 'ts03_ts_nologged'
Reported by Pylint.
Line: 36
Column: 1
from helper import copy_wiredtiger_home
import random
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_timestamp03(wttest.WiredTigerTestCase, suite_subprocess):
table_ts_log = 'ts03_ts_logged'
table_ts_nolog = 'ts03_ts_nologged'
Reported by Pylint.
Line: 39
Column: 1
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_timestamp03(wttest.WiredTigerTestCase, suite_subprocess):
table_ts_log = 'ts03_ts_logged'
table_ts_nolog = 'ts03_ts_nologged'
table_nots_log = 'ts03_nots_logged'
table_nots_nolog = 'ts03_nots_nologged'
Reported by Pylint.
Line: 39
Column: 1
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_timestamp03(wttest.WiredTigerTestCase, suite_subprocess):
table_ts_log = 'ts03_ts_logged'
table_ts_nolog = 'ts03_ts_nologged'
table_nots_log = 'ts03_nots_logged'
table_nots_nolog = 'ts03_nots_nologged'
Reported by Pylint.
src/third_party/mozjs-60/extract/js/src/devtools/rootAnalysis/t/testlib.py
36 issues
Line: 1
Column: 1
import json
import os
import re
import subprocess
from sixgill import Body
from collections import defaultdict, namedtuple
scriptdir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
Reported by Pylint.
Line: 4
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
import json
import os
import re
import subprocess
from sixgill import Body
from collections import defaultdict, namedtuple
scriptdir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
Reported by Bandit.
Line: 7
Column: 1
import subprocess
from sixgill import Body
from collections import defaultdict, namedtuple
scriptdir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
HazardSummary = namedtuple('HazardSummary', ['function', 'variable', 'type', 'GCFunction', 'location'])
Reported by Pylint.
Line: 11
Column: 1
scriptdir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
HazardSummary = namedtuple('HazardSummary', ['function', 'variable', 'type', 'GCFunction', 'location'])
def equal(got, expected):
if got != expected:
print("Got '%s', expected '%s'" % (got, expected))
Reported by Pylint.
Line: 13
Column: 1
HazardSummary = namedtuple('HazardSummary', ['function', 'variable', 'type', 'GCFunction', 'location'])
def equal(got, expected):
if got != expected:
print("Got '%s', expected '%s'" % (got, expected))
def extract_unmangled(func):
return func.split('$')[-1]
Reported by Pylint.
Line: 17
Column: 1
if got != expected:
print("Got '%s', expected '%s'" % (got, expected))
def extract_unmangled(func):
return func.split('$')[-1]
class Test(object):
def __init__(self, indir, outdir, cfg, verbose=0):
Reported by Pylint.
Line: 21
Column: 1
return func.split('$')[-1]
class Test(object):
def __init__(self, indir, outdir, cfg, verbose=0):
self.indir = indir
self.outdir = outdir
self.cfg = cfg
self.verbose = verbose
Reported by Pylint.
Line: 21
Column: 1
return func.split('$')[-1]
class Test(object):
def __init__(self, indir, outdir, cfg, verbose=0):
self.indir = indir
self.outdir = outdir
self.cfg = cfg
self.verbose = verbose
Reported by Pylint.
Line: 28
Column: 5
self.cfg = cfg
self.verbose = verbose
def infile(self, path):
return os.path.join(self.indir, path)
def binpath(self, prog):
return os.path.join(self.cfg.sixgill_bin, prog)
Reported by Pylint.
Line: 31
Column: 5
def infile(self, path):
return os.path.join(self.indir, path)
def binpath(self, prog):
return os.path.join(self.cfg.sixgill_bin, prog)
def compile(self, source, options = ''):
cmd = "{CXX} -c {source} -O3 -std=c++11 -fplugin={sixgill} -fplugin-arg-xgill-mangle=1 {options}".format(
source=self.infile(source),
Reported by Pylint.
src/third_party/wiredtiger/dist/stat.py
36 issues
Line: 4
Column: 1
# Read the source files and output the statistics #defines plus the
# initialize and refresh code.
import re, string, sys, textwrap
from dist import compare_srcfile, format_srcfile
from operator import attrgetter
# Read the source files.
from stat_data import groups, dsrc_stats, conn_stats, conn_dsrc_stats, join_stats, \
Reported by Pylint.
Line: 4
Column: 1
# Read the source files and output the statistics #defines plus the
# initialize and refresh code.
import re, string, sys, textwrap
from dist import compare_srcfile, format_srcfile
from operator import attrgetter
# Read the source files.
from stat_data import groups, dsrc_stats, conn_stats, conn_dsrc_stats, join_stats, \
Reported by Pylint.
Line: 4
Column: 1
# Read the source files and output the statistics #defines plus the
# initialize and refresh code.
import re, string, sys, textwrap
from dist import compare_srcfile, format_srcfile
from operator import attrgetter
# Read the source files.
from stat_data import groups, dsrc_stats, conn_stats, conn_dsrc_stats, join_stats, \
Reported by Pylint.
Line: 9
Column: 1
from operator import attrgetter
# Read the source files.
from stat_data import groups, dsrc_stats, conn_stats, conn_dsrc_stats, join_stats, \
session_stats
# Statistic categories need to be sorted in order to generate a valid statistics JSON file.
sorted_conn_stats = conn_stats
sorted_conn_stats.extend(conn_dsrc_stats)
Reported by Pylint.
Line: 79
Column: 49
* @name Connection statistics
* @anchor statistics_keys
* @anchor statistics_conn
* Statistics are accessed through cursors with \c "statistics:" URIs.
* Individual statistics can be queried through the cursor using the following
* keys. See @ref data_statistics for more information.
* @{
*/
''')
Reported by Pylint.
Line: 242
Column: 1
for l in statlist:
if 'max_aggregate' in l.flags:
f.write('\tint64_t v;\n\n')
break;
for l in statlist:
if 'max_aggregate' in l.flags:
o = '\tif ((v = WT_STAT_READ(from, ' + l.name + ')) > ' +\
'to->' + l.name + ')\n'
if len(o) > 72: # Account for the leading tab.
Reported by Pylint.
Line: 1
Column: 1
# Read the source files and output the statistics #defines plus the
# initialize and refresh code.
import re, string, sys, textwrap
from dist import compare_srcfile, format_srcfile
from operator import attrgetter
# Read the source files.
from stat_data import groups, dsrc_stats, conn_stats, conn_dsrc_stats, join_stats, \
Reported by Pylint.
Line: 4
Column: 1
# Read the source files and output the statistics #defines plus the
# initialize and refresh code.
import re, string, sys, textwrap
from dist import compare_srcfile, format_srcfile
from operator import attrgetter
# Read the source files.
from stat_data import groups, dsrc_stats, conn_stats, conn_dsrc_stats, join_stats, \
Reported by Pylint.
Line: 6
Column: 1
import re, string, sys, textwrap
from dist import compare_srcfile, format_srcfile
from operator import attrgetter
# Read the source files.
from stat_data import groups, dsrc_stats, conn_stats, conn_dsrc_stats, join_stats, \
session_stats
Reported by Pylint.
Line: 28
Column: 9
f.write('#define\tWT_' + name.upper() + '_STATS_BASE\t' + str(base) + '\n')
f.write('struct __wt_' + name + '_stats {\n')
for l in stats:
f.write('\tint64_t ' + l.name + ';\n')
f.write('};\n\n')
# Update the #defines in the stat.h file.
tmp_file = '__tmp'
Reported by Pylint.
src/third_party/abseil-cpp-master/abseil-cpp/absl/strings/numbers_test.cc
36 issues
Line: 113
return {begin, end};
}
TEST(ToString, PerfectDtoa) {
EXPECT_THAT(PerfectDtoa(1), Eq("1"));
EXPECT_THAT(PerfectDtoa(0.1),
Eq("0.1000000000000000055511151231257827021181583404541015625"));
EXPECT_THAT(PerfectDtoa(1e24), Eq("999999999999999983222784"));
EXPECT_THAT(PerfectDtoa(5e-324), MatchesRegex("0.0000.*625"));
Reported by Cppcheck.
Line: 207
Column: 30
CWE codes:
120
void CheckHex64(uint64_t v) {
char expected[16 + 1];
std::string actual = absl::StrCat(absl::Hex(v, absl::kZeroPad16));
snprintf(expected, sizeof(expected), "%016" PRIx64, static_cast<uint64_t>(v));
EXPECT_EQ(expected, actual) << " Input " << v;
actual = absl::StrCat(absl::Hex(v, absl::kSpacePad16));
snprintf(expected, sizeof(expected), "%16" PRIx64, static_cast<uint64_t>(v));
EXPECT_EQ(expected, actual) << " Input " << v;
Reported by FlawFinder.
Line: 208
Column: 3
CWE codes:
134
Suggestion:
Use a constant for the format specification
void CheckHex64(uint64_t v) {
char expected[16 + 1];
std::string actual = absl::StrCat(absl::Hex(v, absl::kZeroPad16));
snprintf(expected, sizeof(expected), "%016" PRIx64, static_cast<uint64_t>(v));
EXPECT_EQ(expected, actual) << " Input " << v;
actual = absl::StrCat(absl::Hex(v, absl::kSpacePad16));
snprintf(expected, sizeof(expected), "%16" PRIx64, static_cast<uint64_t>(v));
EXPECT_EQ(expected, actual) << " Input " << v;
}
Reported by FlawFinder.
Line: 210
Column: 18
CWE codes:
120
std::string actual = absl::StrCat(absl::Hex(v, absl::kZeroPad16));
snprintf(expected, sizeof(expected), "%016" PRIx64, static_cast<uint64_t>(v));
EXPECT_EQ(expected, actual) << " Input " << v;
actual = absl::StrCat(absl::Hex(v, absl::kSpacePad16));
snprintf(expected, sizeof(expected), "%16" PRIx64, static_cast<uint64_t>(v));
EXPECT_EQ(expected, actual) << " Input " << v;
}
TEST(Numbers, TestFastPrints) {
Reported by FlawFinder.
Line: 211
Column: 3
CWE codes:
134
Suggestion:
Use a constant for the format specification
snprintf(expected, sizeof(expected), "%016" PRIx64, static_cast<uint64_t>(v));
EXPECT_EQ(expected, actual) << " Input " << v;
actual = absl::StrCat(absl::Hex(v, absl::kSpacePad16));
snprintf(expected, sizeof(expected), "%16" PRIx64, static_cast<uint64_t>(v));
EXPECT_EQ(expected, actual) << " Input " << v;
}
TEST(Numbers, TestFastPrints) {
for (int i = -100; i <= 100; i++) {
Reported by FlawFinder.
Line: 711
Column: 26
CWE codes:
120
// Test overflow
EXPECT_FALSE(
parse_func(absl::StrCat(std::numeric_limits<IntType>::max(), value),
&parsed_value, base));
// Test underflow
if (std::numeric_limits<IntType>::min() < 0) {
EXPECT_FALSE(
Reported by FlawFinder.
Line: 717
Column: 28
CWE codes:
120
// Test underflow
if (std::numeric_limits<IntType>::min() < 0) {
EXPECT_FALSE(
parse_func(absl::StrCat(std::numeric_limits<IntType>::min(), value),
&parsed_value, base));
} else {
EXPECT_FALSE(parse_func(absl::StrCat("-", value), &parsed_value, base));
}
}
Reported by FlawFinder.
Line: 720
Column: 37
CWE codes:
120
parse_func(absl::StrCat(std::numeric_limits<IntType>::min(), value),
&parsed_value, base));
} else {
EXPECT_FALSE(parse_func(absl::StrCat("-", value), &parsed_value, base));
}
}
}
TEST(stringtest, safe_strto32_random) {
Reported by FlawFinder.
Line: 997
Column: 28
CWE codes:
120
mismatches.push_back(d);
if (mismatches.size() < 10) {
ABSL_RAW_LOG(ERROR, "%s",
absl::StrCat("Six-digit failure with double. ", "d=", d,
"=", d, " sixdigits=", sixdigitsbuf,
" printf(%g)=", snprintfbuf)
.c_str());
}
}
Reported by FlawFinder.
Line: 1050
Column: 19
CWE codes:
120
char buf[kSixDigitsToBufferSize];
ABSL_RAW_LOG(
INFO, "%s",
absl::StrCat("Exp ", exponent, " powten=", powten, "(", powten,
") (",
std::string(buf, SixDigitsToBuffer(powten, buf)), ")")
.c_str());
}
for (int digits : digit_testcases) {
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_compress02.py
35 issues
Line: 32
Column: 1
import fnmatch, os, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
from wiredtiger import stat
# test_compress02.py
Reported by Pylint.
Line: 35
Column: 1
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
from wiredtiger import stat
# test_compress02.py
# This test checks that the compression level can be reconfigured after restart if
# we are using zstd as the block compressor. Tables created before reconfiguration
# will still use the previous compression level.
Reported by Pylint.
Line: 47
Column: 5
uri = "table:test_compress02"
nrows = 1000
def conn_config(self):
config = 'builtin_extension_config={zstd={compression_level=6}},cache_size=10MB,log=(enabled=true)'
return config
def large_updates(self, uri, value, ds, nrows):
# Update a large number of records.
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, threading, time
from wtthread import checkpoint_thread, op_thread
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, threading, time
from wtthread import checkpoint_thread, op_thread
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, threading, time
from wtthread import checkpoint_thread, op_thread
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, threading, time
from wtthread import checkpoint_thread, op_thread
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, threading, time
from wtthread import checkpoint_thread, op_thread
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, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
from wiredtiger import stat
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import fnmatch, os, shutil, threading, time
from wtthread import checkpoint_thread, op_thread
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
from wiredtiger import stat
Reported by Pylint.
src/mongo/db/free_mon/free_mon_controller_test.cpp
35 issues
Line: 463
// Positive: Ensure deadlines sort properly
TEST(FreeMonRetryTest, TestRegistration) {
auto random = makeRandom();
RegistrationRetryCounter counter(random);
counter.reset();
ASSERT_EQ(counter.getNextDuration(), Seconds(1));
Reported by Cppcheck.
Line: 465
Column: 38
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
// Positive: Ensure deadlines sort properly
TEST(FreeMonRetryTest, TestRegistration) {
auto random = makeRandom();
RegistrationRetryCounter counter(random);
counter.reset();
ASSERT_EQ(counter.getNextDuration(), Seconds(1));
ASSERT_EQ(counter.getNextDuration(), Seconds(1));
Reported by FlawFinder.
Line: 530
Column: 33
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
// Positive: Ensure deadlines sort properly
TEST(FreeMonRetryTest, TestMetrics) {
auto random = makeRandom();
MetricsRetryCounter counter(random);
counter.reset();
ASSERT_EQ(counter.getNextDuration(), Seconds(1));
ASSERT_EQ(counter.getNextDuration(), Seconds(1));
Reported by FlawFinder.
Line: 957
Column: 34
CWE codes:
120
20
controller->turnCrankForTest(Turner().registerCommand());
ASSERT_TRUE(!FreeMonStorage::read(_opCtx.get()).get().getRegistrationId().empty());
ASSERT_EQ(controller.registerCollector->count(), 1UL);
ASSERT_GTE(controller.metricsCollector->count(), 0UL);
}
Reported by FlawFinder.
Line: 978
Column: 33
CWE codes:
120
20
ASSERT_OK(*optionalStatus);
controller->turnCrankForTest(Turner().registerCommand(2));
ASSERT_TRUE(FreeMonStorage::read(_opCtx.get()).get().getState() == StorageStateEnum::pending);
ASSERT_GTE(controller.network->getRegistersCalls(), 2);
ASSERT_GTE(controller.registerCollector->count(), 2UL);
}
// Negatve: Test Register fails if the registration is wrong
Reported by FlawFinder.
Line: 997
Column: 33
CWE codes:
120
20
ASSERT_OK(*optionalStatus);
controller->turnCrankForTest(Turner().registerCommand(1));
ASSERT_TRUE(FreeMonStorage::read(_opCtx.get()).get().getState() == StorageStateEnum::disabled);
ASSERT_EQ(controller.network->getRegistersCalls(), 1);
ASSERT_EQ(controller.registerCollector->count(), 1UL);
}
Reported by FlawFinder.
Line: 1017
Column: 33
CWE codes:
120
20
ASSERT_OK(*optionalStatus);
controller->turnCrankForTest(Turner().registerCommand());
ASSERT_TRUE(FreeMonStorage::read(_opCtx.get()).get().getState() == StorageStateEnum::disabled);
ASSERT_EQ(controller.network->getRegistersCalls(), 1);
ASSERT_EQ(controller.registerCollector->count(), 1UL);
}
Reported by FlawFinder.
Line: 1032
Column: 34
CWE codes:
120
20
controller->turnCrankForTest(
Turner().registerServer().registerCommand().collect(2).metricsSend());
ASSERT_TRUE(!FreeMonStorage::read(_opCtx.get()).get().getRegistrationId().empty());
ASSERT_GTE(controller.network->getRegistersCalls(), 1);
ASSERT_GTE(controller.network->getMetricsCalls(), 1);
ASSERT_EQ(controller.registerCollector->count(), 1UL);
Reported by FlawFinder.
Line: 1078
Column: 34
CWE codes:
120
20
controller->turnCrankForTest(
Turner().registerServer().registerCommand().collect(2).metricsSend());
ASSERT_TRUE(!FreeMonStorage::read(_opCtx.get()).get().getRegistrationId().empty());
ASSERT_GTE(controller.network->getRegistersCalls(), 1);
ASSERT_GTE(controller.network->getMetricsCalls(), 1);
ASSERT_EQ(controller.registerCollector->count(), 1UL);
Reported by FlawFinder.
Line: 1143
Column: 33
CWE codes:
120
20
controller->turnCrankForTest(Turner().registerCommand().collect(2).metricsSend());
ASSERT_TRUE(FreeMonStorage::read(_opCtx.get())->getState() == StorageStateEnum::enabled);
optionalStatus = controller->unregisterServerCommand(Milliseconds::min());
ASSERT(optionalStatus);
ASSERT_OK(*optionalStatus);
Reported by FlawFinder.