Large file support on 32-bit systems

Uri Simchoni urisimchoni at gmail.com
Thu Jul 2 14:01:20 CEST 2015


Hi,

I detected the following large-file support bug in lib/util/util.c:
- I have a 32-bit system
- The configuration process added _FILE_OFFSET_BITS=64 into config.h
(that is, it detected that the system does not support large files
without adding something, and found the correct thing to add - so far
so good).
- However, in lib/util/util.c, <talloc.h> is included before
"replace.h", and this causes off_t to be 32 bits (because what matters
is whether _FILE_OFFSET_BITS set to 64 on the FIRST time glibc's
features.h is included)
- This causes  fcntl_lock() to fail on 32-bit x86 (i686), and all the
daemons fail to run because they fail to generate a lock file.

A workaround is to add _FILE_OFFSET_BITS=64 to the external CPPFLAGS,
but if this is the recommended method, then configure should simply
fail if it cannot get large files, and not add stuff to config.h.

Another possible fix is to switch the order of talloc.h and replace.h
- this is fragile and there may be other places that need fixing.
Still this may be the right fix because if we cannot trust config.h
then who knows what else we get wrong. In that case the question is
how to detect files in which config.h is not first.

A third option is to have waf add _FILE_OFFSET_BITS=64 to the CPPFLAGS
and not to config.h - don't know how to pull that off but I can try.

Any comments on best way to fix this would be appreciated.

Thanks,
Uri


More information about the samba-technical mailing list