diff -uNr fakeroot-1.13.1.orig/Makefile.in fakeroot-1.13.1/Makefile.in
--- fakeroot-1.13.1.orig/Makefile.in	2009-10-06 03:12:58.000000000 -0700
+++ fakeroot-1.13.1/Makefile.in	2009-10-06 08:03:20.000000000 -0700
@@ -85,7 +85,7 @@
 libcommunicate_la_LIBADD =
 am_libcommunicate_la_OBJECTS = communicate.lo
 libcommunicate_la_OBJECTS = $(am_libcommunicate_la_OBJECTS)
-am_libfakeroot_la_OBJECTS = libfakeroot.lo
+am_libfakeroot_la_OBJECTS = libfakeroot.lo libfakeroot2.lo
 libfakeroot_la_OBJECTS = $(am_libfakeroot_la_OBJECTS)
 libfakeroot_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -293,7 +293,7 @@
 noinst_LTLIBRARIES = libcommunicate.la
 libcommunicate_la_SOURCES = communicate.c
 lib_LTLIBRARIES = libfakeroot.la
-libfakeroot_la_SOURCES = libfakeroot.c statconv/glibc/linux/alpha/stats.h wrapdef.h  wrapstruct.h communicate.h
+libfakeroot_la_SOURCES = libfakeroot.c libfakeroot2.c statconv/glibc/linux/alpha/stats.h wrapdef.h  wrapstruct.h communicate.h
 libfakeroot_la_LDFLAGS = -release 0
 libfakeroot_la_DEPENDENCIES = wrapdef.h wrapstruct.h libcommunicate.la $(LTLIBOBJS)
 libfakeroot_la_LIBADD = libcommunicate.la $(LTLIBOBJS)
@@ -958,7 +958,7 @@
 wrapped.h wrapdef.h wrapstruct.h wraptmpf.h:wrapawk wrapfunc.inp
 	awk -f $(srcdir)/wrapawk < $(srcdir)/wrapfunc.inp
 
-libfakeroot.lo:libfakeroot.c wrapdef.h wrapstruct.h wraptmpf.h
+libfakeroot.lo:libfakeroot.c libfakeroot2.c wrapdef.h wrapstruct.h wraptmpf.h
 
 fakerootconfig.h: ./config.status
 	CONFIG_FILES= CONFIG_HEADERS= /bin/sh ./config.status
diff -uNr fakeroot-1.13.1.orig/communicate.h fakeroot-1.13.1/communicate.h
--- fakeroot-1.13.1.orig/communicate.h	2009-10-06 03:12:57.000000000 -0700
+++ fakeroot-1.13.1/communicate.h	2009-10-06 08:03:20.000000000 -0700
@@ -35,7 +35,7 @@
 #endif
 
 /* Then decide whether we do or do not use the stat64 support */
-#if (defined(sun) && !defined(__SunOS_5_5_1) && !defined(_LP64)) || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
+#if defined __APPLE__ || (defined(sun) && !defined(__SunOS_5_5_1) && !defined(_LP64)) || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
 # define STAT64_SUPPORT
 #else
 # warning Not using stat64 support
diff -uNr fakeroot-1.13.1.orig/libfakeroot.c fakeroot-1.13.1/libfakeroot.c
--- fakeroot-1.13.1.orig/libfakeroot.c	2009-10-06 03:12:58.000000000 -0700
+++ fakeroot-1.13.1/libfakeroot.c	2009-10-06 08:03:20.000000000 -0700
@@ -516,6 +516,7 @@
 
   int r;
 
+  fprintf(stderr, "lstat file_name %s\n", file_name);
   r=NEXT_LSTAT(ver, file_name, statbuf);
   if(r)
     return -1;
@@ -533,6 +534,7 @@
 		       struct stat *st){
   int r;
 
+  fprintf(stderr, "stat file_name %s\n", file_name);
   r=NEXT_STAT(ver, file_name, st);
   if(r)
     return -1;
@@ -552,6 +554,7 @@
 
   int r;
 
+  fprintf(stderr, "fstat fd %d\n", fd);
   r=NEXT_FSTAT(ver, fd, st);
   if(r)
     return -1;
@@ -593,6 +596,7 @@
 
   int r;
 
+  fprintf(stderr, "lstat64 file_name %s\n", file_name);
   r=NEXT_LSTAT64(ver, file_name, st);
 
   if(r)
@@ -612,6 +616,7 @@
 			   struct stat64 *st){
   int r;
 
+  fprintf(stderr, "stat64 file_name %s\n", file_name);
   r=NEXT_STAT64(ver,file_name,st);
   if(r)
     return -1;
@@ -629,6 +634,7 @@
 			     struct stat64 *st){
   int r;
 
+  fprintf(stderr, "fstat64 fd %d\n", fd);
   r=NEXT_FSTAT64(ver, fd, st);
   if(r)
     return -1;
@@ -697,6 +703,7 @@
   int r=0;
 
 
+  fprintf(stderr, "chown path %s owner %d group %d\n", path, owner, group);
 #ifdef LCHOWN_SUPPORT
   /*chown(sym-link) works on the target of the symlink if lchown is
     present and enabled.*/
@@ -1030,6 +1037,7 @@
      to communicate with faked we need a struct stat, so we now
      do a stat of the new directory (just for the inode/dev) */
 
+  fprintf(stderr, "mkdir path %s\n", path);
   r=next_mkdir(path, mode|0700); 
   /* mode|0700: see comment in the chown() function above */
   if(r)
@@ -1494,9 +1502,10 @@
 FTSENT *fts_read(FTS *ftsp) {
   FTSENT *r;
 
+  fprintf(stderr, "fts_read\n");
   r=next_fts_read(ftsp);
   if(r && r->fts_statp) {  /* Should we bother checking fts_info here? */
-# ifdef STAT64_SUPPORT
+# if defined STAT64_SUPPORT && !defined __APPLE__
 #  ifndef STUPID_ALPHA_HACK
     send_get_stat64(r->fts_statp);
 #  else
@@ -1513,4 +1522,31 @@
 
   return r;
 }
+
+FTSENT *fts_children(FTS *ftsp, int options) {
+  FTSENT *first;
+  FTSENT *r;
+
+  fprintf(stderr, "fts_children\n");
+  first=next_fts_children(ftsp, options);
+  for(r = first; r; r = r->fts_link) {
+    if(r->fts_statp) {  /* Should we bother checking fts_info here? */
+# if defined STAT64_SUPPORT && !defined __APPLE__
+#  ifndef STUPID_ALPHA_HACK
+      send_get_stat64(r->fts_statp);
+#  else
+      send_get_stat64(r->fts_statp, _STAT_VER);
+#  endif
+# else
+#  ifndef STUPID_ALPHA_HACK
+      send_get_stat(r->fts_statp);
+#  else
+      send_get_stat(r->fts_statp, _STAT_VER);
+#  endif
+# endif
+    }
+  }
+
+  return first;
+}
 #endif /* HAVE_FTS_READ */
diff -uNr fakeroot-1.13.1.orig/libfakeroot2.c fakeroot-1.13.1/libfakeroot2.c
--- fakeroot-1.13.1.orig/libfakeroot2.c	1969-12-31 16:00:00.000000000 -0800
+++ fakeroot-1.13.1/libfakeroot2.c	2009-10-06 08:03:37.000000000 -0700
@@ -0,0 +1,162 @@
+/*
+  Copyright: GPL. 
+  Author: joost witteveen  (joostje@debian.org)
+*/
+/* #define _POSIX_C_SOURCE 199309L whatever that may mean...*/ 
+/* #define _BSD_SOURCE             I use strdup, S_IFDIR, etc */ 
+
+/* Roderich Schupp writes (bug #79100):
+   /usr/include/dlfcn.h from libc6 2.2-5 defines RTLD_NEXT only
+   when compiled with _GNU_SOURCE defined. Hence libfakeroot.c doesn't pick
+   it
+   up and does a dlopen("/lib/libc.so.6",...) in get_libc().
+   This works most of the time, but explodes if you have an arch-optimized
+   libc installed: the program now has two versions of libc.so
+   (/lib/libc.so.6 and, say, /lib/i586/libc.so.6) mapped. Again for
+   some programs you might get away with this, but running bash under
+   fakeroot
+   always bombs. Simple fix:
+*/
+#define _GNU_SOURCE 
+
+#define FAKEROOT_LIBFAKEROOT
+
+/*
+ * This file is for symbols which have the "$INODE64" version, i.e. which use
+ * a 64-bit ino_t.
+ */
+#define _DARWIN_USE_64_BIT_INODE
+
+#include "config.h"
+#include "communicate.h"
+
+#ifdef STAT64_SUPPORT 
+#define INT_STRUCT_STAT struct stat64
+#define INT_NEXT_STAT(a,b,c) NEXT_STAT64(a,b,c)
+#define INT_NEXT_LSTAT(a,b,c) NEXT_LSTAT64(a,b,c)
+#define INT_NEXT_FSTAT(a,b,c) NEXT_FSTAT64(a,b,c)
+#ifndef STUPID_ALPHA_HACK
+#define INT_SEND_STAT(a,b) send_stat64(a,b)
+#else
+#define INT_SEND_STAT(a,b,c) send_stat64(a,b,c)
+#endif
+#else
+#define INT_STRUCT_STAT struct stat
+#define INT_NEXT_STAT(a,b,c) NEXT_STAT(a,b,c)
+#define INT_NEXT_LSTAT(a,b,c) NEXT_LSTAT(a,b,c)
+#define INT_NEXT_FSTAT(a,b,c) NEXT_FSTAT(a,b,c)
+#ifndef STUPID_ALPHA_HACK
+#define INT_SEND_STAT(a,b) send_stat(a,b)
+#else
+#define INT_SEND_STAT(a,b,c) send_stat(a,b,c)
+#endif
+#endif
+
+#include <stdlib.h>
+#include <sys/ipc.h>
+#include <sys/msg.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <dlfcn.h>
+#include <unistd.h> 
+#include <dirent.h>
+#include <errno.h>
+#include <sys/types.h>
+#ifdef HAVE_SYS_ACL_H
+#include <sys/acl.h>
+#endif /* HAVE_SYS_ACL_H */
+#if HAVE_FTS_H
+#include <fts.h>
+#endif /* HAVE_FTS_H */
+
+#if !HAVE_DECL_SETENV
+extern int setenv (const char *name, const char *value, int replace);
+#endif
+#if !HAVE_DECL_UNSETENV
+extern int unsetenv (const char *name);
+#endif
+
+
+/* 
+   Where are those shared libraries? 
+   If I knew of a configure/libtool way to find that out, I'd use it. Or
+   any other way other than the method I'm using below. Does anybody know
+   how I can get that location? (BTW, symply linking a programme, and running
+   `ldd' on it isn't the option, as Digital Unix doesn't have ldd)
+*/
+
+
+/* 
+   Note that LIBCPATH isn't actually used on Linux or Solaris, as RTLD_NEXT
+   is defined and we use that to get the `next_*' functions
+
+   Linux:
+*/
+
+/* OSF1 :*/
+/*#define LIBCPATH "/usr/shlib/libc.so"*/
+
+#undef __xstat
+#undef __fxstat
+#undef __lxstat
+#undef __xstat64
+#undef __fxstat64
+#undef __lxstat64
+#undef _FILE_OFFSET_BITS
+
+#include "wrapped.h"
+
+#ifdef HAVE_FTS_READ
+FTSENT *fts_read(FTS *ftsp) {
+  FTSENT *r;
+
+  fprintf(stderr, "fts_read$INODE64\n");
+  r=next_fts_read$INODE64(ftsp);
+  if(r && r->fts_statp) {  /* Should we bother checking fts_info here? */
+# if defined STAT64_SUPPORT && !defined __APPLE__
+#  ifndef STUPID_ALPHA_HACK
+    send_get_stat64(r->fts_statp);
+#  else
+    send_get_stat64(r->fts_statp, _STAT_VER);
+#  endif
+# else
+#  ifndef STUPID_ALPHA_HACK
+    send_get_stat(r->fts_statp);
+#  else
+    send_get_stat(r->fts_statp, _STAT_VER);
+#  endif
+# endif
+  }
+
+  return r;
+}
+
+FTSENT *fts_children(FTS *ftsp, int options) {
+  FTSENT *first;
+  FTSENT *r;
+
+  fprintf(stderr, "fts_children$INODE64\n");
+  first=next_fts_children$INODE64(ftsp, options);
+  for(r = first; r; r = r->fts_link) {
+    if(r->fts_statp) {  /* Should we bother checking fts_info here? */
+# if defined STAT64_SUPPORT && !defined __APPLE__
+#  ifndef STUPID_ALPHA_HACK
+      send_get_stat64(r->fts_statp);
+#  else
+      send_get_stat64(r->fts_statp, _STAT_VER);
+#  endif
+# else
+#  ifndef STUPID_ALPHA_HACK
+      send_get_stat(r->fts_statp);
+#  else
+      send_get_stat(r->fts_statp, _STAT_VER);
+#  endif
+# endif
+    }
+  }
+
+  return first;
+}
+#endif /* HAVE_FTS_READ */
diff -uNr fakeroot-1.13.1.orig/wrapfunc.inp fakeroot-1.13.1/wrapfunc.inp
--- fakeroot-1.13.1.orig/wrapfunc.inp	2009-10-06 03:12:58.000000000 -0700
+++ fakeroot-1.13.1/wrapfunc.inp	2009-10-06 08:03:20.000000000 -0700
@@ -130,4 +130,7 @@
 
 #ifdef HAVE_FTS_READ
 fts_read;FTSENT *;(FTS *ftsp);(ftsp)
+fts_read$INODE64;FTSENT *;(FTS *ftsp);(ftsp)
+fts_children;FTSENT *;(FTS *ftsp, int options);(ftsp, options)
+fts_children$INODE64;FTSENT *;(FTS *ftsp, int options);(ftsp, options)
 #endif /* HAVE_FTS_READ */
