diff --git a/src/mvt/ios/cmd_check_sysdiagnose.py b/src/mvt/ios/cmd_check_sysdiagnose.py index c700e6bb..26e4d49f 100644 --- a/src/mvt/ios/cmd_check_sysdiagnose.py +++ b/src/mvt/ios/cmd_check_sysdiagnose.py @@ -88,6 +88,8 @@ class CmdIOSCheckSysdiagnose(Command): parent_path = Path(self.target_path).absolute().parent for root, _, filenames in os.walk(self.target_path): for filename in filenames: + if filename.startswith("._"): + continue absolute_path = os.path.join(root, filename) file_path = os.path.relpath(absolute_path, parent_path) self.sysdiagnose_files.append(file_path) @@ -137,6 +139,11 @@ class CmdIOSCheckSysdiagnose(Command): if not member_path.parts: continue + # AppleDouble sidecars (._name) carry a file's extended attributes, + # not sysdiagnose content. Device archives hold hundreds of them; + # bsdtar hides them from listings, tarfile does not. + if member_path.name.startswith("._"): + continue archive_roots.add(member_path.parts[0]) if member.isdir(): diff --git a/tests/test_cmd_check_sysdiagnose.py b/tests/test_cmd_check_sysdiagnose.py index 020c8616..b00b648b 100644 --- a/tests/test_cmd_check_sysdiagnose.py +++ b/tests/test_cmd_check_sysdiagnose.py @@ -34,6 +34,7 @@ def _create_sysdiagnose_folder(tmp_path): "sysdiagnose_2024.01.02_03-04-05+0200.tar.gz", encoding="utf-8" ) (folder / "report.ips").write_text('{"bug_type": 210}\nbody', encoding="utf-8") + (folder / "._artifact.txt").write_bytes(b"\x00\x05\x16\x07AppleDouble") return folder @@ -67,6 +68,7 @@ def test_check_sysdiagnose_from_folder(tmp_path): assert _test_module(command).ips_files == [ {"file_path": str(tmp_path / "sysdiagnose" / "report.ips"), "bug_type": 210} ] + assert "sysdiagnose/._artifact.txt" not in command.sysdiagnose_files def test_check_sysdiagnose_from_archive_closes_archive(tmp_path): @@ -83,6 +85,7 @@ def test_check_sysdiagnose_from_archive_closes_archive(tmp_path): } ] assert command.sysdiagnose_archive is None + assert "sysdiagnose/._artifact.txt" not in command.sysdiagnose_files def test_archive_is_extracted_once_and_unsafe_members_are_skipped(tmp_path):