[Box Backup-commit] COMMIT r1240 - in box/chris/merge: bin/bbackupquery lib/common

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Sat, 13 Jan 2007 01:02:57 +0000


Author: chris
Date: 2007-01-13 01:02:57 +0000 (Sat, 13 Jan 2007)
New Revision: 1240

Modified:
   box/chris/merge/bin/bbackupquery/BackupQueries.cpp
   box/chris/merge/lib/common/BoxPlatform.h
Log:
Ignore symlink permissions on Darwin, where they can't be set properly
after symlink creation (refs #3)


Modified: box/chris/merge/bin/bbackupquery/BackupQueries.cpp
===================================================================
--- box/chris/merge/bin/bbackupquery/BackupQueries.cpp	2007-01-13 01:01:27 UTC (rev 1239)
+++ box/chris/merge/bin/bbackupquery/BackupQueries.cpp	2007-01-13 01:02:57 UTC (rev 1240)
@@ -1536,7 +1536,7 @@
 	
 						// Decode it
 						std::auto_ptr<BackupStoreFile::DecodedStream> fileOnServerStream;
-						// Got additional attibutes?
+						// Got additional attributes?
 						if(i->second->HasAttributes())
 						{
 							// Use these attributes
@@ -1570,6 +1570,9 @@
 						#endif
 
 						if(!rParams.mIgnoreAttributes &&
+						#ifdef PLATFORM_DISABLE_SYMLINK_ATTRIB_COMPARE
+						   !fileOnServerStream->IsSymLink() &&
+						#endif
 						   !localAttr.Compare(fileOnServerStream->GetAttributes(),
 								ignoreAttrModTime,
 								fileOnServerStream->IsSymLink() /* ignore modification time if it's a symlink */))

Modified: box/chris/merge/lib/common/BoxPlatform.h
===================================================================
--- box/chris/merge/lib/common/BoxPlatform.h	2007-01-13 01:01:27 UTC (rev 1239)
+++ box/chris/merge/lib/common/BoxPlatform.h	2007-01-13 01:02:57 UTC (rev 1240)
@@ -57,6 +57,14 @@
 	#define PLATFORM_DISABLE_MEM_LEAK_TESTING
 #endif
 
+// Darwin also has a weird idea of permissions and dates on symlinks:
+// perms are fixed at creation time by your umask, and dates can't be
+// changed. This breaks unit tests if we try to compare these things.
+// See: http://lists.apple.com/archives/darwin-kernel/2006/Dec/msg00057.html
+#ifdef __APPLE__
+	#define PLATFORM_DISABLE_SYMLINK_ATTRIB_COMPARE
+#endif
+
 // Find out if credentials on UNIX sockets can be obtained
 #ifndef HAVE_GETPEEREID
 	#if !HAVE_DECL_SO_PEERCRED