Description of problem: Invalid date format YYYY-DDD/XX (as for example 2023-06/23) is allowed by 'iso8601' tool, which evaluates it as 2023-01-06 00:00:00Z and ignores everything after slash. Version-Release number of selected component (if applicable): pacemaker-2.1.6-2.el9.x86_64 How reproducible: always Steps to Reproduce: [root@virt-540 ~]# iso8601 --date="2023-06/23" Date: 2023-01-06 00:00:00Z [root@virt-540 ~]# echo $? 0 ## or [root@virt-540 ~]# iso8601 --date="2023-06/invalid" Date: 2023-01-06 00:00:00Z [root@virt-540 ~]# echo $? 0 ## constraints in pcs using this tool to validate dates [root@virt-540 ~]# pcs constraint location d1 rule date lt 2023-08/24 [root@virt-540 ~]# echo $? 0 Actual results: Invalid format "YYYY-DDD/XX" is allowed by iso8601 tool Expected results: This invalid format should not be allowed Additional info: Found while testing fix for new pcs bz2178714, which started using 'iso8601' for validating correct iso8601 format in new constraints.
Thanks for reporting this. This isn't terribly surprising. There are a number of known issues with Pacemaker's date/time parsing. See also: - Use a consistent API for time values (https://projects.clusterlabs.org/T432) - Parse ISO8601 time zone offsets correctly (https://projects.clusterlabs.org/T188) We can probably fix this particular issue without too much trouble. However, QE will likely find other edge cases until we either switch to a third-party date/time library (like GDateTime) or spend far too much time making our own iso8601 library robust (not worth it).
Pacemaker's time parser is extremely lenient, probably too much so. ISO 8601 uses a slash in period (interval) specifications, which Pacemaker also parses, for example: # iso8601 --period "2023-06-01/2023-06-15" Period: 2023-06-01 00:00:00Z to 2023-06-15 00:00:00Z # iso8601 --period "2023-06-20/XXX" iso8601: Invalid interval specified: 2023-06-20/XXX What is basically happening is that `iso8601 --date` accepts period-format specifications, in which case it only looks at the start of the period, so it doesn't care that the end of the period is invalid. Since Pacemaker itself will do the same thing (where a date is needed), it's not really a bug -- iso8601 is validating what Pacemaker would accept. It's definitely a reasonable feature request to be more strict about what Pacemaker accepts. I lean to doing that at RHEL 10 though, to avoid breaking backward compatibility within the RHEL 8 or 9 series. Once RHEL 10 issue reporting is settled, I'll open an issue for that.