tools: fix date parsing in patchwork polling
Commit Message
Though it is not fully understood why (maybe some system upgrade..?),
parsing date is now failing on some long running Debian system.
Specify date format earlier in the command line.
Fixes: baaec1836189 ("tools: filter new patchwork IDs by date")
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
tools/poll-pw | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Monday, March 31, 2025 2:19 PM
> To: ci@dpdk.org
> Cc: NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>;
> aconole@redhat.com; Ali Alnubani <alialnu@nvidia.com>
> Subject: [PATCH] tools: fix date parsing in patchwork polling
>
> Though it is not fully understood why (maybe some system upgrade..?),
> parsing date is now failing on some long running Debian system.
It's because the last date and time that were written to the file coincide with the Daylight-Saving Time transition.
That timestamp was invalid in the server's timezone.
>
> Specify date format earlier in the command line.
I think what fixed it was adding the --utc arg.
>
> Fixes: baaec1836189 ("tools: filter new patchwork IDs by date")
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> tools/poll-pw | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/poll-pw b/tools/poll-pw
> index c1df012..4c7fafd 100755
> --- a/tools/poll-pw
> +++ b/tools/poll-pw
> @@ -47,7 +47,7 @@ if [ ! -f "$since_file" ] ; then
> exit 1
> fi
>
> -if ! date -d "$(cat $since_file | tr '\n' ' ')" >/dev/null 2>&1 ; then
> +if ! date --utc '+%FT%T' -d $(cat $since_file | tr '\n' ' ') >/dev/null 2>&1 ; then
> printf "The file '$since_file' doesn't contain a valid date format.\n\n" >&2
> exit 1
> fi
> @@ -77,7 +77,7 @@ callcmd () # <patchwork id>
>
> while true ; do
> date_now=$(date --utc '+%FT%T')
> - since=$(date -d $(cat $since_file | tr '\n' ' ') '+%FT%T')
> + since=$(date --utc '+%FT%T' -d $(cat $since_file | tr '\n' ' '))
> page=1
> while true ; do
> ids=$(curl -s "${URL}&page=${page}&since=${since}" |
> --
> 2.48.1
Thanks for addressing this, David.
Acked-by: Ali Alnubani <alialnu@nvidia.com>
- Ali
David Marchand <david.marchand@redhat.com> writes:
> Though it is not fully understood why (maybe some system upgrade..?),
> parsing date is now failing on some long running Debian system.
>
> Specify date format earlier in the command line.
>
> Fixes: baaec1836189 ("tools: filter new patchwork IDs by date")
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Applied, thanks Ali and David.
@@ -47,7 +47,7 @@ if [ ! -f "$since_file" ] ; then
exit 1
fi
-if ! date -d "$(cat $since_file | tr '\n' ' ')" >/dev/null 2>&1 ; then
+if ! date --utc '+%FT%T' -d $(cat $since_file | tr '\n' ' ') >/dev/null 2>&1 ; then
printf "The file '$since_file' doesn't contain a valid date format.\n\n" >&2
exit 1
fi
@@ -77,7 +77,7 @@ callcmd () # <patchwork id>
while true ; do
date_now=$(date --utc '+%FT%T')
- since=$(date -d $(cat $since_file | tr '\n' ' ') '+%FT%T')
+ since=$(date --utc '+%FT%T' -d $(cat $since_file | tr '\n' ' '))
page=1
while true ; do
ids=$(curl -s "${URL}&page=${page}&since=${since}" |