Skip to content

Commit afcdab9

Browse files
authored
Merge pull request #3013 from testssl/fix_3009_date-detection
Make sure date -r hits a readable dir (3.2)
2 parents 6efc4c9 + d146c56 commit afcdab9

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
@@ -471,14 +471,17 @@ HAS_FREEBSDDATE=false
471471
HAS_OPENBSDDATE=false
472472

473473
if date -d @735275209 >/dev/null 2>&1; then
474+
# FreeBSD's / MacOS' date doesn't reach this
474475
if date -r @735275209 >/dev/null 2>&1; then
475476
# Ubuntu >= 25.10
476477
HAS_GNUDATE=true
477-
elif LC_ALL=C date -r 735275209 2>&1 | grep -q "No such file"; then
478+
# need to make sure we end up in a directory with read permission (see #3009)
479+
elif (cd /; LC_ALL=C date -r 735275209 2>&1 | grep -q "No such file"); then
478480
# e.g. Debian 24.04, Debian 11-13
479481
HAS_GNUDATE=true
482+
# OpenBSD treats this as a reference (as FreeBSD would do it)
480483
elif date -r 735275209 >/dev/null 2>&1; then
481-
# It can't do any conversion from a plain date output.
484+
# OpenBSD date can't do any conversion from a plain date output
482485
HAS_OPENBSDDATE=true
483486
fi
484487
fi

0 commit comments

Comments
 (0)