Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
The real error come from this regex:
^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?(?:0|[1-9][0-9_]*)|[-+]?0x[0-9a-fA-F_]+|[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)$
Who recognize 52:54:00:58:15:35 like an integer...
When we try this regex on 52:54:00:86:94:61 the problem doesn't occur
The YAML specification speak about a decimal integer notation, with a leading “-” character for negative values, matching the regular expression:
0 | -? [1-9] [0-9]*
https://yaml.org/spec/1.2/spec.html#id2803828
The current regex defined by PyYAML have a problem and introduce this bug
The right regex is => ^(?:[-+]?0b[0-1_]+|[-+]?0o?[0-7_]+|[-+]?[0-9_]+|[-+]?0x[0-9a-fA-F_]+)$
I will to fix that on PyYAML and try to backport fix downstream after that
With the following regex we can capture the following elements who correspond to the YAML standard definition 1.1 and 1.2
^(?:[-+]?0b[0-1_]+|[-+]?0o?[0-7_]+|[-+]?0?(?:0|[1-9][0-9_]*)|[-+]?0x[0-9a-fA-F_]+)$
Consider the following sample tests :
52:54:00:86:94:61
52:54:00:58:15:35
52:54:00:72:b7:e5
52:54:00:59:16:35
54
0b564
0x64
123456789
0123456789
0b0
0xb
0o13
0xB
This regex catch the following result set:
54
0x64
123456789
0123456789
0b0
0xb
0o13
0xB
We are compatible with the following YAML specifications for the octal and hexadecimal representations:
1.1 => https://yaml.org/spec/current.html#id2507367
1.2 => http://yaml.org/spec/1.2/spec.html#id2764652
Currently PyYAML doesn't deal with retro compatibility and also doesn't catch the octal and hexa representation.
concerning the sexagesimal the representation come from https://yaml.org/type/int.html the support was dropped[1] since the version 1.1 of the yaml specifications.
[1] https://yaml.org/spec/1.2/spec.html#id2805071
PyYAML only support YAML 1.1 (https://pyyaml.org/wiki/PyYAML) so sexagesimal can be fixed directly on.
My previous comments and especially my regex doesn't that PyYAML consider YAML standards version 1.1
So quotes are the right solution.
But the real problem is that the format of the MAC address look like a sexagesimal format without really being one.
Description of problem: When I load a yaml with a MAC address as 52:54:00:58:15:35, this is converted in 41135249735 If I change to 52:54:00:58:65:35, is not converted. Version-Release number of selected component (if applicable): libyaml-0.1.4-11.el7_0.x86_64 python-2.7.5-76.el7.x86_64 How reproducible: The YAML file --- parameter_defaults: EnableFencing: true FencingConfig: devices: - agent: fence_xvm host_mac: 52:54:00:72:b7:e5 params: multicast_address: 225.0.0.12 key_file: /etc/cluster/fence_xvm.key port: controller01 interval: 10m pcmk_host_list: ctl01 - agent: fence_xvm host_mac: 52:54:00:86:94:61 params: multicast_address: 225.0.0.13 key_file: /etc/cluster/fence_xvm.key port: controller02 interval: 10m pcmk_host_list: ctl02 - agent: fence_xvm host_mac: 52:54:00:58:15:35 params: multicast_address: 225.0.0.14 key_file: /etc/cluster/fence_xvm.key port: controller03 interval: 10m pcmk_host_list: ctl03 ... Steps to Reproduce: 1. take the file below as my.yaml 2. python -c 'import yaml, sys; print yaml.load(sys.stdin)' < my.yaml Actual results: {'parameter_defaults': {'FencingConfig': {'devices': [{'params': {'port': 'controller01', 'multicast_address': '225.0.0.12', 'interval': '10m', 'key_file': '/etc/cluster/fence_xvm.key', 'pcmk_host_list': 'ctl01'}, 'agent': 'fence_xvm', 'host_mac': '52:54:00:72:b7:e5'}, {'params': {'port': 'controller02', 'multicast_address': '225.0.0.13', 'interval': '10m', 'key_file': '/etc/cluster/fence_xvm.key', 'pcmk_host_list': 'ctl02'}, 'agent': 'fence_xvm', 'host_mac': '52:54:00:86:94:61'}, {'params': {'port': 'controller03', 'multicast_address': '225.0.0.14', 'interval': '10m', 'key_file': '/etc/cluster/fence_xvm.key', 'pcmk_host_list': 'ctl03'}, 'agent': 'fence_xvm', 'host_mac': 41135249735}]}, 'EnableFencing': True}} Expected results: {'parameter_defaults': {'FencingConfig': {'devices': [{'params': {'port': 'controller01', 'multicast_address': '225.0.0.12', 'interval': '10m', 'key_file': '/etc/cluster/fence_xvm.key', 'pcmk_host_list': 'ctl01'}, 'agent': 'fence_xvm', 'host_mac': '52:54:00:72:b7:e5'}, {'params': {'port': 'controller02', 'multicast_address': '225.0.0.13', 'interval': '10m', 'key_file': '/etc/cluster/fence_xvm.key', 'pcmk_host_list': 'ctl02'}, 'agent': 'fence_xvm', 'host_mac': '52:54:00:86:94:61'}, {'params': {'port': 'controller03', 'multicast_address': '225.0.0.14', 'interval': '10m', 'key_file': '/etc/cluster/fence_xvm.key', 'pcmk_host_list': 'ctl03'}, 'agent': 'fence_xvm', 'host_mac': '52:54:00:58:15:35'}]}, 'EnableFencing': True}} Additional info: