https://bugzilla.redhat.com/show_bug.cgi?id=2459200
Bug ID: 2459200
Summary: YAML::Syck produces corrupted YAML since 1.38
Product: Fedora
Version: 43
Hardware: All
URL: https://github.com/cpan-authors/YAML-Syck/issues/193
OS: Linux
Status: NEW
Component: perl-YAML-Syck
Severity: medium
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]
CC: [email protected], [email protected],
[email protected]
Target Milestone: ---
Classification: Fedora
When producing a dump of a Perl hashref containing blessed references, in
particular ones produced by the JSON family of modules, the YAML output is
broken.
Actual output:
Source: {"a": true, "b": true, "c": 12143}
Decoded JSON: $VAR1 = {
'b' => bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' ),
'a' => $VAR1->{'b'},
'c' => 12143
};
Dumped as YAML:
---
a: &1 !!perl/scalar:JSON::PP::Boolean 1
b: *1
!!perl/scalar:JSON::PP::Boolean c: 12143
Loaded from this YAML: $VAR1 = {
'a' => \'1',
'b' => $VAR1->{'a'},
'SCALAR(0xaaaac865b678)' => '12143'
};
I would expect YAML to look like:
---
a: &1 !!perl/scalar:JSON::PP::Boolean 1
b: *1
c: 12143
As you can see, these versions of YAML::Syck fail at round-trip consistency.
Reproducible: Always
Steps to Reproduce:
Install perl, perl-YAML-Syck, perl-Data-Dumper, perl-JSON-XS.
Run this and observe:
perl -MJSON::XS -MYAML::Syck -MData::Dumper -E 'my $s = '"'"'{"a": true, "b":
true, "c": 12143}'"'"'; say "Source: $s"; my $x = decode_json($s); say
"\nDecoded JSON: ", Dumper($x); my $y = Dump($x); say "Dumped as YAML:\n$y"; my
$z = Load($y); say "Loaded from this YAML: ", Dumper($z);'
Actual Results:
---
a: &1 !!perl/scalar:JSON::PP::Boolean 1
b: *1
!!perl/scalar:JSON::PP::Boolean c: 12143
Loaded from this YAML: $VAR1 = {
'a' => \'1',
'b' => $VAR1->{'a'},
'SCALAR(0xaaaac865b678)' => '12143'
};
Expected Results:
---
a: &1 !!perl/scalar:JSON::PP::Boolean 1
b: *1
c: 12143
Additional Information:
The reason for this bug is merging of this pull request:
https://github.com/cpan-authors/YAML-Syck/pull/131
One should note that YAML::Syck has seen lots of activity in the last months,
but practically all of that activity was LLM-generated, and that includes
tests.
This also affects EPEL 9.
--
You are receiving this mail because:
You are on the CC list for the bug.
https://bugzilla.redhat.com/show_bug.cgi?id=2459200
Report this comment as SPAM:
https://bugzilla.redhat.com/enter_bug.cgi?product=Bugzilla&format=report-spam&short_desc=Report%20of%20Bug%202459200%23c0
--
_______________________________________________
perl-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it:
https://forge.fedoraproject.org/infra/tickets/issues/new