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

Bug#590513: apt-get fails on i386 with 20tb filesystem (statvfs (75: Value too large for defined data type))



On Thu, 2010-08-26 at 08:40:35 +0200, Julian Andres Klode wrote:
> On Do, 2010-08-26 at 03:59 +0200, Guillem Jover wrote:
> > There's few problems with this patch. By defining _LARGEFILE_SOURCE,
> > the source is already requesting to the system to internally remap
> > statfs and statvfs to statfs64 and statvfs64. And in addition
> > _LARGEFILE64_SOURCE just makes the explicit 64 bit versions visible,
> > at which point the system was alredy transparently supporting large
> > files.

> No, defining _FILE_OFFSET_BITS to 64 makes stat* become stat*64. The
> _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE defines are needed for getting
> the explicit interfaces, they do not activate the implicit ones.

Bah, yeah sorry, meant that one.

> > It unconditionally remaps itself the symbols to their 64 bit versions,
> > but they might not be available on the system, the correct way to check
> > for this is by using AC_SYS_LARGEFILE in configure.in.

> Maybe in theory; in practice, it works perfectly for all our supported
> architectures.

Well, apt is not only being used on Debian systems, and doing the right
thing here (portability-wise) does not require much effort anyway. As
said, if using AC_SYS_LARGEFILE is deemed too dangerious at this point
in time then defining _FILE_OFFSET_BITS=64 and fixing the casts is the
only thing needed to make the code always DTRT, even if the system
does not have LFS.

> > It also does not fix the casted comparisons for some of the statfs and
> > statvfs members which will be now 64 bit wide on 32 bit systems.

> I did not find such problems when looking at it.

,--- cmdline/apt-get.cc:InstallPackages()
[...]
    } else if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize)
    }
      [...]
      return _error->Error(_("You don't have enough free space in %s."),
                      OutputDir.c_str());
    }
[...]
`---

The unsigned() cast will truncate the 64 bit value, which will make
the program fail whenever the lower bits are < than the needed size.

regards,
guillem



Reply to: