https://bugs.openldap.org/show_bug.cgi?id=10582
Issue ID: 10582 Summary: The method 'date -u -r ... %T' to print time periods when testing is incorrectly implemented Product: OpenLDAP Version: 2.6.14 Hardware: All OS: All Status: UNCONFIRMED Keywords: needs_review Severity: normal Priority: --- Component: test suite Assignee: bugs@openldap.org Reporter: Peter_Dyballa@Web.DE Target Milestone: ---
'date -u -r ... %T' works when "..." stands for a file name. Otherwise one gets:
In tests/scripts/all the decision is made which date utility has to be controlled:
# check for BSD vs GNU date date -j >/dev/null 2>&1 RC=$? if [ $RC -ne 0 ]; then DATEOPT="-d @" else DATEOPT="-r " fi
On Macs 'date -j' produces useful output (So 30 Aug 2026 18:57:39 CEST), so it's decided to use -r on Macs – which implies that the argument following this option is a file. And so date has to complain:
date: 0: No such file or directory ... date: 23: No such file or directory ...
It might work to change the time() function become for example:
timer() { if [ -n "$STARTTIME" ]; then now=`date +%s` delta=`expr $now - $STARTTIME` touch $delta date -u $DATEOPT $delta +%T fi }
For Macs it might work to patch tests/scripts/all to start with
gdate -j >/dev/null 2>&1
Then timer() would use -d @ which gdate and the macOS systems' date do understand.
https://bugs.openldap.org/show_bug.cgi?id=10582
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords|needs_review | Target Milestone|--- |2.6.15
--- Comment #1 from Quanah Gibson-Mount quanah@openldap.org --- gdate depends on homebrew. A portable solution that works regardless of BSD or GNU should be used.
https://bugs.openldap.org/show_bug.cgi?id=10582
--- Comment #2 from Peter Dyballa Peter_Dyballa@Web.DE --- (In reply to Quanah Gibson-Mount from comment #1)
gdate depends on homebrew.
Or MacPorts, as in my case.
https://bugs.openldap.org/show_bug.cgi?id=10582
--- Comment #3 from Howard Chu hyc@openldap.org --- This ticket looks invalid to me. In particular, on MacOSX the manpage states:
date [-jnRu] [-r seconds | filename] [-v [+|-]val[ymwdHMS]] ... [+output_fmt]
-r seconds Print the date and time represented by seconds, where seconds is the number of seconds since the Epoch (00:00:00 UTC, January 1, 1970; see time(3)), and can be specified in decimal, octal, or hex.
-r filename Print the date and time of the last modification of filename.
And using "-r seconds" works fine on my Mac.
https://bugs.openldap.org/show_bug.cgi?id=10582
--- Comment #4 from Peter Dyballa Peter_Dyballa@Web.DE --- (In reply to Howard Chu from comment #3)
This ticket looks invalid to me. In particular, on MacOSX the manpage states:
No. You are citing a man page from "macOS". Try /usr/bin/sw_vers. It will report something like:
ProductName: macOS ProductVersion: 14.8.9 BuildVersion: 23J631
On my ancient PowerBook it reports:
ProductName: Mac OS X ProductVersion: 10.5.8 BuildVersion: 9L31a
And the manual page has (only):
-r, --reference=FILE display the last modification time of FILE
Anyway, for "MacPorts internal use" the 'all' script can be patched that 'date -j' becomes 'gdate -j'. If the 'coreutils' are not installed and so gdate does not exist, the value of $? will be not equal to 0 and therefore DATEOPT will become "-d @", which will work on Mac OS X.
A test to "check for BSD vs GNU date" is not sufficient in the case of ancient Mac OS X, because it was going a third way…
https://bugs.openldap.org/show_bug.cgi?id=10582
--- Comment #5 from Peter Dyballa Peter_Dyballa@Web.DE --- Just checked with another Mac that has sw_vers
ProductName: Mac OS X ProductVersion: 10.13.6 BuildVersion: 17G14042
It also has:
-r seconds Print the date and time represented by seconds, where seconds is the number of seconds since the Epoch (00:00:00 UTC, January 1, 1970; see time(3)), and can be specified in decimal, octal, or hex.
-r filename Print the date and time of the last modification of filename.
https://bugs.openldap.org/show_bug.cgi?id=10582
--- Comment #6 from Howard Chu hyc@openldap.org --- Sounds like you should just update your Mac then.
Or just maintain a private patch for this, since it doesn't affect the vast majority of supported platforms.
https://bugs.openldap.org/show_bug.cgi?id=10582
Howard Chu hyc@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |TEST Status|UNCONFIRMED |RESOLVED
--- Comment #7 from Howard Chu hyc@openldap.org --- Fixed in 751b500bf96d30811ddd1ed7efc8a0c186da0fef
https://bugs.openldap.org/show_bug.cgi?id=10582
--- Comment #8 from Peter Dyballa Peter_Dyballa@Web.DE --- (In reply to Howard Chu from comment #6)
Sounds like you should just update your Mac then.
Later versions than Mac OS X 10.5.8 do not support PowerPC hardware. It will have to stay with Leopard the next 25 years…
Or just maintain a private patch for this, since it doesn't affect the vast majority of supported platforms.
Alright!