[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#871956: lintian: false positive: binary-file-built-without-LFS-support on x32



hi Adam, all,

On Sat, 2 Sep 2017, Adam Borowski wrote:

AC_SYS_LARGEFILE on i386 (linux) for mpgrafic-0.3.15-1 apparently does *not*
always do the right thing:

You call it but don't actually use what it returns:

mpicc -DHAVE_CONFIG_H -I.  -I..  -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2
   -fdebug-prefix-map=/<<PKGBUILDDIR>>=.  -fstack-protector-strong -Wformat
   -Werror=format-security -c -o parallel_io.o parallel_io.c

#define _XOPEN_SOURCE 500
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include <string.h>

You don't include "config.h" anywhere.

You're right - thanks for spotting that :).

Nope, you use pwrite() not pwrite64() -- on i386 you need the latter to get
LFS; they're aliases only on amd64, x32 and so on.

OK, so config.h + p(read|write)64 should hopefully solve the mpgrafic
bug. I initially tried hardwiring pwrite64 and pread64 (compiling on
amd64), but got "warning: implicit declaration of function ‘pwrite64’
[-Wimplicit-function-declaration]". My understanding is that
_FILE_OFFSET_BITS and __USE_FILE_OFFSET64 are *not* set for amd64 by
AC_SYS_LARGEFILE, and instead only set for some systems, such as i386.
The following should correctly work together with AC_SYS_LARGEFILE, it
seems to me.

Does this look OK?

#ifndef __USE_FILE_OFFSET64
  i_stat=pwrite(fd,buffer,size,offset);
#else
  i_stat=pwrite64(fd,buffer,size,offset);
#endif

#ifndef __USE_FILE_OFFSET64
  i_stat = pread(fd,buffer,size,offset);
#else
  i_stat = pread64(fd,buffer,size,offset);
#endif


But in any case, even if it had been indeed a false positive, it'd be a
different bug.

I think I should post a lintian bug for improving the info field for
the LFS unsafe detection - I spent quite a bit of time searching for how
to handle this, and having more detailed information could help other
debian contributors respond more easily to built-without-LFS-support
warnings.

Cheers
Boud

Reply to: