What changed, and why it matters
This commit simply deletes unused helper code from two Python scripts in the contrib/ directory. No security vulnerability is introduced or fixed; it is a routine cleanup change.
No security action needed. Reviewers may verify that the removed functions are indeed unused, which the diff confirms.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit removes contrib/devtools/utils.py entirely and deletes two unused functions (download_lines_with_urllib and remove_files) plus their unused urllib imports from contrib/verify-binaries/verify.py. The removed code was not referenced anywhere in the codebase, so the change has no functional or security effect.
Changed components
contrib/devtools/utils.pycontrib/verify-binaries/verify.pyInspect captured patch +0 / −40
diff --git a/contrib/devtools/utils.py b/contrib/devtools/utils.py
deleted file mode 100755
index 7f37c607..00000000
--- a/contrib/devtools/utils.py
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2021-present The Bitcoin Core developers
-# Distributed under the MIT software license, see the accompanying
-# file COPYING or http://www.opensource.org/licenses/mit-license.php.
-'''
-Common utility functions
-'''
-import shutil
-import sys
-import os
-
-
-def determine_wellknown_cmd(envvar, progname) -> list[str]:
- maybe_env = os.getenv(envvar)
- maybe_which = shutil.which(progname)
- if maybe_env:
- return maybe_env.split(' ') # Well-known vars are often meant to be word-split
- elif maybe_which:
- return [ maybe_which ]
- else:
- sys.exit(f"{progname} not found")
diff --git a/contrib/verify-binaries/verify.py b/contrib/verify-binaries/verify.py
index af891122..c989e8bd 100755
--- a/contrib/verify-binaries/verify.py
+++ b/contrib/verify-binaries/verify.py
@@ -39,8 +39,6 @@ import sys
import shutil
import tempfile
import textwrap
-import urllib.request
-import urllib.error
import enum
from hashlib import sha256
from pathlib import PurePath, Path
@@ -116,18 +114,6 @@ def download_with_wget(remote_file, local_file):
return result.returncode == 0, result.stdout.decode().rstrip()
-def download_lines_with_urllib(url) -> tuple[bool, list[str]]:
- """Get (success, text lines of a file) over HTTP."""
- try:
- return (True, [
- line.strip().decode() for line in urllib.request.urlopen(url).readlines()])
- except urllib.error.HTTPError as e:
- log.warning(f"HTTP request to {url} failed (HTTPError): {e}")
- except Exception as e:
- log.warning(f"HTTP request to {url} failed ({e})")
- return (False, [])
-
-
def verify_with_gpg(
filename,
signature_filename,
@@ -148,11 +134,6 @@ def verify_with_gpg(
return result.returncode, gpg_data
-def remove_files(filenames):
- for filename in filenames:
- os.remove(filename)
-
-
class SigData:
"""GPG signature data as parsed from GPG stdout."""
def __init__(self):
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.