From 972515ad84424611df1de21f2dc912f5246311af Mon Sep 17 00:00:00 2001 From: Tomas Hozza Date: Mon, 2 Aug 2021 16:32:01 +0200 Subject: [PATCH] image-info: ignore lines with only whitespace characters in fstab image-info could produce a weird fstab error with an empty list as a member, when analysing images not built using osbuild. Ensure that any lines in fstab with only whitespace characters are skipped during image analysis. Signed-off-by: Tomas Hozza --- tools/image-info | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/image-info b/tools/image-info index 225d80270..01033e8de 100755 --- a/tools/image-info +++ b/tools/image-info @@ -555,7 +555,6 @@ def read_fstab(tree): An example return value: [ - [], [ "UUID=6d066eb4-e4c1-4472-91f9-d167097f48d1", "/", @@ -569,7 +568,7 @@ def read_fstab(tree): result = [] with contextlib.suppress(FileNotFoundError): with open(f"{tree}/etc/fstab") as f: - result = sorted([line.split() for line in f if line and not line.startswith("#")]) + result = sorted([line.split() for line in f if line.strip() and not line.startswith("#")]) return result