AIX & Large File Support Problem (+ Solution)

Eric M. Johnston emj at postal.net
Thu Sep 5 03:28:01 EST 2002


Hi,

I just wanted to relate the solution to a problem I was having to hopefully
save someone else a day of frustration.  I'm using rsync-2.5.5 on AIX 4.3,
compiled with gcc 2.95.3.  The file I was sync'ing was very large (>2GB). 
Despite being configured with --enable-largefiles (which #defines
_LARGE_FILES properly for AIX), and despite the fact that the initial
transfer of said file worked fine, I would always get the following error
when trying to sync up the file:

  write failed on myfile.txt.3 : Error 0
  rsync error: error in file IO (code 11) at receiver.c(272)
  rsync: connection unexpectedly closed (48 bytes read so far)
  rsync error: error in rsync protocol data stream (code 12) at io.c(150)

This would always happen when rsync had transferred >2GB.  It seems that
AIX's write() doesn't like to set errno until the second time you try to
call write().  So, after adding in an additional call to write(), I saw the
following:

  write failed on myfile.txt.3 : File too large
  rsync error: error in file IO (code 11) at receiver.c(272)
  rsync: connection unexpectedly closed (48 bytes read so far)
  rsync error: error in rsync protocol data stream (code 12) at io.c(150)

After verifying ulimit wasn't the problem, adding a variety of rprintf()'s,
searching the Web in vain, writing a test program, etc., I finally figured
it out: mkstemp() on AIX 4.3 doesn't appear to support large files.  Since
the call to mkstemp() replaces a call to open(), rsync would fail when the
temporary file it creates for the transfer exceeds 2GB.

My solution to this problem was to simply #undef HAVE_SECURE_MKSTEMP in the
config.h created for AIX.  rsync is much happier with this.  It seems bad to
me that AIX's mkstemp() exhibits this behavior; perhaps someone who knows
how to report such a problem would tell IBM?

Eric



More information about the rsync mailing list