I have done some experiments and find out that the behavior of lseek with whence set to SEEK_DATA is different from the behavior of Linux's lseek.
If the supplied offset is in the middle of a data region, it returns the start of the next data region. There may be many data regions in a big file even though it has no hole. return value of lseek with whence set to SEEK_DATA: |--(offset)--Data----|(return value)----Data----| |--(offset)--Data----|----Hole----|(return value)----Data----| ** Patch added: "macOS-lseek.patch" https://bugs.launchpad.net/qemu/+bug/1776920/+attachment/5186138/+files/macOS-lseek.patch -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1776920 Title: qemu-img convert on Mac OSX creates corrupt images Status in QEMU: New Bug description: An image created by qemu-img create, then modified by another program is converted to bad/corrupt image when using convert sub command on Mac OSX. The same convert works on Linux. The version of qemu-img is 2.12. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1776920/+subscriptions