rsync: pack_smb_acl: sys_acl_init(): Cannot allocate memory

Mike Bombich mike at bombich.com
Fri Aug 20 12:28:15 MDT 2010


Before I call this a bug, I figured I'd ask -- what's the "+ 3" for in calc_sacl_entries?  

static int calc_sacl_entries(const rsync_acl *racl)
{
	/* A System ACL always gets user/group/other permission entries. */
	return racl->names.count
#ifdef ACLS_NEED_MASK
	     + 4;
#else
	     + (racl->mask_obj != NO_ENTRY) + 3;  <---- What's this for?
#endif
}


On Mac OS X, a file with the system limit of 128 ACEs will consistently run into the error noted in the subject.  calc_sacl_entries is returning 131 for such a file, and acl_init() returns ENOMEM as a result.  If I remove the "+ 3", everything is peachy -- all the ACEs are copied and I don't see any harm.  Is there an unforeseen consequence to removing the +3?

This script reliably reproduces the error:

##########
#!/bin/sh

rsync="/usr/local/bin/rsync"

src=`mktemp -d /tmp/src.XXXXXX`
tgt=`mktemp -d /tmp/tgt.XXXXXX`
echo "$tgt/test"
file=$src/test
touch $file

x=0
limit=128
while [ $x -lt $limit ] ; do
	 chmod +a# $x "$USER allow write,writeattr,writeextattr" $file
	 x=$(($x + 1))
done

"$rsync" -vaAX $src/ $tgt/

rm -rf $src $tgt
##########


Thanks,
Mike


More information about the rsync mailing list