diff options
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | lib/time.sh | 2 | ||||
-rwxr-xr-x | tests/lib/ob_iso8601_gmtime.sh | 5 |
3 files changed, 11 insertions, 2 deletions
@@ -15,6 +15,12 @@ Utilities: contain dependency restrictions or newline characters that are passed through to the binary package's control file. +libopkbuild: + + * ob_iso8601_gmtime() and ob_touch_t_gmtime() no longer trigger an + infinite loop when passed times on January 1. This time bomb broke + ob-buildopk one day every year. + opkbuild version 4.2.1 ---------------------- diff --git a/lib/time.sh b/lib/time.sh index 5100b04..910d825 100644 --- a/lib/time.sh +++ b/lib/time.sh @@ -158,7 +158,7 @@ _ob_gmtime() while :; do _ob_is_leap_year ${year} && days_in_year=366 || days_in_year=365 - [ ${timep} -le ${days_in_year} ] && break + [ ${timep} -lt ${days_in_year} ] && break : $((timep -= ${days_in_year})) : $((year += 1)) done diff --git a/tests/lib/ob_iso8601_gmtime.sh b/tests/lib/ob_iso8601_gmtime.sh index 840b378..d318961 100755 --- a/tests/lib/ob_iso8601_gmtime.sh +++ b/tests/lib/ob_iso8601_gmtime.sh @@ -23,7 +23,7 @@ set -eu . "${TOP_SRCDIR}/tests/aux/common.sh" . "${TOP_BUILDDIR}/lib/libopkbuild.${SHSOEXT}.${LIBOPKBUILD_SHSOVERSION}" -plan_ 7 +plan_ 10 tst() { @@ -40,4 +40,7 @@ tst 108123 '1970-01-02T06:02:03Z' tst 41877296 '1971-04-30T16:34:56Z' tst 762480000 '1994-03-01T00:00:00Z' tst 962443230 '2000-07-01T09:20:30Z' +tst 1607419408 '2020-12-08T09:23:28Z' +tst 1609459199 '2020-12-31T23:59:59Z' +tst 1609510819 '2021-01-01T14:20:19Z' tst 2147483648 '2038-01-19T03:14:08Z' |