The Samba-Bugzilla – Attachment 18007 Details for
Bug 15427
Spotlight results return wrong date in result list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 4.17 and 4.18 cherry-picked from master
bug15427-v417,v418.patch (text/plain), 5.38 KB, created by
Ralph Böhme
on 2023-07-28 13:11:03 UTC
(
hide
)
Description:
Patch for 4.17 and 4.18 cherry-picked from master
Filename:
MIME Type:
Creator:
Ralph Böhme
Created:
2023-07-28 13:11:03 UTC
Size:
5.38 KB
patch
obsolete
>From d10051437558f581bee350620848cf98e7e3915f Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Wed, 17 May 2023 16:37:36 +0200 >Subject: [PATCH 1/3] mdssvc: prepare for returning timestamps with sub-seconds > granularity > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15427 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >(cherry picked from commit 9dc66fecf7c1743d264c5c4f8978b77bab75ed86) >--- > source3/rpc_server/mdssvc/mdssvc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/source3/rpc_server/mdssvc/mdssvc.c b/source3/rpc_server/mdssvc/mdssvc.c >index c394a180b1ac..7a8cbcf3588e 100644 >--- a/source3/rpc_server/mdssvc/mdssvc.c >+++ b/source3/rpc_server/mdssvc/mdssvc.c >@@ -189,7 +189,7 @@ static bool add_filemeta(struct mds_ctx *mds_ctx, > return false; > } > } else if (strcmp(attribute, "kMDItemFSContentChangeDate") == 0) { >- sl_time.tv_sec = sp->st_ex_mtime.tv_sec; >+ sl_time = convert_timespec_to_timeval(sp->st_ex_mtime); > result = dalloc_add_copy(meta, &sl_time, sl_time_t); > if (result != 0) { > return false; >-- >2.41.0 > > >From 442807b3fc2c801a190d50dcf0f3e90535f76b77 Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Wed, 17 May 2023 16:38:39 +0200 >Subject: [PATCH 2/3] mdssvc: fix date marshalling > >Did this ever work? Possible just copied over from Netatalk and was always >broken... The Mac client expects the timevalue as seconds relative to >2001-01-01 00:00:00 UTC, packed as IEEE float. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15427 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >(cherry picked from commit 620ca1e68d02be45a94aa41217a141d211fceb1f) >--- > source3/rpc_server/mdssvc/marshalling.c | 29 ++++++++++++++++++++----- > 1 file changed, 23 insertions(+), 6 deletions(-) > >diff --git a/source3/rpc_server/mdssvc/marshalling.c b/source3/rpc_server/mdssvc/marshalling.c >index 5f866d7fb6ea..b3e16d9c18f2 100644 >--- a/source3/rpc_server/mdssvc/marshalling.c >+++ b/source3/rpc_server/mdssvc/marshalling.c >@@ -43,8 +43,8 @@ > * RPC data marshalling and unmarshalling > ******************************************************************************/ > >-/* Spotlight epoch is UNIX epoch minus SPOTLIGHT_TIME_DELTA */ >-#define SPOTLIGHT_TIME_DELTA 280878921600ULL >+/* Spotlight epoch is 1.1.2001 00:00 UTC */ >+#define SPOTLIGHT_TIME_DELTA 978307200 /* Diff from UNIX epoch to Spotlight epoch */ > > #define SQ_TYPE_NULL 0x0000 > #define SQ_TYPE_COMPLEX 0x0200 >@@ -253,6 +253,10 @@ static ssize_t sl_pack_date(sl_time_t t, char *buf, ssize_t offset, size_t bufsi > { > uint64_t data; > uint64_t tag; >+ union { >+ double d; >+ uint64_t w; >+ } ieee_fp_union; > > tag = sl_pack_tag(SQ_TYPE_DATE, 2, 1); > offset = sl_push_uint64_val(buf, offset, bufsize, tag); >@@ -260,7 +264,10 @@ static ssize_t sl_pack_date(sl_time_t t, char *buf, ssize_t offset, size_t bufsi > return -1; > } > >- data = (t.tv_sec + SPOTLIGHT_TIME_DELTA) << 24; >+ ieee_fp_union.d = (double)(t.tv_sec - SPOTLIGHT_TIME_DELTA); >+ ieee_fp_union.d += (double)t.tv_usec / 1000000; >+ >+ data = ieee_fp_union.w; > offset = sl_push_uint64_val(buf, offset, bufsize, data); > if (offset == -1) { > return -1; >@@ -723,6 +730,11 @@ static int sl_unpack_date(DALLOC_CTX *query, > int i, result; > struct sl_tag tag; > uint64_t query_data64; >+ union { >+ double d; >+ uint64_t w; >+ } ieee_fp_union; >+ double fraction; > sl_time_t t; > > offset = sl_unpack_tag(buf, offset, bufsize, encoding, &tag); >@@ -735,9 +747,14 @@ static int sl_unpack_date(DALLOC_CTX *query, > if (offset == -1) { > return -1; > } >- query_data64 = query_data64 >> 24; >- t.tv_sec = query_data64 - SPOTLIGHT_TIME_DELTA; >- t.tv_usec = 0; >+ ieee_fp_union.w = query_data64; >+ fraction = ieee_fp_union.d - (uint64_t)ieee_fp_union.d; >+ >+ t = (sl_time_t) { >+ .tv_sec = ieee_fp_union.d + SPOTLIGHT_TIME_DELTA, >+ .tv_usec = fraction * 1000000 >+ }; >+ > result = dalloc_add_copy(query, &t, sl_time_t); > if (result != 0) { > return -1; >-- >2.41.0 > > >From 6c081e55338ad97e4e6d0868c584cb405d29ac02 Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Thu, 18 May 2023 18:12:19 +0200 >Subject: [PATCH 3/3] mdssvc: fix returning file modification date for older > Mac releases > >Mac 10.10 uses kMDItemContentModificationDate instead of >kMDItemFSContentChangeDate. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15427 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> > >Autobuild-User(master): Jeremy Allison <jra@samba.org> >Autobuild-Date(master): Wed Jul 26 23:42:44 UTC 2023 on atb-devel-224 > >(cherry picked from commit c2e83ebe726b7bc42b329198214c784936f19888) >--- > source3/rpc_server/mdssvc/mdssvc.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/source3/rpc_server/mdssvc/mdssvc.c b/source3/rpc_server/mdssvc/mdssvc.c >index 7a8cbcf3588e..a7d5d7afc029 100644 >--- a/source3/rpc_server/mdssvc/mdssvc.c >+++ b/source3/rpc_server/mdssvc/mdssvc.c >@@ -188,7 +188,9 @@ static bool add_filemeta(struct mds_ctx *mds_ctx, > if (result != 0) { > return false; > } >- } else if (strcmp(attribute, "kMDItemFSContentChangeDate") == 0) { >+ } else if (strcmp(attribute, "kMDItemFSContentChangeDate") == 0 || >+ strcmp(attribute, "kMDItemContentModificationDate") == 0) >+ { > sl_time = convert_timespec_to_timeval(sp->st_ex_mtime); > result = dalloc_add_copy(meta, &sl_time, sl_time_t); > if (result != 0) { >-- >2.41.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
jra
:
review+
Actions:
View
Attachments on
bug 15427
: 18007