[Git][reproducible-builds/diffoscope][master] Don't run binwalk tests as root (or, more likely, under fakeroot). The latest...
Chris Lamb (@lamby)
gitlab at salsa.debian.org
Fri Feb 4 17:43:11 UTC 2022
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
2de5369c by Chris Lamb at 2022-02-04T09:42:19-08:00
Don't run binwalk tests as root (or, more likely, under fakeroot). The latest version of binwalk has some security protection against this.
- - - - -
1 changed file:
- tests/comparators/test_binwalk.py
Changes:
=====================================
tests/comparators/test_binwalk.py
=====================================
@@ -1,7 +1,7 @@
#
# diffoscope: in-depth comparison of files, archives, and directories
#
-# Copyright © 2017, 2020 Chris Lamb <lamby at debian.org>
+# Copyright © 2017, 2020, 2022 Chris Lamb <lamby at debian.org>
#
# diffoscope is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with diffoscope. If not, see <https://www.gnu.org/licenses/>.
+import os
import pytest
from diffoscope.comparators.binwalk import BinwalkFile
@@ -27,13 +28,19 @@ from ..utils.nonexisting import assert_non_existing
binwalk1 = load_fixture("test1.binwalk")
binwalk2 = load_fixture("test2.binwalk")
+skip_if_root = pytest.mark.skipif(
+ os.getuid() == 0, reason="cannot be run as root"
+)
+
+ at skip_if_root
@skip_unless_module_exists("binwalk")
def test_identification(binwalk1, binwalk2):
assert isinstance(binwalk1, BinwalkFile)
assert isinstance(binwalk2, BinwalkFile)
+ at skip_if_root
@skip_unless_module_exists("binwalk")
def test_no_differences(binwalk1):
difference = binwalk1.compare(binwalk1)
@@ -45,6 +52,7 @@ def comparison(binwalk1, binwalk2):
return binwalk1.compare(binwalk2)
+ at skip_if_root
@skip_unless_tools_exist("cpio")
@skip_unless_module_exists("binwalk")
def test_listing(comparison):
@@ -57,6 +65,7 @@ def test_listing(comparison):
assert differences[0].details[0].unified_diff == expected_diff
+ at skip_if_root
@skip_unless_tools_exist("cpio")
@skip_unless_module_exists("binwalk")
def test_symlink(comparison):
@@ -67,6 +76,7 @@ def test_symlink(comparison):
assert differences[0].details[1].unified_diff == expected_diff
+ at skip_if_root
@skip_unless_tools_exist("cpio")
@skip_unless_module_exists("binwalk")
def test_compare_non_existing(monkeypatch, binwalk1):
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/2de5369c83a09e49ef93700728323c05d908af01
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/2de5369c83a09e49ef93700728323c05d908af01
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20220204/66d72e9d/attachment.htm>
More information about the rb-commits
mailing list