[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: FSFS on Mac OS X network shares

From: B. Wells <b_wells_at_appleisp.net>
Date: 2005-04-14 05:15:02 CEST

FWIW, I created a patch for apr/file_io/unix/flock.c that is specific
to Mac OS X. This causes file locking to be done with flock if the
filesystem type is "smbfs" and fcntl if otherwise.

The benefit is that Subversion will then work with "local" repositories
that are stored on an SMB mounted network share. AFP mounted shares
obviously still do not work.

I'm hoping that Apple eventually supports fcntl for all network shares
or that we get a "real" Subversion server setup at work. Until then,
this seems like a usable work-around. I tested Subversion 1.1.3 and a
patched apr-0.9.6 with no problems seen thus far.

The patch for apr/file_io/unix/flock.c follows. Enjoy :-)

Brian Wells

19c19,21
< #if APR_HAVE_FCNTL_H

---
 > #if defined(DARWIN)
 > #include <sys/file.h>
 > #include <string.h>
21,22c23,31
< #endif
< #ifdef HAVE_SYS_FILE_H
---
 > #include <sys/param.h>
 > #include <sys/mount.h>
 > #define USE_FLOCK
 > #define USE_FCNTL
 > #define USE_DARWIN
 > #elif defined(HAVE_FCNTL_H)
 > #include <fcntl.h>
 > #define USE_FCNTL
 > #elif defined(HAVE_SYS_FILE_H)
23a33,35
 > #define USE_FLOCK
 > #else
 > #error No file locking mechanism is available.
30c42,48
< #if defined(HAVE_FCNTL_H)
---
 > #if defined(USE_DARWIN)
 > 	struct statfs sfb;
 >
 > 	rc = fstatfs(thefile->filedes, &sfb);
 > 	if (rc == -1 || strncmp(sfb.f_fstypename,"smbfs",5) != 0)
 > #endif
 > #if defined(USE_FCNTL)
60c78,82
< #elif defined(HAVE_SYS_FILE_H)
---
 > #endif
 > #if defined(USE_DARWIN)
 > else
 > #endif
 > #if defined(USE_FLOCK)
78,79d99
< #else
< #error No file locking mechanism is available.
89c109,115
< #if defined(HAVE_FCNTL_H)
---
 > #if defined(USE_DARWIN)
 > 	struct statfs sfb;
 > 	
 > 	rc = fstatfs(thefile->filedes, &sfb);
 > 	if (rc != -1 && strncmp(sfb.f_fstypename,"smbfs",5) == 0)
 > #endif
 > #if defined(USE_FCNTL)
106c132,136
< #elif defined(HAVE_SYS_FILE_H)
---
 > #endif
 > #if defined(USE_DARWIN)
 > 	else
 > #endif
 > #if defined(USE_FLOCK)
115,116d144
< #else
< #error No file locking mechanism is available.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Apr 14 05:21:12 2005

This is an archived mail posted to the Subversion Users mailing list.