On 3/13/2014 9:08 AM, Branko Čibej wrote:
I understand that; it simply means that when we install a file from
.svn/tmp into the working copy proper, we have to change that
attribute; either before or after the file is moved into place.

When this came up on ACLs, there seemed to be a lot of resistance to
changing the file after it was in place. Kind of switching the subject,
but if you're okay with changing files after they are in place, consider
also propagating the ACL at that time too. As has been pointed out,
below is not the best possible solution as the file momentarily has the
undesired (but current-behavior) ACL and so there could be a problem on
abort. But I think it is an improvement over the current behavior, and
it is simple to implement.

This seems to give the desired effect:

DWORD ret;
ACL emptyAcl;
if (!InitializeAcl(&emptyAcl, sizeof(ACL), ACL_REVISION)) {
  return 1;
}
// UNPROTECTED_SACL_SECURITY_INFORMATION ensures to enable inheritance.
// An empty DACL must be specified, not a NULL pointer.
ret = SetNamedSecurityInfo(fileName, SE_FILE_OBJECT,
  DACL_SECURITY_INFORMATION | UNPROTECTED_SACL_SECURITY_INFORMATION,
  NULL, NULL, &emptyAcl, NULL);
if  (ret != ERROR_SUCCESS) {
  return 1;
}

I think also a check that the file supports ACLs (e.g., because FAT/etc.
systems do not).

Thanks, I'll try not to harp on this subject again in the future. It's
just the fact that SVN does not do this (even as an option that can be
turned on) happens to be my #1 issue with svn.

Reply via email to