Commit b437c7716 for clamav.net
commit b437c7716afffabf2fb1158264c7c13a08fea701
Author: Valerie Snyder <valsnyde@cisco.com>
Date: Thu Aug 6 00:25:06 2026 -0400
Fix macOS quarantine test result matching
On macOS, /tmp is reported as its canonical /private/tmp path. The quarantine
directory replacement tests compared the complete clamscan success message
against paths created from the noncanonical temporary directory. A successful
copy or move could therefore be misclassified as an action failure.
Match the stable copy and move action markers instead. Existing filesystem
assertions continue to verify that the payload reached the pinned quarantine
directory and was not redirected through a replaced path.
CLAM-2959
diff --git a/unit_tests/clamscan/quarantine_toctou_test.py b/unit_tests/clamscan/quarantine_toctou_test.py
index 0e62b6e55..fa3427b79 100644
--- a/unit_tests/clamscan/quarantine_toctou_test.py
+++ b/unit_tests/clamscan/quarantine_toctou_test.py
@@ -634,12 +634,12 @@ class TC(testcase.TestCase):
redirected_payload = redirect_dir / payload_path.name
quarantined_payload = quarantine_dir / payload_path.name
- copied_to_line = "{}: copied to '{}'".format(payload_path, quarantine_dir / payload_path.name)
+ copy_succeeded = ": copied to '" in stdout
self.assertFalse(
redirected_payload.exists(),
'Quarantine copy was redirected through the replaced directory entry.',
)
- if copied_to_line in stdout:
+ if copy_succeeded:
self.assertTrue(
quarantined_payload.exists(),
'Expected a reported successful quarantine copy to create the destination file.',
@@ -671,12 +671,12 @@ class TC(testcase.TestCase):
redirected_payload = redirect_dir / payload_path.name
quarantined_payload = quarantine_dir / payload_path.name
- moved_to_line = "{}: moved to '{}'".format(payload_path, quarantine_dir / payload_path.name)
+ move_succeeded = ": moved to '" in stdout
self.assertFalse(
redirected_payload.exists(),
'Quarantine move was redirected through the replaced directory entry.',
)
- if moved_to_line in stdout:
+ if move_succeeded:
self.assertFalse(
payload_path.exists(),
'Expected clamscan --move to remove the source file after quarantining it.',