On Tue, 2008-02-12 at 15:24 +0100, Vitorio Machado wrote: > I'm trying to figure out how to modify the makefile to say to compile > sysxattrs.c with the -I /Developer/SDKs/MacOSX10.3.9.sdk/Developer/ > Headers/CFMCarbon/ > in the case of HAVE_PRE_TIGER_OSX_ATTRS is true. > Is somebody skilled on makefile to give me some help?
I did some work on top of your rsync10.3xattr_support080211 files. I added code to configure.in and Makefile.in that should get the appropriate -I option passed for lib/sysxattrs.c in the case of HAVE_PRE_TIGER_OSX_ATTRS. You can modify the option in configure.in if necessary. I put * instead of 3.9 to try to make the option work on pre-Tiger systems other than 10.3.9. I also think I figured out why the configure script was refusing to enable HAVE_PRE_TIGER_OSX_ATTRS. First, every time you change configure.in, you need to run "autoconf -o configure.sh" to update configure.sh (the underlying configure script for which ./configure is a simple wrapper). The ./configure wrapper will invoke autoconf to generate configure.sh if it doesn't exist, but once it exists, you have to regenerate it yourself as necessary. Second, the [] characters in "darwin[4-7]*" in configure.in are recognized by autoconf as quoting characters and stripped out, so configure.sh says "darwin4-7*" , which obviously won't match. I changed configure.in to say "darwin[[4-7]]*" ; autoconf strips only the outer pair to leave the desired "darwin[4-7]*" in configure.sh. I also neatened up the code in other places and finished your strncpy call. A patch with my proposed changes on top of your files is attached. Matt
diff --git a/Makefile.in b/Makefile.in index 4716aba..0145f59 100644 --- a/Makefile.in +++ b/Makefile.in @@ -61,6 +61,12 @@ CHECK_OBJS=tls.o getgroups.o getfsdev.o t_stub.o t_unsafe.o trimslash.o wildtest all: conf_stop make_stop rsync$(EXEEXT) @MAKE_MAN@ +# Separate rule to accommodate extra options for lib/sysxattrs.o on pre-Tiger OS X +lib/sysxattrs.o: lib/sysxattrs.c [EMAIL PROTECTED]@ + $(CC) -I. -I$(srcdir) @SYSXATTRS_CFLAGS@ $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@ [EMAIL PROTECTED]@ + install: all -mkdir -p ${DESTDIR}${bindir} ${INSTALLCMD} ${INSTALL_STRIP} -m 755 rsync$(EXEEXT) ${DESTDIR}${bindir} diff --git a/configure.in b/configure.in index c6bc065..f629815 100644 --- a/configure.in +++ b/configure.in @@ -932,10 +932,14 @@ else AC_DEFINE(HAVE_LINUX_XATTRS, 1, [True if you have Linux xattrs]) AC_DEFINE(SUPPORT_XATTRS, 1) ;; - darwin[4567]*) + # The square brackets in the next line are doubled in configure.in + # because autoconf strips out one pair as quoting symbols. + darwin[[4-7]].*) AC_MSG_RESULT(Using OS X PreTiger attrs) + AC_DEFINE(HAVE_OSX_XATTRS, 1, [True if you have Mac OS X xattrs]) AC_DEFINE(HAVE_PRE_TIGER_OSX_ATTRS, 1, [True if you have Mac OS X PreTiger attrs]) AC_DEFINE(SUPPORT_XATTRS, 1) + SYSXATTRS_CFLAGS="-I /Developer/SDKs/MacOSX10.*.sdk/Developer/Headers/CFMCarbon/" ;; darwin*) AC_MSG_RESULT(Using OS X xattrs) @@ -956,6 +960,7 @@ else ;; esac fi +AC_SUBST(SYSXATTRS_CFLAGS) AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig]) AC_OUTPUT diff --git a/lib/sysxattrs.c b/lib/sysxattrs.c index fae677f..bf267c7 100644 --- a/lib/sysxattrs.c +++ b/lib/sysxattrs.c @@ -54,6 +54,14 @@ ssize_t sys_llistxattr(const char *path, char *list, size_t size) #ifdef HAVE_PRE_TIGER_OSX_ATTRS +#include <sys/attr.h> +#include <unistd.h> +#include <string.h> +#include <CarbonCore/Files.h> + +#define FINDER_INFO_XATTR_NAME "com.apple.FinderInfo" +#define RESOURCE_FORK_XATTR_NAME "com.apple.ResourceFork" + ssize_t sys_lgetxattr(const char *path, const char *name, void *value, size_t size) { struct attrlist attrList; //List of attributes @@ -68,7 +76,7 @@ ssize_t sys_lgetxattr(const char *path, const char *name, void *value, size_t si attrList.forkattr=0; /* Uses getattrlist to get FinderInfo */ - if(strcmp(name, "com.apple.FinderInfo")==0) + if(strcmp(name, FINDER_INFO_XATTR_NAME)==0) { attrList.commonattr+=ATTR_CMN_FNDRINFO; if(getattrlist(path, &attrList, value, size, FSOPT_NOFOLLOW)==0) @@ -77,7 +85,7 @@ ssize_t sys_lgetxattr(const char *path, const char *name, void *value, size_t si return -1; /* Errno is setup by getattrlist */ } /* Uses carbon to get ResourceFork */ - else if(strcmp(name, "com.apple.ResourceFork")==0) + else if(strcmp(name, RESOURCE_FORK_XATTR_NAME)==0) { char path_with_name[PATH_MAX]; /* POSIX name of the file */ FSRef ref; /* A Carbon reference to the file (analogue to a POSIX Path) */ @@ -180,14 +188,14 @@ int sys_lsetxattr(const char *path, const char *name, const void *value, size_t attrList.forkattr=0; /* Uses getattrlist to get FinderInfo */ - if(strcmp(name, "com.apple.FinderInfo")==0) + if(strcmp(name, FINDER_INFO_XATTR_NAME)==0) { attrList.commonattr+=ATTR_CMN_FNDRINFO; return setattrlist(path, &attrList, value, size, FSOPT_NOFOLLOW); } /* Uses carbon to set ResourceFork */ - else if(strcmp(name, "com.apple.ResourceFork")==0) + else if(strcmp(name, RESOURCE_FORK_XATTR_NAME)==0) { char path_with_name[PATH_MAX]; /* POSIX name of the file */ FSRef ref; /* A Carbon reference to the file (analogue to a POSIX Path) */ @@ -265,13 +273,15 @@ int sys_lremovexattr(const char *path, const char *name) return 0; } +static const char *xattr_list = FINDER_INFO_XATTR_NAME "\0" RESOURCE_FORK_XATTR_NAME; + ssize_t sys_llistxattr(const char *path, char *list, size_t size) { - if(size>43) + if(size>=sizeof xattr_list) { - strncpy("com.apple.FinderInfo\0com.apple.ResourceFork"); + memcpy(dest, xattr_list, sizeof xattr_list); } - return 44; + return sizeof xattr_list; } #else diff --git a/lib/sysxattrs.h b/lib/sysxattrs.h index a9d966f..428421a 100644 --- a/lib/sysxattrs.h +++ b/lib/sysxattrs.h @@ -8,13 +8,6 @@ #include <sys/extattr.h> #endif -#if defined HAVE_PRE_TIGER_OSX_ATTRS -#include <sys/attr.h> -#include <unistd.h> -#include <string.h> -#include <CarbonCore/Files.h> -#endif - /* Linux 2.4 does not define this as a distinct errno value: */ #ifndef ENOATTR #define ENOATTR ENODATA
-- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html