-
Notifications
You must be signed in to change notification settings - Fork 158
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
md manage:WARNING:2021-07-01 12h58.04 utc:480: parse_iso_time_tz: Could not parse time 2019-01-18T17:29:00+00:00 #1609
Labels
bug
Something isn't working
Comments
same will also with 21.4.1/2 |
A proposed patch that allows buildi on musl-related distribution:
@Dexus do you have a chance to check if it builds on glibc distribution? .: Francesco |
This looks to work with out all the parse_iso_time messages. |
You have only one Typo: Corrected version: diff --git a/src/manage.c b/src/manage.c
index 7e39631..6edbe65 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -5788,7 +5788,11 @@ manage_scap_update_time ()
if (strptime (content, "%Y%m%d%H%M", &update_time))
{
static char time_string[100];
- strftime (time_string, 99, "%FT%T.000%z", &update_time);
+ #if !defined(__GLIBC__)
+ strftime (time_string, 99, "%Y-%m-%dT%T.000", &update_time);
+ #else
+ strftime (time_string, 99, "%FT%T.000%z", &update_time);
+ #endif
return time_string;
}
return "";
diff --git a/src/manage_sql.c b/src/manage_sql.c
index 14d9e35..768fd79 100644
--- a/src/manage_sql.c
+++ b/src/manage_sql.c
@@ -26202,7 +26202,11 @@ host_summary_append (GString *host_summary_buffer, const char *host,
struct tm start_tm;
memset (&start_tm, 0, sizeof (struct tm));
- if (strptime (start_iso, "%FT%H:%M:%S", &start_tm) == NULL)
+ #if !defined(__GLIBC__)
+ if (strptime (start_iso, "%Y-%m-%dT%H:%M:%S", &start_tm) == NULL)
+ #else
+ if (strptime (start_iso, "%FT%H:%M:%S", &start_tm) == NULL)
+ #endif
{
g_warning ("%s: Failed to parse start", __func__);
return;
@@ -26222,7 +26226,11 @@ host_summary_append (GString *host_summary_buffer, const char *host,
struct tm end_tm;
memset (&end_tm, 0, sizeof (struct tm));
- if (strptime (end_iso, "%FT%H:%M:%S", &end_tm) == NULL)
+ #if !defined(__GLIBC__)
+ if (strptime (end_iso, "%Y-%m-%dT%H:%M:%S", &end_tm) == NULL)
+ #else
+ if (strptime (end_iso, "%FT%H:%M:%S", &end_tm) == NULL)
+ #endif
{
g_warning ("%s: Failed to parse end", __func__);
return;
diff --git a/src/utils.c b/src/utils.c
index ee5073d..4161406 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -364,20 +364,31 @@ parse_iso_time_tz (const char *text_time, const char *fallback_tz)
secs_str && strcmp (secs_str, "")
? secs_str : ":00",
offset_str ? offset_str : "");
-
- if (strptime_with_reset ((char*) cleaned_text_time, "%FT%T%z", &tm))
+ #if !defined(__GLIBC__)
+ if (strptime_with_reset ((char*) cleaned_text_time, "%Y-%m-%dT%T", &tm))
+ #else
+ if (strptime_with_reset ((char*) cleaned_text_time, "%FT%T%z", &tm))
+ #endif
{
/* ISO time with numeric offset (e.g. 2020-06-01T01:02:03+04:30) */
tm.tm_sec = tm.tm_sec - tm.tm_gmtoff;
tm.tm_gmtoff = 0;
epoch_time = mktime_with_tz (&tm, "UTC");
}
- else if (strptime_with_reset ((char*) cleaned_text_time, "%FT%TZ", &tm))
+ #if !defined(__GLIBC__)
+ else if (strptime_with_reset ((char*) cleaned_text_time, "%Y-%m-%dT%T", &tm))
+ #else
+ else if (strptime_with_reset ((char*) cleaned_text_time, "%FT%TZ", &tm))
+ #endif
{
/* ISO time with "Z" for UTC timezone (e.g. 2020-06-01T01:02:03Z) */
epoch_time = mktime_with_tz (&tm, "UTC");
}
- else if (strptime_with_reset ((char*) cleaned_text_time, "%FT%T", &tm))
+ #if !defined(__GLIBC__)
+ else if (strptime_with_reset ((char*) cleaned_text_time, "%Y-%m-%dT%T", &tm))
+ #else
+ else if (strptime_with_reset ((char*) cleaned_text_time, "%FT%T", &tm))
+ #endif
{
/* ISO time without timezone suffix (e.g. 2020-06-01T01:02:03) */
epoch_time = mktime_with_tz (&tm, fallback_tz ? fallback_tz : "UTC");
@@ -427,7 +438,11 @@ iso_time_internal (time_t *epoch_time, const char **abbrev)
if (timezone == 0)
#endif
{
- if (strftime (time_string, 98, "%FT%TZ", &tm) == 0)
+ #if !defined(__GLIBC__)
+ if (strftime (time_string, 98, "%Y-%m-%dT%T", &tm) == 0)
+ #else
+ if (strftime (time_string, 98, "%FT%TZ", &tm) == 0)
+ #endif
return NULL;
if (abbrev)
@@ -437,7 +452,11 @@ iso_time_internal (time_t *epoch_time, const char **abbrev)
{
int len;
- if (strftime (time_string, 98, "%FT%T%z", &tm) == 0)
+ #if !defined(__GLIBC__)
+ if (strftime (time_string, 98, "%Y-%m-%dT%T", &tm) == 0)
+ #else
+ if (strftime (time_string, 98, "%FT%T%z", &tm) == 0)
+ #endif
return NULL;
/* Insert the ISO 8601 colon by hand. */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After a fresh install of gvmd 21.4.0 i allways get erros like
md manage:WARNING:2021-07-01 12h58.04 utc:480: parse_iso_time_tz: Could not parse time 2019-01-18T17:29:00+00:00
Expected behavior
parse the date as expected
Actual behavior
It looks like the error makes no problems, but it filled up the logs with to much crap.
Steps to reproduce
GVM versions
gsa: (gsad --version) 21.4.0
gvm: (gvmd --version) 21.4.0
openvas-scanner: (openvas --version) 21.4.0
gvm-libs: 21.4.0
Environment
Operating system: Alpine Linux / Ubuntu 20.10
Installation method / source: (packages, source installation) source installation
Logfiles
The text was updated successfully, but these errors were encountered: