The following issues were found
src/third_party/wiredtiger/test/3rdparty/python-subunit-0.0.16/python/subunit/tests/__init__.py
12 issues
Line: 1
Column: 1
#
# subunit: extensions to python unittest to get test results from subprocesses.
# Copyright (C) 2005 Robert Collins <robertc@robertcollins.net>
#
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
# license at the users choice. A copy of both licenses are available in the
# project source as Apache-2.0 and BSD. You may not use this file except in
# compliance with one of these two licences.
#
Reported by Pylint.
Line: 24
Column: 5
# Before the test module imports to avoid circularity.
# For testing: different pythons have different str() implementations.
if sys.version_info > (3, 0):
_remote_exception_repr = "testtools.testresult.real._StringException"
_remote_exception_str = "Traceback (most recent call last):\ntesttools.testresult.real._StringException"
_remote_exception_str_chunked = "57\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
else:
_remote_exception_repr = "_StringException"
_remote_exception_str = "Traceback (most recent call last):\n_StringException"
Reported by Pylint.
Line: 25
Column: 1
# For testing: different pythons have different str() implementations.
if sys.version_info > (3, 0):
_remote_exception_repr = "testtools.testresult.real._StringException"
_remote_exception_str = "Traceback (most recent call last):\ntesttools.testresult.real._StringException"
_remote_exception_str_chunked = "57\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
else:
_remote_exception_repr = "_StringException"
_remote_exception_str = "Traceback (most recent call last):\n_StringException"
_remote_exception_str_chunked = "3D\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
Reported by Pylint.
Line: 25
Column: 5
# For testing: different pythons have different str() implementations.
if sys.version_info > (3, 0):
_remote_exception_repr = "testtools.testresult.real._StringException"
_remote_exception_str = "Traceback (most recent call last):\ntesttools.testresult.real._StringException"
_remote_exception_str_chunked = "57\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
else:
_remote_exception_repr = "_StringException"
_remote_exception_str = "Traceback (most recent call last):\n_StringException"
_remote_exception_str_chunked = "3D\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
Reported by Pylint.
Line: 26
Column: 5
if sys.version_info > (3, 0):
_remote_exception_repr = "testtools.testresult.real._StringException"
_remote_exception_str = "Traceback (most recent call last):\ntesttools.testresult.real._StringException"
_remote_exception_str_chunked = "57\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
else:
_remote_exception_repr = "_StringException"
_remote_exception_str = "Traceback (most recent call last):\n_StringException"
_remote_exception_str_chunked = "3D\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
Reported by Pylint.
Line: 28
Column: 48
_remote_exception_str = "Traceback (most recent call last):\ntesttools.testresult.real._StringException"
_remote_exception_str_chunked = "57\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
else:
_remote_exception_repr = "_StringException"
_remote_exception_str = "Traceback (most recent call last):\n_StringException"
_remote_exception_str_chunked = "3D\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
from subunit.tests import (
Reported by Pylint.
Line: 28
Column: 5
_remote_exception_str = "Traceback (most recent call last):\ntesttools.testresult.real._StringException"
_remote_exception_str_chunked = "57\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
else:
_remote_exception_repr = "_StringException"
_remote_exception_str = "Traceback (most recent call last):\n_StringException"
_remote_exception_str_chunked = "3D\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
from subunit.tests import (
Reported by Pylint.
Line: 29
Column: 5
_remote_exception_str_chunked = "57\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
else:
_remote_exception_repr = "_StringException"
_remote_exception_str = "Traceback (most recent call last):\n_StringException"
_remote_exception_str_chunked = "3D\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
from subunit.tests import (
test_chunked,
Reported by Pylint.
Line: 29
Column: 83
_remote_exception_str_chunked = "57\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
else:
_remote_exception_repr = "_StringException"
_remote_exception_str = "Traceback (most recent call last):\n_StringException"
_remote_exception_str_chunked = "3D\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
from subunit.tests import (
test_chunked,
Reported by Pylint.
Line: 30
Column: 5
else:
_remote_exception_repr = "_StringException"
_remote_exception_str = "Traceback (most recent call last):\n_StringException"
_remote_exception_str_chunked = "3D\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
from subunit.tests import (
test_chunked,
test_details,
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_txn14.py
12 issues
Line: 33
Column: 1
# Transactions: commits and rollbacks
#
import fnmatch, os, shutil, time
from helper import simulate_crash_restart
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wttest
Reported by Pylint.
Line: 33
Column: 1
# Transactions: commits and rollbacks
#
import fnmatch, os, shutil, time
from helper import simulate_crash_restart
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wttest
Reported by Pylint.
Line: 33
Column: 1
# Transactions: commits and rollbacks
#
import fnmatch, os, shutil, time
from helper import simulate_crash_restart
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wttest
Reported by Pylint.
Line: 33
Column: 1
# Transactions: commits and rollbacks
#
import fnmatch, os, shutil, time
from helper import simulate_crash_restart
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wttest
Reported by Pylint.
Line: 83
Column: 9
self.assertEqual(i, key)
self.assertEqual(i+1, value)
i += 1
all = self.entries + self.extra_entries
self.assertEqual(i, all + 1)
c.close()
if __name__ == '__main__':
wttest.run()
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: 33
Column: 1
# Transactions: commits and rollbacks
#
import fnmatch, os, shutil, time
from helper import simulate_crash_restart
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wttest
Reported by Pylint.
Line: 39
Column: 1
from wtscenario import make_scenarios
import wttest
class test_txn14(wttest.WiredTigerTestCase, suite_subprocess):
t1 = 'table:test_txn14_1'
entries = 10000
extra_entries = 5
conn_config = 'log=(archive=false,enabled,file_max=100K)'
Reported by Pylint.
Line: 39
Column: 1
from wtscenario import make_scenarios
import wttest
class test_txn14(wttest.WiredTigerTestCase, suite_subprocess):
t1 = 'table:test_txn14_1'
entries = 10000
extra_entries = 5
conn_config = 'log=(archive=false,enabled,file_max=100K)'
Reported by Pylint.
Line: 55
Column: 5
]
scenarios = make_scenarios(sync_list, key_format_values)
def test_log_flush(self):
# Here's the strategy:
# - Create a table.
# - Insert data into table.
# - Call log_flush.
# - Simulate a crash and restart
Reported by Pylint.
src/third_party/wiredtiger/test/3rdparty/python-subunit-0.0.16/python/subunit/chunked.py
12 issues
Line: 20
Column: 1
"""Encoder/decoder for http style chunked encoding."""
from testtools.compat import _b
empty = _b('')
class Decoder(object):
"""Decode chunked content to a byte stream."""
Reported by Pylint.
Line: 60
Column: 12
:raises ValueError: If the stream is incomplete ValueError is raised.
"""
if self.state != self._finished:
raise ValueError("incomplete stream")
def _finished(self):
"""Finished reading, return any remaining bytes."""
if self.buffered_bytes:
Reported by Pylint.
Line: 93
Column: 13
def _read_length(self):
"""Try to decode a length from the bytes."""
count_chars = []
for bytes in self.buffered_bytes:
for pos in range(len(bytes)):
byte = bytes[pos:pos+1]
if byte not in self._match_chars:
break
count_chars.append(byte)
Reported by Pylint.
Line: 129
Column: 21
self.state = self._read_body
return self.state()
def write(self, bytes):
"""Decode bytes to the output stream.
:raises ValueError: If the stream has already seen the end of file
marker.
:returns: None, or the excess bytes beyond the end of file marker.
Reported by Pylint.
Line: 172
Column: 21
self.output.write(empty.join(buffered_bytes))
return True
def write(self, bytes):
"""Encode bytes to the output stream."""
bytes_len = len(bytes)
if self.buffer_size + bytes_len >= 65536:
self.flush(bytes_len)
self.output.write(bytes)
Reported by Pylint.
Line: 24
Column: 1
empty = _b('')
class Decoder(object):
"""Decode chunked content to a byte stream."""
def __init__(self, output, strict=True):
"""Create a decoder decoding to output.
Reported by Pylint.
Line: 24
Column: 1
empty = _b('')
class Decoder(object):
"""Decode chunked content to a byte stream."""
def __init__(self, output, strict=True):
"""Create a decoder decoding to output.
Reported by Pylint.
Line: 65
Column: 9
def _finished(self):
"""Finished reading, return any remaining bytes."""
if self.buffered_bytes:
buffered_bytes = self.buffered_bytes
self.buffered_bytes = []
return empty.join(buffered_bytes)
else:
raise ValueError("stream is finished")
Reported by Pylint.
Line: 90
Column: 5
self.state = self._read_length
return self.state()
def _read_length(self):
"""Try to decode a length from the bytes."""
count_chars = []
for bytes in self.buffered_bytes:
for pos in range(len(bytes)):
byte = bytes[pos:pos+1]
Reported by Pylint.
Line: 90
Column: 5
self.state = self._read_length
return self.state()
def _read_length(self):
"""Try to decode a length from the bytes."""
count_chars = []
for bytes in self.buffered_bytes:
for pos in range(len(bytes)):
byte = bytes[pos:pos+1]
Reported by Pylint.
src/third_party/mozjs-60/extract/js/src/builtin/Profilers.cpp
12 issues
Line: 54
}
#endif
JS_PUBLIC_API(const char*)
JS_UnsafeGetLastProfilingError()
{
return gLastError;
}
Reported by Cppcheck.
Line: 524
Column: 9
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
UniqueChars flags2((char*)js_malloc(strlen(flags) + 1));
if (!flags2)
return false;
strcpy(flags2.get(), flags);
// Split |flags2| on spaces.
char* toksave;
char* tok = strtok_r(flags2.get(), " ", &toksave);
while (tok) {
Reported by FlawFinder.
Line: 538
Column: 9
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
if (!args.append((char*) nullptr))
return false;
execvp("perf", const_cast<char**>(args.begin()));
/* Reached only if execlp fails. */
fprintf(stderr, "Unable to start perf.\n");
exit(1);
}
Reported by FlawFinder.
Line: 485
Column: 10
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
}
// Bail if MOZ_PROFILE_WITH_PERF is empty or undefined.
if (!getenv("MOZ_PROFILE_WITH_PERF") ||
!strlen(getenv("MOZ_PROFILE_WITH_PERF"))) {
return true;
}
/*
Reported by FlawFinder.
Line: 486
Column: 17
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
// Bail if MOZ_PROFILE_WITH_PERF is empty or undefined.
if (!getenv("MOZ_PROFILE_WITH_PERF") ||
!strlen(getenv("MOZ_PROFILE_WITH_PERF"))) {
return true;
}
/*
* Delete mozperf.data the first time through -- we're going to append to it
Reported by FlawFinder.
Line: 516
Column: 29
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
if (!args.append(defaultArgs, ArrayLength(defaultArgs)))
return false;
const char* flags = getenv("MOZ_PROFILE_PERF_FLAGS");
if (!flags) {
flags = "--call-graph";
}
UniqueChars flags2((char*)js_malloc(strlen(flags) + 1));
Reported by FlawFinder.
Line: 40
Column: 8
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
/* Thread-unsafe error management */
static char gLastError[2000];
#if defined(__APPLE__) || defined(__linux__) || defined(MOZ_CALLGRIND)
static void
MOZ_FORMAT_PRINTF(1, 2)
UnsafeError(const char* format, ...)
Reported by FlawFinder.
Line: 497
Column: 9
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
if (!perfInitialized) {
perfInitialized = true;
unlink(outfile);
char cwd[4096];
printf("Writing perf profiling data to %s/%s\n",
getcwd(cwd, sizeof(cwd)), outfile);
}
pid_t mainPid = getpid();
Reported by FlawFinder.
Line: 508
Column: 9
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
if (childPid == 0) {
/* perf record --pid $mainPID --output=$outfile $MOZ_PROFILE_PERF_FLAGS */
char mainPidStr[16];
SprintfLiteral(mainPidStr, "%d", mainPid);
const char* defaultArgs[] = {"perf", "record", "--pid", mainPidStr, "--output", outfile};
Vector<const char*, 0, SystemAllocPolicy> args;
if (!args.append(defaultArgs, ArrayLength(defaultArgs)))
Reported by FlawFinder.
Line: 486
Column: 10
CWE codes:
126
// Bail if MOZ_PROFILE_WITH_PERF is empty or undefined.
if (!getenv("MOZ_PROFILE_WITH_PERF") ||
!strlen(getenv("MOZ_PROFILE_WITH_PERF"))) {
return true;
}
/*
* Delete mozperf.data the first time through -- we're going to append to it
Reported by FlawFinder.
src/third_party/mozjs-60/extract/js/src/devtools/gctrace/gcstats.cpp
12 issues
Line: 173
Column: 5
CWE codes:
134
Suggestion:
Use a constant for the format specification
{
va_list va;
va_start(va, format);
vfprintf(stderr, format, va);
fprintf(stderr, "\n");
va_end(va);
exit(1);
}
Reported by FlawFinder.
Line: 351
Column: 13
CWE codes:
134
Suggestion:
Use a constant for the format specification
for (unsigned i = 0; i < lifetimeBins; ++i) {
fprintf(file, "%8d", binLimit(i));
for (unsigned j = 0; j < HeapKinds; ++j)
fprintf(file, ", %8" PRIu64, allocCountByHeapAndLifetime[j][i]);
fprintf(file, "\n");
}
}
static void
Reported by FlawFinder.
Line: 367
Column: 13
CWE codes:
134
Suggestion:
Use a constant for the format specification
for (unsigned i = 0; i < lifetimeBins; ++i) {
fprintf(file, "%8d", binLimit(i));
for (unsigned j = 0; j < FinalizerKinds; ++j)
fprintf(file, ", %8" PRIu64,
heapObjectCountByFinalizerAndLifetime[j][i]);
fprintf(file, "\n");
}
}
Reported by FlawFinder.
Line: 387
Column: 13
CWE codes:
134
Suggestion:
Use a constant for the format specification
for (unsigned i = 0; i < lifetimeBins; ++i) {
fprintf(file, "%8d", binLimit(i));
for (unsigned j = 0; j < classes.size(); ++j) {
fprintf(file, ", %8" PRIu64,
finalizedHeapObjectCountByClassAndLifetime[j][i]);
}
fprintf(file, "\n");
}
}
Reported by FlawFinder.
Line: 410
Column: 13
CWE codes:
134
Suggestion:
Use a constant for the format specification
for (unsigned i = 0; i < lifetimeBins; ++i) {
fprintf(file, "%8d", binLimit(i));
for (unsigned j = 0; j < AllocKinds; ++j)
fprintf(file, ", %8" PRIu64,
allocCountByHeapKindAndLifetime[initialHeap][j][i]);
fprintf(file, "\n");
}
}
Reported by FlawFinder.
Line: 432
Column: 13
CWE codes:
134
Suggestion:
Use a constant for the format specification
for (unsigned i = 0; i < lifetimeBins; ++i) {
fprintf(file, "%8d", binLimit(i));
for (unsigned j = 0; j < classes.size(); ++j)
fprintf(file, ", %8" PRIu64,
objectCountByHeapClassAndLifetime[initialHeap][j][i]);
fprintf(file, "\n");
}
}
Reported by FlawFinder.
Line: 467
Column: 13
CWE codes:
134
Suggestion:
Use a constant for the format specification
for (unsigned i = 0; i < lifetimeBins; ++i) {
fprintf(file, "%8d", binLimit(i));
for (unsigned j = 0; j < count; ++j)
fprintf(file, ", %8" PRIu64,
objectCountByTypeHeapAndLifetime.at(topTypes[j])[initialHeap][i]);
fprintf(file, "\n");
}
}
Reported by FlawFinder.
Line: 99
Column: 16
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
const char* getName() {
if (name)
return name;
static char buffer[32];
sprintf(buffer, "type %ld", id);
return buffer;
}
};
Reported by FlawFinder.
Line: 100
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
if (name)
return name;
static char buffer[32];
sprintf(buffer, "type %ld", id);
return buffer;
}
};
typedef std::unordered_map<address, AllocInfo> AllocMap;
Reported by FlawFinder.
Line: 724
Column: 12
CWE codes:
362
processTraceFile(const char* filename)
{
FILE* file;
file = fopen(filename, "r");
if (!file)
die("Can't read file: %s", filename);
// Get a conservative estimate of the total number of allocations so we can
// allocate buffers in advance.
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_stat07.py
12 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 wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
# test_stat07.py
# Session statistics cursor configurations.
Reported by Pylint.
Line: 54
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. Traverse the statistics cursor and fetch the statistics.
def test_stat_cursor_config(self):
Reported by Pylint.
Line: 73
Column: 18
self.session.reset()
stat_cur.reset()
while stat_cur.next() == 0:
[desc, pvalue, value] = stat_cur.get_values()
self.assertEquals(value, 0)
found = True
self.assertEquals(found, True)
else:
Reported by Pylint.
Line: 73
Column: 24
self.session.reset()
stat_cur.reset()
while stat_cur.next() == 0:
[desc, pvalue, value] = stat_cur.get_values()
self.assertEquals(value, 0)
found = True
self.assertEquals(found, True)
else:
Reported by Pylint.
Line: 74
Column: 17
stat_cur.reset()
while stat_cur.next() == 0:
[desc, pvalue, value] = stat_cur.get_values()
self.assertEquals(value, 0)
found = True
self.assertEquals(found, True)
else:
msg = '/database statistics configuration/'
Reported by Pylint.
Line: 76
Column: 13
[desc, pvalue, value] = stat_cur.get_values()
self.assertEquals(value, 0)
found = True
self.assertEquals(found, True)
else:
msg = '/database statistics configuration/'
self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda:
self.session.open_cursor('statistics:session', None, config), msg)
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: 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
from wtscenario import make_scenarios
# test_stat07.py
# Session statistics cursor configurations.
Reported by Pylint.
Line: 35
Column: 1
# test_stat07.py
# Session statistics cursor configurations.
class test_stat_cursor_config(wttest.WiredTigerTestCase):
pfx = 'test_op_stat_cursor_config'
uri = [
('file', dict(uri='file:' + pfx, dataset=SimpleDataSet))
]
data_config = [
Reported by Pylint.
Line: 35
Column: 1
# test_stat07.py
# Session statistics cursor configurations.
class test_stat_cursor_config(wttest.WiredTigerTestCase):
pfx = 'test_op_stat_cursor_config'
uri = [
('file', dict(uri='file:' + pfx, dataset=SimpleDataSet))
]
data_config = [
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_txn18.py
12 issues
Line: 35
Column: 1
import fnmatch, os, shutil, time
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_txn18(wttest.WiredTigerTestCase, suite_subprocess):
t1 = 'table:test_txn18'
conn_config = 'log=(archive=false,enabled,file_max=100K),' + \
Reported by Pylint.
Line: 33
Column: 1
# Transactions: test recovery settings
#
import fnmatch, os, shutil, time
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_txn18(wttest.WiredTigerTestCase, suite_subprocess):
Reported by Pylint.
Line: 33
Column: 1
# Transactions: test recovery settings
#
import fnmatch, os, shutil, time
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_txn18(wttest.WiredTigerTestCase, suite_subprocess):
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: 33
Column: 1
# Transactions: test recovery settings
#
import fnmatch, os, shutil, time
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_txn18(wttest.WiredTigerTestCase, suite_subprocess):
Reported by Pylint.
Line: 35
Column: 1
import fnmatch, os, shutil, time
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_txn18(wttest.WiredTigerTestCase, suite_subprocess):
t1 = 'table:test_txn18'
conn_config = 'log=(archive=false,enabled,file_max=100K),' + \
Reported by Pylint.
Line: 35
Column: 1
import fnmatch, os, shutil, time
from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_txn18(wttest.WiredTigerTestCase, suite_subprocess):
t1 = 'table:test_txn18'
conn_config = 'log=(archive=false,enabled,file_max=100K),' + \
Reported by Pylint.
Line: 38
Column: 1
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_txn18(wttest.WiredTigerTestCase, suite_subprocess):
t1 = 'table:test_txn18'
conn_config = 'log=(archive=false,enabled,file_max=100K),' + \
'transaction_sync=(method=dsync,enabled)'
conn_recerror = conn_config + ',log=(recover=error)'
conn_recon = conn_config + ',log=(recover=on)'
Reported by Pylint.
Line: 38
Column: 1
import wiredtiger, wttest
from wtscenario import make_scenarios
class test_txn18(wttest.WiredTigerTestCase, suite_subprocess):
t1 = 'table:test_txn18'
conn_config = 'log=(archive=false,enabled,file_max=100K),' + \
'transaction_sync=(method=dsync,enabled)'
conn_recerror = conn_config + ',log=(recover=error)'
conn_recon = conn_config + ',log=(recover=on)'
Reported by Pylint.
Line: 51
Column: 5
]
scenarios = make_scenarios(key_format_values)
def simulate_crash(self, olddir, newdir):
''' Simulate a crash from olddir and restart in newdir. '''
# with the connection still open, copy files to new directory
shutil.rmtree(newdir, ignore_errors=True)
os.mkdir(newdir)
for fname in os.listdir(olddir):
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_alter03.py
12 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 wiredtiger, wttest
from wtscenario import make_scenarios
# test_alter03.py
# Check if app_metadata can be altered.
class test_alter03(wttest.WiredTigerTestCase):
Reported by Pylint.
Line: 30
Column: 1
# OTHER DEALINGS IN THE SOFTWARE.
import wiredtiger, wttest
from wtscenario import make_scenarios
# test_alter03.py
# Check if app_metadata can be altered.
class test_alter03(wttest.WiredTigerTestCase):
name = "alter03"
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: 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 wtscenario import make_scenarios
# test_alter03.py
# Check if app_metadata can be altered.
class test_alter03(wttest.WiredTigerTestCase):
Reported by Pylint.
Line: 34
Column: 1
# test_alter03.py
# Check if app_metadata can be altered.
class test_alter03(wttest.WiredTigerTestCase):
name = "alter03"
def verify_metadata(self, table_metastr, lsm_metastr, file_metastr):
c = self.session.open_cursor('metadata:', None, None)
Reported by Pylint.
Line: 34
Column: 1
# test_alter03.py
# Check if app_metadata can be altered.
class test_alter03(wttest.WiredTigerTestCase):
name = "alter03"
def verify_metadata(self, table_metastr, lsm_metastr, file_metastr):
c = self.session.open_cursor('metadata:', None, None)
Reported by Pylint.
Line: 37
Column: 5
class test_alter03(wttest.WiredTigerTestCase):
name = "alter03"
def verify_metadata(self, table_metastr, lsm_metastr, file_metastr):
c = self.session.open_cursor('metadata:', None, None)
if table_metastr != '':
# We must find a table type entry for this object and its value
# should contain the provided table meta string.
Reported by Pylint.
Line: 38
Column: 9
name = "alter03"
def verify_metadata(self, table_metastr, lsm_metastr, file_metastr):
c = self.session.open_cursor('metadata:', None, None)
if table_metastr != '':
# We must find a table type entry for this object and its value
# should contain the provided table meta string.
c.set_key('table:' + self.name)
Reported by Pylint.
Line: 67
Column: 5
c.close()
# Alter Table: Change the app_metadata and verify
def test_alter03_table_app_metadata(self):
uri = "table:" + self.name
entries = 100
create_params = 'key_format=i,value_format=i,'
app_meta_orig = 'app_metadata="meta_data_1",'
Reported by Pylint.
Line: 76
Column: 9
self.session.create(uri, create_params + app_meta_orig)
# Put some data in table.
c = self.session.open_cursor(uri, None)
for k in range(entries):
c[k+1] = 1
c.close()
# Verify the string in the metadata
Reported by Pylint.
src/third_party/wiredtiger/bench/wtperf/misc.c
12 issues
Line: 77
Column: 9
CWE codes:
134
Suggestion:
Use a constant for the format specification
if (err == 0 && level <= opts->verbose) {
va_start(ap, fmt);
vfprintf(wtperf->logf, fmt, ap);
va_end(ap);
fprintf(wtperf->logf, "\n");
if (level < opts->verbose) {
va_start(ap, fmt);
Reported by FlawFinder.
Line: 83
Column: 13
CWE codes:
134
Suggestion:
Use a constant for the format specification
if (level < opts->verbose) {
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
printf("\n");
}
}
if (err == 0)
Reported by FlawFinder.
Line: 93
Column: 5
CWE codes:
134
Suggestion:
Use a constant for the format specification
/* We are dealing with an error. */
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
fprintf(stderr, " Error: %s\n", wiredtiger_strerror(err));
if (wtperf->logf != NULL) {
va_start(ap, fmt);
vfprintf(wtperf->logf, fmt, ap);
Reported by FlawFinder.
Line: 98
Column: 9
CWE codes:
134
Suggestion:
Use a constant for the format specification
fprintf(stderr, " Error: %s\n", wiredtiger_strerror(err));
if (wtperf->logf != NULL) {
va_start(ap, fmt);
vfprintf(wtperf->logf, fmt, ap);
va_end(ap);
fprintf(wtperf->logf, " Error: %s\n", wiredtiger_strerror(err));
}
/* Never attempt to continue if we got a panic from WiredTiger. */
Reported by FlawFinder.
Line: 51
Column: 25
CWE codes:
362
len = strlen(wtperf->monitor_dir) + strlen(opts->table_name) + strlen(".stat") + 2;
fname = dmalloc(len);
testutil_check(__wt_snprintf(fname, len, "%s/%s.stat", wtperf->monitor_dir, opts->table_name));
if ((wtperf->logf = fopen(fname, "w")) == NULL) {
ret = errno;
fprintf(stderr, "%s: %s\n", fname, strerror(ret));
}
free(fname);
if (wtperf->logf == NULL)
Reported by FlawFinder.
Line: 131
Column: 27
CWE codes:
362
len = strlen(wtperf->home) + strlen(filename) + 10;
buf = dmalloc(len);
testutil_check(__wt_snprintf(buf, len, "%s/%s", wtperf->home, filename));
error_sys_check(rfd = open(buf, O_RDONLY, 0644));
/* Get the file's size. */
testutil_check(stat(buf, &st));
size = (uint32_t)st.st_size;
free(buf);
Reported by FlawFinder.
Line: 48
Column: 11
CWE codes:
126
if (opts->verbose < 1)
return (0);
len = strlen(wtperf->monitor_dir) + strlen(opts->table_name) + strlen(".stat") + 2;
fname = dmalloc(len);
testutil_check(__wt_snprintf(fname, len, "%s/%s.stat", wtperf->monitor_dir, opts->table_name));
if ((wtperf->logf = fopen(fname, "w")) == NULL) {
ret = errno;
fprintf(stderr, "%s: %s\n", fname, strerror(ret));
Reported by FlawFinder.
Line: 48
Column: 68
CWE codes:
126
if (opts->verbose < 1)
return (0);
len = strlen(wtperf->monitor_dir) + strlen(opts->table_name) + strlen(".stat") + 2;
fname = dmalloc(len);
testutil_check(__wt_snprintf(fname, len, "%s/%s.stat", wtperf->monitor_dir, opts->table_name));
if ((wtperf->logf = fopen(fname, "w")) == NULL) {
ret = errno;
fprintf(stderr, "%s: %s\n", fname, strerror(ret));
Reported by FlawFinder.
Line: 48
Column: 41
CWE codes:
126
if (opts->verbose < 1)
return (0);
len = strlen(wtperf->monitor_dir) + strlen(opts->table_name) + strlen(".stat") + 2;
fname = dmalloc(len);
testutil_check(__wt_snprintf(fname, len, "%s/%s.stat", wtperf->monitor_dir, opts->table_name));
if ((wtperf->logf = fopen(fname, "w")) == NULL) {
ret = errno;
fprintf(stderr, "%s: %s\n", fname, strerror(ret));
Reported by FlawFinder.
Line: 128
Column: 34
CWE codes:
126
rfd = -1;
/* Open the file handle. */
len = strlen(wtperf->home) + strlen(filename) + 10;
buf = dmalloc(len);
testutil_check(__wt_snprintf(buf, len, "%s/%s", wtperf->home, filename));
error_sys_check(rfd = open(buf, O_RDONLY, 0644));
/* Get the file's size. */
Reported by FlawFinder.
src/third_party/wiredtiger/src/utilities/util_dump.c
12 issues
Line: 289
CWE codes:
908
ret = util_err(session, ret, "%s", uri);
if ((tret = mcursor->close(mcursor)) != 0) {
tret = util_cerr(mcursor, "close", tret);
if (ret == 0)
ret = tret;
}
return (ret);
Reported by Cppcheck.
Line: 351
Column: 33
CWE codes:
134
Suggestion:
Use a constant for the format specification
*/
static int
dump_add_config(WT_SESSION *session, char **bufp, size_t *leftp, const char *fmt, ...)
WT_GCC_FUNC_ATTRIBUTE((format(printf, 4, 5)))
{
WT_DECL_RET;
size_t n;
va_list ap;
Reported by FlawFinder.
Line: 129
Column: 20
CWE codes:
362
/* Open any optional output file. */
if (ofile == NULL)
fp = stdout;
else if ((fp = fopen(ofile, "w")) == NULL)
return (util_err(session, errno, "%s: open", ofile));
if (json && (dump_json_begin(session) != 0 || dump_prefix(session, pretty, hex, json) != 0))
goto err;
Reported by FlawFinder.
Line: 383
Column: 59
CWE codes:
126
char *newconfig;
const char *keyformat, *p;
len = strlen(config) + strlen(cursor->value_format) + strlen(cursor->uri) + 20;
if ((newconfig = malloc(len)) == NULL)
return (util_err(session, errno, NULL));
*newconfigp = newconfig;
wt_api = session->connection->get_extension_api(session->connection);
if ((ret = wt_api->config_parser_open(wt_api, session, config, strlen(config), &parser)) != 0)
Reported by FlawFinder.
Line: 383
Column: 11
CWE codes:
126
char *newconfig;
const char *keyformat, *p;
len = strlen(config) + strlen(cursor->value_format) + strlen(cursor->uri) + 20;
if ((newconfig = malloc(len)) == NULL)
return (util_err(session, errno, NULL));
*newconfigp = newconfig;
wt_api = session->connection->get_extension_api(session->connection);
if ((ret = wt_api->config_parser_open(wt_api, session, config, strlen(config), &parser)) != 0)
Reported by FlawFinder.
Line: 383
Column: 28
CWE codes:
126
char *newconfig;
const char *keyformat, *p;
len = strlen(config) + strlen(cursor->value_format) + strlen(cursor->uri) + 20;
if ((newconfig = malloc(len)) == NULL)
return (util_err(session, errno, NULL));
*newconfigp = newconfig;
wt_api = session->connection->get_extension_api(session->connection);
if ((ret = wt_api->config_parser_open(wt_api, session, config, strlen(config), &parser)) != 0)
Reported by FlawFinder.
Line: 388
Column: 68
CWE codes:
126
return (util_err(session, errno, NULL));
*newconfigp = newconfig;
wt_api = session->connection->get_extension_api(session->connection);
if ((ret = wt_api->config_parser_open(wt_api, session, config, strlen(config), &parser)) != 0)
return (util_err(session, ret, "WT_EXTENSION_API.config_parser_open"));
keyformat = cursor->key_format;
for (nkeys = 0; *keyformat; keyformat++)
if (!__wt_isdigit((u_char)*keyformat))
nkeys++;
Reported by FlawFinder.
Line: 418
Column: 22
CWE codes:
126
/* copy names of projected values */
p = strchr(cursor->uri, '(');
assert(p != NULL);
assert(p[strlen(p) - 1] == ')');
p++;
if (*p != ')')
WT_RET(dump_add_config(session, &newconfig, &len, "%s", ","));
WT_RET(dump_add_config(session, &newconfig, &len, "%.*s),", (int)(strlen(p) - 1), p));
} else if (value.type == WT_CONFIG_ITEM_STRING && value.len != 0)
Reported by FlawFinder.
Line: 422
Column: 79
CWE codes:
126
p++;
if (*p != ')')
WT_RET(dump_add_config(session, &newconfig, &len, "%s", ","));
WT_RET(dump_add_config(session, &newconfig, &len, "%.*s),", (int)(strlen(p) - 1), p));
} else if (value.type == WT_CONFIG_ITEM_STRING && value.len != 0)
WT_RET(
dump_add_config(session, &newconfig, &len, "\"%.*s\",", (int)value.len, value.str));
else
WT_RET(dump_add_config(session, &newconfig, &len, "%.*s,", (int)value.len, value.str));
Reported by FlawFinder.
Line: 514
Column: 27
CWE codes:
126
return (util_err(session, EIO, NULL));
}
len = strlen(entry) + strlen(name) + 1;
if ((uriprefix = malloc(len)) == NULL)
return (util_err(session, errno, NULL));
if ((ret = __wt_snprintf(uriprefix, len, "%s%s", entry, name)) != 0) {
free(uriprefix);
return (util_err(session, ret, NULL));
Reported by FlawFinder.