32c889ac2d
resolves: RHEL-50563
44 lines
2.0 KiB
Diff
44 lines
2.0 KiB
Diff
From de867ec1e519a621664cba25ad5e778da3dfec1e Mon Sep 17 00:00:00 2001
|
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
Date: Thu, 25 Jul 2024 08:53:46 +0100
|
|
Subject: [PATCH] -i ova: Ignore dot-underscore-files in OVA files
|
|
|
|
I received an OVA created by a mac which contained various files
|
|
prefixed by "._" that contain some sort of extra information. Ignore
|
|
those files when decoding OVAs:
|
|
|
|
$ tar tvf win22ktest.tar 2>/dev/null
|
|
drwxr-xr-x markd/staff 0 2024-07-23 18:23 win22test/
|
|
-rw-r--r-- markd/staff 619 2024-07-23 15:16 win22test/._win22test.mf
|
|
-rw-r--r-- markd/staff 271 2024-07-23 15:16 win22test/win22test.mf
|
|
-rw-r--r-- markd/staff 623 2024-07-23 15:16 win22test/._win22test-1.vmdk
|
|
-rw-r--r-- markd/staff 8348649984 2024-07-23 15:16 win22test/win22test-1.vmdk
|
|
-rw-r--r-- markd/staff 624 2024-07-23 15:00 win22test/._win22test-2.nvram
|
|
-rw-r--r-- markd/staff 270840 2024-07-23 15:00 win22test/win22test-2.nvram
|
|
-rw-r--r-- markd/staff 620 2024-07-23 15:00 win22test/._win22test.ovf
|
|
-rw-r--r-- markd/staff 12052 2024-07-23 15:00 win22test/win22test.ovf
|
|
|
|
(cherry picked from commit 3d26e48af39b26f3c8a368ce320555b995bdf20b)
|
|
---
|
|
input/OVA.ml | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
diff --git a/input/OVA.ml b/input/OVA.ml
|
|
index 8d4606ef..1db337a7 100644
|
|
--- a/input/OVA.ml
|
|
+++ b/input/OVA.ml
|
|
@@ -253,8 +253,13 @@ and find_files dir ext =
|
|
| [] -> []
|
|
| dir :: rest ->
|
|
let files = Array.to_list (Sys.readdir dir) in
|
|
+ (* Ignore dot-underscore-files, added when using 'tar' on some Macs. *)
|
|
+ let files =
|
|
+ List.filter (fun x -> not (String.is_prefix x "._")) files in
|
|
+ (* Prefix with the directory to form a path. *)
|
|
let files = List.map (Filename.concat dir) files in
|
|
let dirs, files = List.partition Sys.is_directory files in
|
|
+ (* Only files with the given extension. *)
|
|
let files =
|
|
List.filter (fun x -> Filename.check_suffix x ext) files in
|
|
files @ loop (rest @ dirs)
|