Bug 15947 - mdssvc doesn't support $time.iso dates before 1970
Summary: mdssvc doesn't support $time.iso dates before 1970
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jule Anger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-11-13 17:52 UTC by Ralph Böhme
Modified: 2025-11-26 13:02 UTC (History)
1 user (show)

See Also:


Attachments
Patch for 4.22 and 4.23 cherry-picked from master (3.02 KB, patch)
2025-11-21 10:45 UTC, Ralph Böhme
dbagnall: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Böhme 2025-11-13 17:52:12 UTC
When search for a number like 1328 from Finder, macOS Spotlight generates the following query:

'InRange(kMDItemContentCreationDate,$time.iso(1327-12-31T23:06:32Z),$time.iso(1328-12-31T23:06:32Z))||_kMDItemContentCreationDateYear=="1328"||InRange(kMDItemContentModificationDate,$time.iso(1327-12-31T23:06:32Z),$time.iso(1328-12-31T23:06:32Z))||_kMDItemContentModificationDateYear=="1328"||*=="1328*"cdw||kMDItemTextContent=="1328*"cdw'

This fails as $time.iso is currently (somewhat braindead) converted to a time_t with smb_strtoull() which needs to pass SMB_STR_ALLOW_NEGATIVE for processing negative numbers.
Comment 1 Samba QA Contact 2025-11-19 02:00:04 UTC
This bug was referenced in samba master:

1b2b08bb7067852ad1bf8847b266baaab06905d7
Comment 2 Ralph Böhme 2025-11-21 10:45:11 UTC
Created attachment 18782 [details]
Patch for 4.22 and 4.23 cherry-picked from master
Comment 3 Jule Anger 2025-11-26 08:45:11 UTC
Pushed to autobuild-v4-{23,22}-test.
Comment 4 Samba QA Contact 2025-11-26 11:27:12 UTC
This bug was referenced in samba v4-23-test:

441ad465dfc6b0b34b81879ec8b677101f82fdf9
Comment 5 Samba QA Contact 2025-11-26 12:52:11 UTC
This bug was referenced in samba v4-22-test:

59200ef1002893af3601bc7812d375279729b116
Comment 6 Jule Anger 2025-11-26 13:02:34 UTC
Closing out bug report.

Thanks!