DO NOT REPLY [Bug 6276] crtimes.patch does not preserve creation dates on Mac x86_64 only

Steve Ortiz steve at ortizaggies.com
Wed Feb 10 20:51:03 MST 2010


Wayne,
I tried changing "unsigned long" to "uint32" as you suggested, but
that doesn't work.
The compiler adds padding to the struct to make the fields 64-bit
aligned and it has the same problem.  To convince the compiler
that the timespec really should come immediately after the length, the
struct can be packed with the pragma pack directive.  I tested the
following, and it worked.

@@ -37,10 +37,13 @@
 extern int preserve_perms;
 extern int preserve_executability;

+#pragma pack(push)
+#pragma pack(4)
 struct create_time {
-       unsigned long length;
+       uint32 length;
       struct timespec crtime;
 };
+#pragma pack(pop)

 #define RETURN_ERROR_IF(x,e) \
       do { \

> ------- Comment #7 from wayned at samba.org  2010-02-06 15:57 CST -------
> Thanks for the detailed analysis!  I'm thinking that all we need to do is to
> change "unsigned long" to "uint32" in the create_time structure.  I've checked
> in that change into the patches repo (both branches).  Would you try that and
> see if it works?
>
>  +struct create_time {
> -+      unsigned long length;
> ++      uint32 length;
>  +      struct timespec crtime;
>  +};


More information about the rsync mailing list