Hi Chris,

On Thu, Jan 23, 2020 at 01:00:39PM +0100, Chris Lamb wrote:
> > Most likely, it can be fixed by adding -D_FILE_OFFSET_BITS=64 to the
> > CFLAGS.
> 
> Happy to make this change in Debian, but do you believe this is
> suitable for inclusion upstream too?

First of all, this is an unverified expectation. I don't know whether it
fixes the issue, it just is a guess for the cause.

Assuming that the guess is correct, I think upstream would want change
the behaviour of configure along the lines:

 * Compute sizeof(off_t).
 * If that happens to be >= 8, all is well.
 * Compute sizeof(off_t) again with -D_FILE_OFFSET_BITS=64 temporarily
   added to CFLAGS.
 * If it becomes larger, keep the flag, otherwise print some warning
   about not working with large images.

A difficulty arises as AC_CHECK_SIZEOF caches its result, so the second
check would likely look something like:

AC_CHECK_SIZEOF([off_t_with_file_offset_bits64],,[AC_INCLUDES_DEFAULT
#define off_t_with_file_offset_bits64 off_t
])

I also think that this problem could be tested for in an autopkgtest.
The code can be based on this.

truncate -s $((1 << 26)) image
/sbin/mkfs.vfat image
dd if=image of=image2 bs=1M seek=2048 conv=sparse
mdir -i image2@@2048M

The last command fails on armhf, but not on amd64. Do we run autopktests
on any 32bit systems?

Hope this helps.

Helmut

Reply via email to