Skip to content

Commit 3f9eb84

Browse files
authored
Merge pull request #3012 from testssl/fix_3009_date-detection
Make sure date -r hits a dir readable
2 parents 802061f + ec95862 commit 3f9eb84

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

testssl.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,14 +478,17 @@ HAS_FREEBSDDATE=false
478478
HAS_OPENBSDDATE=false
479479

480480
if date -d @735275209 >/dev/null 2>&1; then
481+
# FreeBSD's / MacOS' date doesn't reach this
481482
if date -r @735275209 >/dev/null 2>&1; then
482483
# Ubuntu >= 25.10
483484
HAS_GNUDATE=true
484-
elif LC_ALL=C date -r 735275209 2>&1 | grep -q "No such file"; then
485+
# need to make sure we end up in a directory with read permission (see #3009)
486+
elif (cd /; LC_ALL=C date -r 735275209 2>&1 | grep -q "No such file"); then
485487
# e.g. Debian 24.04, Debian 11-13
486488
HAS_GNUDATE=true
489+
# OpenBSD treats this as a reference (as FreeBSD would do it)
487490
elif date -r 735275209 >/dev/null 2>&1; then
488-
# It can't do any conversion from a plain date output.
491+
# OpenBSD date can't do any conversion from a plain date output
489492
HAS_OPENBSDDATE=true
490493
fi
491494
fi

0 commit comments

Comments
 (0)