Skip to content

Commit bac8046

Browse files
committed
Merge bitcoin/bitcoin#34831: lint: remove excluded files from whitespace check
f55c891 lint: more reuse of SHARED_EXCLUDED_SUBTREES (fanquake) 8864917 lint: add missing ipc/test to grep_boost_fixture_test_suite (fanquake) ecefc12 lint: fix lint issue in lint script (fanquake) ee8c22e contrib: fix whitespace issues in scripts (fanquake) 04e2118 lint: remove excluded .cpp/.h files from whitespace check (fanquake) Pull request description: The `.cpp`/`.h` have been fixed since #32482 and 5d25a82. Fix other offending files. ACKs for top commit: stickies-v: re-ACK f55c891 maflcko: re-ACK f55c891 🗿 kevkevinpal: ACK [f55c891](bitcoin/bitcoin@f55c891) sedited: Re-ACK f55c891 Tree-SHA512: 975c217d1cc82433b7960dad47976254d36526f3bd156133dcd4eb51b34616beb89e1449c245deb8b41ab6e1f746a96a0b629013e1996f355e521d075f4692c8
2 parents ff7cdf6 + f55c891 commit bac8046

File tree

10 files changed

+98
-108
lines changed

10 files changed

+98
-108
lines changed

contrib/init/bitcoind.openrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/sbin/openrc-run
22

3-
# backward compatibility for existing gentoo layout
3+
# backward compatibility for existing gentoo layout
44
#
55
if [ -d "/var/lib/bitcoin/.bitcoin" ]; then
66
BITCOIND_DEFAULT_DATADIR="/var/lib/bitcoin/.bitcoin"

contrib/macdeploy/macdeployqtplus

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ class FrameworkInfo(object):
4242
self.sourceContentsDirectory = ""
4343
self.destinationResourcesDirectory = ""
4444
self.destinationVersionContentsDirectory = ""
45-
45+
4646
def __eq__(self, other):
4747
if self.__class__ == other.__class__:
4848
return self.__dict__ == other.__dict__
4949
else:
5050
return False
51-
51+
5252
def __str__(self):
5353
return f""" Framework name: {self.frameworkName}
5454
Framework directory: {self.frameworkDirectory}
@@ -62,51 +62,51 @@ class FrameworkInfo(object):
6262
Source file Path: {self.sourceFilePath}
6363
Deployed Directory (relative to bundle): {self.destinationDirectory}
6464
"""
65-
65+
6666
def isDylib(self):
6767
return self.frameworkName.endswith(".dylib")
68-
68+
6969
def isQtFramework(self):
7070
if self.isDylib():
7171
return self.frameworkName.startswith("libQt")
7272
else:
7373
return self.frameworkName.startswith("Qt")
74-
74+
7575
reOLine = re.compile(r'^(.+) \(compatibility version [0-9.]+, current version [0-9.]+\)$')
7676
bundleFrameworkDirectory = "Contents/Frameworks"
7777
bundleBinaryDirectory = "Contents/MacOS"
78-
78+
7979
@classmethod
8080
def fromLibraryLine(cls, line: str) -> Optional['FrameworkInfo']:
8181
# Note: line must be trimmed
8282
if line == "":
8383
return None
84-
84+
8585
# Don't deploy system libraries
8686
if line.startswith("/System/Library/") or line.startswith("@executable_path") or line.startswith("/usr/lib/"):
8787
return None
88-
88+
8989
m = cls.reOLine.match(line)
9090
if m is None:
9191
raise RuntimeError(f"Line could not be parsed: {line}")
92-
92+
9393
path = m.group(1)
94-
94+
9595
info = cls()
9696
info.sourceFilePath = path
9797
info.installName = path
98-
98+
9999
if path.endswith(".dylib"):
100100
dirname, filename = os.path.split(path)
101101
info.frameworkName = filename
102102
info.frameworkDirectory = dirname
103103
info.frameworkPath = path
104-
104+
105105
info.binaryDirectory = dirname
106106
info.binaryName = filename
107107
info.binaryPath = path
108108
info.version = "-"
109-
109+
110110
info.installName = path
111111
info.deployedInstallName = f"@executable_path/../Frameworks/{info.binaryName}"
112112
info.sourceFilePath = path
@@ -121,25 +121,25 @@ class FrameworkInfo(object):
121121
i += 1
122122
if i == len(parts):
123123
raise RuntimeError(f"Could not find .framework or .dylib in line: {line}")
124-
124+
125125
info.frameworkName = parts[i]
126126
info.frameworkDirectory = "/".join(parts[:i])
127127
info.frameworkPath = os.path.join(info.frameworkDirectory, info.frameworkName)
128-
128+
129129
info.binaryName = parts[i+3]
130130
info.binaryDirectory = "/".join(parts[i+1:i+3])
131131
info.binaryPath = os.path.join(info.binaryDirectory, info.binaryName)
132132
info.version = parts[i+2]
133-
133+
134134
info.deployedInstallName = f"@executable_path/../Frameworks/{os.path.join(info.frameworkName, info.binaryPath)}"
135135
info.destinationDirectory = os.path.join(cls.bundleFrameworkDirectory, info.frameworkName, info.binaryDirectory)
136-
136+
137137
info.sourceResourcesDirectory = os.path.join(info.frameworkPath, "Resources")
138138
info.sourceContentsDirectory = os.path.join(info.frameworkPath, "Contents")
139139
info.sourceVersionContentsDirectory = os.path.join(info.frameworkPath, "Versions", info.version, "Contents")
140140
info.destinationResourcesDirectory = os.path.join(cls.bundleFrameworkDirectory, info.frameworkName, "Resources")
141141
info.destinationVersionContentsDirectory = os.path.join(cls.bundleFrameworkDirectory, info.frameworkName, "Versions", info.version, "Contents")
142-
142+
143143
return info
144144

