Bug#509313: portability fix (check for statfs.f_type)
Package: apt
Version: 0.7.19
Severity: wishlist
Tags: patch
Attached patch adds a configure check for statfs.f_type presence, to make
apt buildable on systems that don't have this struct member, such as
[Open]Solaris or IRIX.
It is based on m4/fts.m4 from gnulib.
-- System Information:
Debian Release: 4.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-6-amd64
Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8)
diff -x configure -ur apt-0.7.19/cmdline/apt-get.cc apt-0.7.19.new/cmdline/apt-get.cc
--- apt-0.7.19/cmdline/apt-get.cc 2008-11-24 10:32:23.000000000 +0100
+++ apt-0.7.19.new/cmdline/apt-get.cc 2008-12-21 04:56:34.000000000 +0100
@@ -866,8 +866,11 @@
if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize)
{
struct statfs Stat;
- if (statfs(OutputDir.c_str(),&Stat) != 0 ||
- unsigned(Stat.f_type) != RAMFS_MAGIC)
+ if (statfs(OutputDir.c_str(),&Stat) != 0
+#if HAVE_STRUCT_STATFS_F_TYPE
+ || unsigned(Stat.f_type) != RAMFS_MAGIC
+#endif
+ )
return _error->Error(_("You don't have enough free space in %s."),
OutputDir.c_str());
}
@@ -2170,8 +2173,11 @@
if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize)
{
struct statfs Stat;
- if (statfs(OutputDir.c_str(),&Stat) != 0 ||
- unsigned(Stat.f_type) != RAMFS_MAGIC)
+ if (statfs(OutputDir.c_str(),&Stat) != 0
+#if HAVE_STRUCT_STATFS_F_TYPE
+ || unsigned(Stat.f_type) != RAMFS_MAGIC
+#endif
+ )
return _error->Error(_("You don't have enough free space in %s"),
OutputDir.c_str());
}
diff -x configure -ur apt-0.7.19/configure.in apt-0.7.19.new/configure.in
--- apt-0.7.19/configure.in 2008-11-24 10:36:09.000000000 +0100
+++ apt-0.7.19.new/configure.in 2008-12-21 04:55:16.000000000 +0100
@@ -112,6 +112,10 @@
])
fi
+AC_CHECK_MEMBERS([struct statfs.f_type],,,
+ [$ac_includes_default
+ #include <sys/vfs.h>])
+
dnl We should use the real timegm function if we have it.
AC_CHECK_FUNC(timegm,AC_DEFINE(HAVE_TIMEGM))
AC_SUBST(HAVE_TIMEGM)
Reply to: