Bug 8090 - full_fname out of memory error on missing file SunOS 5.8
full_fname out of memory error on missing file SunOS 5.8
Product: rsync
Classification: Unclassified
Component: core
Sparc Solaris
: P5 minor
: ---
Assigned To: Wayne Davison
Rsync QA Contact
Depends on:
  Show dependency treegraph
Reported: 2011-04-15 20:10 UTC by Jason Martin (mail address dead)
Modified: 2013-02-18 13:30 UTC (History)
0 users

See Also:

truss output of problem. (15.46 KB, text/plain)
2011-04-15 20:11 UTC, Jason Martin (mail address dead)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Martin (mail address dead) 2011-04-15 20:10:37 UTC
When attempting to copy a non-existent file to another file on Solaris 5.8, a out-of-memory error is shown rather than a file-not-found error. 

I've attached 'truss' output showing the sequence.

$ uname -a
SunOS xxx 5.8 Generic_117350-45 sun4u sparc SUNW,Sun-Fire-V440
$ cd /tmp
$ rsync missingfile /tmp
ERROR: out of memory in full_fname [sender]
rsync error: error allocating core memory buffers (code 22) at util.c(117) [sender=3.0.7]

The relevant portion of the truss output:
29718:	lstat64("missingfile", 0xFFBEE3E8)		Err#2 ENOENT
29718:	write(2, 0xFFBEBDD0, 43)			= 43

The problem does not manifest on Solaris 10.
Comment 1 Jason Martin (mail address dead) 2011-04-15 20:11:15 UTC
Created attachment 6409 [details]
truss output of problem.
Comment 2 Wayne Davison 2011-05-30 17:29:11 UTC
full_fname() is calling asprintf().  Perhaps that is not supported on Solaris 5.8?  You could try using the version supplied by lib/snprintf.c (e.g. manipulating the defines in config.h, and perhaps some function-name trickery).

If asprintf() isn't the issue, I'd suggest either using a debugger to look at the string pointers that will be passed to asprintf(), or outputting them via debug fprintf(stderr, "...") calls.
Comment 3 Wayne Davison 2011-10-06 15:54:21 UTC
The asprintf() call in question is only 1 of 2 in all of rsync that tests the success of the function via "<= 0" rather than "< 0".  Perhaps just removing the '=' in those calls would fix the issue?  Is asprintf() working OK if it returns 0?
Comment 4 Wayne Davison 2011-11-23 21:15:15 UTC
I'll assume that this is fixed unless I hear otherwise.