145145
class ApplicationBundleInfo(object):
@@ -289,45 +289,45 @@ def copyFramework(framework: FrameworkInfo, path: str, verbose: int) -> Optional
289289
def deployFrameworks(frameworks: list[FrameworkInfo], bundlePath: str, binaryPath: str, strip: bool, verbose: int, deploymentInfo: Optional[DeploymentInfo] = None) -> DeploymentInfo:
290290
if deploymentInfo is None:
291291
deploymentInfo = DeploymentInfo()
292-
292+
293293
while len(frameworks) > 0:
294294
framework = frameworks.pop(0)
295295
deploymentInfo.deployedFrameworks.append(framework.frameworkName)
296-
296+
297297
print("Processing", framework.frameworkName, "...")
298-
298+
299299
# Get the Qt path from one of the Qt frameworks
300300
if deploymentInfo.qtPath is None and framework.isQtFramework():
301301
deploymentInfo.detectQtPath(framework.frameworkDirectory)
302-
302+
303303
if framework.installName.startswith("@executable_path") or framework.installName.startswith(bundlePath):
304304
print(framework.frameworkName, "already deployed, skipping.")
305305
continue
306-
306+
307307
# install_name_tool the new id into the binary
308308
changeInstallName(framework.installName, framework.deployedInstallName, binaryPath, verbose)
309-
309+
310310
# Copy framework to app bundle.
311311
deployedBinaryPath = copyFramework(framework, bundlePath, verbose)
312312
# Skip the rest if already was deployed.
313313
if deployedBinaryPath is None:
314314
continue
315-
315+
316316
if strip:
317317
runStrip(deployedBinaryPath, verbose)
318-
318+
319319
# install_name_tool it a new id.
320320
changeIdentification(framework.deployedInstallName, deployedBinaryPath, verbose)
321321
# Check for framework dependencies
322322
dependencies = getFrameworks(deployedBinaryPath, verbose, rpath=framework.frameworkDirectory)
323-
323+
324324
for dependency in dependencies:
325325
changeInstallName(dependency.installName, dependency.deployedInstallName, deployedBinaryPath, verbose)
326-
326+
327327
# Deploy framework if necessary.
328328
if dependency.frameworkName not in deploymentInfo.deployedFrameworks and dependency not in frameworks:
329329
frameworks.append(dependency)
330-
330+
331331
return deploymentInfo
332332

