Skip to contentSkip to conversation

wic/filemap: handle FIGETBSZ failing

PATCH In review Ross Burton 3 participants 3 messages Jun 7, 2019 – Jun 8, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wic/filemap: handle FIGETBSZ failing

Some file systems don't support fetching the block size (notably the file system Docker uses for containers), so handle the iotctl() failing and raise the expected error.

---
 scripts/lib/wic/filemap.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/lib/wic/filemap.py +4 -1
index 244c07a71cf..a3919fbcad8 100644
@@ -32,7 +32,10 @@ def get_block_size(file_obj):
     """
     # Get the block size of the host file-system for the image file by calling
     # the FIGETBSZ ioctl (number 2).
-    binary_data = fcntl.ioctl(file_obj, 2, struct.pack('I', 0))
+    try:
+        binary_data = fcntl.ioctl(file_obj, 2, struct.pack('I', 0))
+    except OSError:
+        raise IOError("Unable to determine block size")
     bsize = struct.unpack('I', binary_data)[0]
     if not bsize:
         import os
Signature · 1 line
2.11.0
Reviewed-by
#2 lore raw
Quoted 11 lines · Tom Rini
Quoted 1 line · Ross Burton

Some file systems don't support fetching the block size (notably the

file system

Quoted 4 lines

Docker uses for containers), so handle the iotctl() failing and raise the expected error.

Thank you for finding the fix!

—Tim

Quoted 9 lines

--
Tom
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core