RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2216492 - iso8601 evaluates date in format "YYYY-DDD/XX" as valid
Summary: iso8601 evaluates date in format "YYYY-DDD/XX" as valid
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: pacemaker
Version: 9.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Ken Gaillot
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-21 15:28 UTC by Michal Mazourek
Modified: 2023-06-27 16:51 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-06-27 16:51:35 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-160373 0 None None None 2023-06-21 15:40:52 UTC

Description Michal Mazourek 2023-06-21 15:28:48 UTC
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.

Comment 1 Reid Wahl 2023-06-21 23:54:27 UTC
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).

Comment 2 Ken Gaillot 2023-06-27 16:51:35 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.