333333
def deployFrameworksForAppBundle(applicationBundle: ApplicationBundleInfo, strip: bool, verbose: int) -> DeploymentInfo:
@@ -355,29 +355,29 @@ def deployPlugins(appBundleInfo: ApplicationBundleInfo, deploymentInfo: Deployme
355355
continue
356356

357357
plugins.append((pluginDirectory, pluginName))
358-
358+
359359
for pluginDirectory, pluginName in plugins:
360360
print("Processing plugin", os.path.join(pluginDirectory, pluginName), "...")
361-
361+
362362
sourcePath = os.path.join(deploymentInfo.pluginPath, pluginDirectory, pluginName)
363363
destinationDirectory = os.path.join(appBundleInfo.pluginPath, pluginDirectory)
364364
if not os.path.exists(destinationDirectory):
365365
os.makedirs(destinationDirectory)
366-
366+
367367
destinationPath = os.path.join(destinationDirectory, pluginName)
368368
shutil.copy2(sourcePath, destinationPath)
369369
if verbose:
370370
print("Copied:", sourcePath)
371371
print(" to:", destinationPath)
372-
372+
373373
if strip:
374374
runStrip(destinationPath, verbose)
375-
375+
376376
dependencies = getFrameworks(destinationPath, verbose)
377-
377+
378378
for dependency in dependencies:
379379
changeInstallName(dependency.installName, dependency.deployedInstallName, destinationPath, verbose)
380-
380+
381381
# Deploy framework if necessary.
382382
if dependency.frameworkName not in deploymentInfo.deployedFrameworks:
383383
deployFrameworks([dependency], appBundleInfo.path, destinationPath, strip, verbose, deploymentInfo)
@@ -446,7 +446,7 @@ except RuntimeError as e:
446446

447447
if config.plugins:
448448
print("+ Deploying plugins +")
449-
449+
450450
try:
451451
deployPlugins(applicationBundle, deploymentInfo, config.strip, verbose)
452452
except RuntimeError as e:

contrib/qos/tc.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ tc filter add dev ${IF} parent 1: protocol ip prio 1 handle 1 fw classid 1:10
3434
tc filter add dev ${IF} parent 1: protocol ip prio 2 handle 2 fw classid 1:11
3535

3636
if [ -n "${LOCALNET_V6}" ] ; then
37-
# v6 cannot have the same priority value as v4
38-
tc filter add dev ${IF} parent 1: protocol ipv6 prio 3 handle 1 fw classid 1:10
39-
tc filter add dev ${IF} parent 1: protocol ipv6 prio 4 handle 2 fw classid 1:11
37+
# v6 cannot have the same priority value as v4
38+
tc filter add dev ${IF} parent 1: protocol ipv6 prio 3 handle 1 fw classid 1:10
39+
tc filter add dev ${IF} parent 1: protocol ipv6 prio 4 handle 2 fw classid 1:11
4040
fi
4141

4242
#delete any existing rules
@@ -57,6 +57,6 @@ iptables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET_V4} -j M
5757
iptables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET_V4} -j MARK --set-mark 0x2
5858

5959
if [ -n "${LOCALNET_V6}" ] ; then
60-
ip6tables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4
61-
ip6tables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4
60+
ip6tables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4
61+
ip6tables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4
6262
fi

contrib/verify-commits/gpg.sh

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,27 @@ if [ "$BITCOIN_VERIFY_COMMITS_ALLOW_SHA1" = 1 ]; then
99
printf '%s\n' "$INPUT" | gpg --trust-model always "$@" 2>/dev/null
1010
exit $?
1111
else
12-
# Note how we've disabled SHA1 with the --weak-digest option, disabling
13-
# signatures - including selfsigs - that use SHA1. While you might think that
14-
# collision attacks shouldn't be an issue as they'd be an attack on yourself,
15-
# in fact because what's being signed is a commit object that's
16-
# semi-deterministically generated by untrusted input (the pull-req) in theory
17-
# an attacker could construct a pull-req that results in a commit object that
18-
# they've created a collision for. Not the most likely attack, but preventing
19-
# it is pretty easy so we do so as a "belt-and-suspenders" measure.
20-
for LINE in $(gpg --version); do
21-
case "$LINE" in
22-
"gpg (GnuPG) 1.4.1"*|"gpg (GnuPG) 2.0."*)
23-
echo "Please upgrade to at least gpg 2.1.10 to check for weak signatures" > /dev/stderr
24-
printf '%s\n' "$INPUT" | gpg --trust-model always "$@" 2>/dev/null
25-
exit $?
26-
;;
27-
# We assume if you're running 2.1+, you're probably running 2.1.10+
28-
# gpg will fail otherwise
29-
# We assume if you're running 1.X, it is either 1.4.1X or 1.4.20+
30-
# gpg will fail otherwise
31-
esac
32-
done
33-
printf '%s\n' "$INPUT" | gpg --trust-model always --weak-digest sha1 "$@" 2>/dev/null
34-
exit $?
12+
# Note how we've disabled SHA1 with the --weak-digest option, disabling
13+
# signatures - including selfsigs - that use SHA1. While you might think that
14+
# collision attacks shouldn't be an issue as they'd be an attack on yourself,
15+
# in fact because what's being signed is a commit object that's
16+
# semi-deterministically generated by untrusted input (the pull-req) in theory
17+
# an attacker could construct a pull-req that results in a commit object that
18+
# they've created a collision for. Not the most likely attack, but preventing
19+
# it is pretty easy so we do so as a "belt-and-suspenders" measure.
20+
for LINE in $(gpg --version); do
21+
case "$LINE" in
22+
"gpg (GnuPG) 1.4.1"*|"gpg (GnuPG) 2.0."*)
23+
echo "Please upgrade to at least gpg 2.1.10 to check for weak signatures" > /dev/stderr
24+
printf '%s\n' "$INPUT" | gpg --trust-model always "$@" 2>/dev/null
25+
exit $?
26+
;;
27+
# We assume if you're running 2.1+, you're probably running 2.1.10+
28+
# gpg will fail otherwise
29+
# We assume if you're running 1.X, it is either 1.4.1X or 1.4.20+
30+
# gpg will fail otherwise
31+
esac
32+
done
33+
printf '%s\n' "$INPUT" | gpg --trust-model always --weak-digest sha1 "$@" 2>/dev/null
34+
exit $?
3535
fi

test/lint/git-subtree-check.sh

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,33 +47,33 @@ fi
4747
# Taken from git-subtree (Copyright (C) 2009 Avery Pennarun <apenwarr@gmail.com>)
4848
find_latest_squash()
4949
{
50-
dir="$1"
51-
sq=
52-
main=
53-
sub=
54-
git log --grep="^git-subtree-dir: $dir/*\$" \
55-
--pretty=format:'START %H%n%s%n%n%b%nEND%n' "$COMMIT" |
56-
while read a b _; do
57-
case "$a" in
58-
START) sq="$b" ;;
59-
git-subtree-mainline:) main="$b" ;;
60-
git-subtree-split:) sub="$b" ;;
61-
END)
62-
if [ -n "$sub" ]; then
63-
if [ -n "$main" ]; then
64-
# a rejoin commit?
65-
# Pretend its sub was a squash.
66-
sq="$sub"
67-
fi
68-
echo "$sq" "$sub"
69-
break
70-
fi
71-
sq=
72-
main=
73-
sub=
74-
;;
75-
esac
76-
done
50+
dir="$1"
51+
sq=
52+
main=
53+
sub=
54+
git log --grep="^git-subtree-dir: $dir/*\$" \
55+
--pretty=format:'START %H%n%s%n%n%b%nEND%n' "$COMMIT" |
56+
while read a b _; do
57+
case "$a" in
58+
START) sq="$b" ;;
59+
git-subtree-mainline:) main="$b" ;;
60+
git-subtree-split:) sub="$b" ;;
61+
END)
62+
if [ -n "$sub" ]; then
63+
if [ -n "$main" ]; then
64+
# a rejoin commit?
65+
# Pretend its sub was a squash.
66+
sq="$sub"
67+
fi
68+
echo "$sq" "$sub"
69+
break
70+
fi
71+
sq=
72+
main=
73+
sub=
74+
;;
75+
esac
76+
done
7777
}
7878

7979
# find latest subtree update

test/lint/lint-include-guards.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
HEADER_ID_SUFFIX = '_H'
2020

2121
EXCLUDE_FILES_WITH_PREFIX = ['contrib/devtools/bitcoin-tidy',
22-
'src/crypto/ctaes',
2322
'src/tinyformat.h',
2423
'src/bench/nanobench.h',
2524
'src/test/fuzz/FuzzedDataProvider.h'] + SHARED_EXCLUDED_SUBTREES

test/lint/lint-locale-dependence.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040

4141
from subprocess import check_output, CalledProcessError
4242

43+
from lint_ignore_dirs import SHARED_EXCLUDED_SUBTREES
44+
4345

4446
KNOWN_VIOLATIONS = [
4547
"src/dbwrapper.cpp:.*vsnprintf",
@@ -50,13 +52,8 @@
5052
]
5153

5254
REGEXP_EXTERNAL_DEPENDENCIES_EXCLUSIONS = [
53-
"src/crypto/ctaes/",
54-
"src/ipc/libmultiprocess/",
55-
"src/leveldb/",
56-
"src/secp256k1/",
57-
"src/minisketch/",
5855
"src/tinyformat.h",
59-
]
56+
] + SHARED_EXCLUDED_SUBTREES
6057

6158
LOCALE_DEPENDENT_FUNCTIONS = [
6259
"alphasort", # LC_COLLATE (via strcoll)

test/lint/lint-tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def grep_boost_fixture_test_suite():
2020
"-E",
2121
r"^BOOST_FIXTURE_TEST_SUITE\(",
2222
"--",
23+
"src/ipc/test/**.cpp",
2324
"src/test/**.cpp",
2425
"src/wallet/test/**.cpp",
2526
]

0 commit comments

Comments
 (0)