Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POSIX does not request "date" command to support "-R" option. #7874

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

mpsuzuki
Copy link
Contributor

Currently configure script sets WOLFSSL_BUILD_DATE by "date -R", like:

WOLFSSL_BUILD_DATE=$(date -R)

According to POSIX specification IEEE Std 1003.1-2024, "date" command can lack the "-R" option. In fact, online manuals for preinstalled "date" commands in some proprietary systems does not mention the "-R":

Setting locale to C (to prevent localized weekday name like "月" for Monday) and spelling-out the format can make "configure" more portable.

diff --git a/configure.ac b/configure.ac
index 3f5f44a3c..ef18a574c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,7 +69,7 @@ AS_IF([ test -n "$CFLAG_VISIBILITY" ], [
        AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY"
        ])

-WOLFSSL_BUILD_DATE=$(date -R)
+WOLFSSL_BUILD_DATE=$(env LC_TIME=C date +"%a, %d %b %Y %T %z")
 AC_SUBST([WOLFSSL_BUILD_DATE])

@wolfSSL-Bot
Copy link

Can one of the admins verify this patch?

@dgarske
Copy link
Contributor

dgarske commented Aug 15, 2024

Okay to test. Approved contributor agreement is on file.

configure.ac Outdated Show resolved Hide resolved
@douzzer douzzer assigned mpsuzuki and unassigned wolfSSL-Bot Aug 17, 2024
mpsuzuki added a commit to mpsuzuki/wolfssl-patch-dev that referenced this pull request Aug 18, 2024
…"date" with no extension.

Following to the advice by Daniel Pouzzner (see the discussion in the issue wolfSSL#7874),
no need to invoke "env" command to set LC_TIME.

* IEEE Std 1003.1-2024 does not request the "-R" option:
	https://pubs.opengroup.org/onlinepubs/9799919799/

* Default "date" in Solaris 11.4 does not support "-R":
	https://docs.oracle.com/cd/E88353_01/html/E37839/date-1.html
* Default "date" in HP-UX 11.22 does not support "-R":
	https://man.freebsd.org/cgi/man.cgi?query=date&apropos=0&sektion=0&manpath=HP-UX+11.22&arch=default&format=html
* Default "date" in AIX 7 does not support "-R":
	https://www.ibm.com/docs/en/aix/7.3?topic=d-date-command
@mpsuzuki mpsuzuki requested a review from douzzer August 18, 2024 06:47
…"date" with no extension.

Following to the advice by Daniel Pouzzner (see the discussion in the issue wolfSSL#7874),
no need to invoke "env" command to set LC_TIME.

* IEEE Std 1003.1-2024 does not request the "-R" option:
	https://pubs.opengroup.org/onlinepubs/9799919799/

* Default "date" in Solaris 11.4 does not support "-R":
	https://docs.oracle.com/cd/E88353_01/html/E37839/date-1.html
* Default "date" in HP-UX 11.22 does not support "-R":
	https://man.freebsd.org/cgi/man.cgi?query=date&apropos=0&sektion=0&manpath=HP-UX+11.22&arch=default&format=html
* Default "date" in AIX 7 does not support "-R":
	https://www.ibm.com/docs/en/aix/7.3?topic=d-date-command
@douzzer douzzer merged commit c4f978f into wolfSSL:master Aug 20, 2024
123 of 125 checks passed
@mpsuzuki
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants