Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates #466

Merged
merged 6 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ repos:
rev: v0.6.5
hooks:
- id: ruff
args: [--fix]
- repo: https://github.com/ambv/black
rev: 24.8.0
hooks:
Expand Down
3 changes: 2 additions & 1 deletion grizzly/common/bugzilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ def _fetch_attachments(self) -> None:
if (
attachment.is_obsolete
or attachment.content_type == "text/x-phabricator-request"
or not attachment.file_name
or attachment.file_name.split(".")[-1] in IGNORE_EXTS
):
continue
try:
data = b64decode(attachment.data)
data = b64decode(attachment.data or "")
except binascii.Error as exc:
LOG.warning(
"Failed to decode attachment: %r (%s)", attachment.file_name, exc
Expand Down
10 changes: 4 additions & 6 deletions grizzly/common/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

# import FuzzManager utilities
from Collector.Collector import Collector
from fasteners.process_lock import InterProcessLock
from FTB.ProgramConfiguration import ProgramConfiguration
from FTB.Signatures.CrashInfo import CrashInfo, CrashSignature

Expand Down Expand Up @@ -186,11 +185,10 @@ def crash_signature(self) -> CrashSignature | None:
if self._signature is None:
collector = Collector()
if collector.sigCacheDir and Path(collector.sigCacheDir).is_dir():
with InterProcessLock(str(grz_tmp() / "fm_sigcache.lock")):
cache_sig, _ = collector.search(self.crash_info)
if cache_sig:
LOG.debug("signature loaded from cache file %r", cache_sig)
self._signature = CrashSignature.fromFile(cache_sig)
cache_sig, _ = collector.search(self.crash_info)
if cache_sig:
LOG.debug("signature loaded from cache file %r", cache_sig)
self._signature = CrashSignature.fromFile(cache_sig)
# if cache lookup failed generate a crash signature
if self._signature is None:
self._signature = self.crash_info.createCrashSignature(
Expand Down
4 changes: 1 addition & 3 deletions grizzly/common/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from zipfile import ZIP_DEFLATED, ZipFile

from Collector.Collector import Collector
from fasteners.process_lock import InterProcessLock
from psutil import disk_usage

from .report import Report
Expand Down Expand Up @@ -248,8 +247,7 @@ def _submit_report(
if not force:
if collector.sigCacheDir and Path(collector.sigCacheDir).is_dir():
# search for a cached signature match
with InterProcessLock(str(grz_tmp() / "fm_sigcache.lock")):
_, cache_metadata = collector.search(report.crash_info)
_, cache_metadata = collector.search(report.crash_info)
# check if signature has been marked as frequent in FM
if cache_metadata and cache_metadata["frequent"]:
LOG.info(
Expand Down
4 changes: 2 additions & 2 deletions grizzly/reduce/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ def run(
result.report.minor in other_results
)

is_smaller = None
is_smaller = False
if other_result_exists:
# we have a result already queued for this sig
# check size to see which to keep
Expand All @@ -609,7 +609,7 @@ def run(
old_size = sum(
tc.data_size for tc in old_reduction
)
is_smaller = bool(reduction_size < old_size)
is_smaller = reduction_size < old_size

if not other_result_exists or is_smaller:
if other_result_exists:
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ install_requires =
bugsy
cryptography
cssbeautifier
fasteners
ffpuppet >= 0.13.1
FuzzManager
jsbeautifier
Expand Down
16 changes: 2 additions & 14 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,9 @@ usedevelop = true

[testenv:pypi]
commands =
python setup.py sdist bdist_wheel
python -m build
twine upload --skip-existing dist/*
deps =
setuptools>=43
setuptools_scm[toml]>=3.4
build
twine
wheel
skip_install = true

[flake8]
# E203, W503, and W504 are all black compat
ignore =
E203
W503
enable =
W504
max-line-length = 88
show-source = true
Loading