Skip to content
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

Allow colons in plain scalars inside flow collections #104

Closed
wants to merge 1 commit into from

Conversation

perlpunk
Copy link
Member

@perlpunk perlpunk commented Feb 2, 2018

This is a followup to #28

See http://yaml.org/spec/1.1/#nb-plain-char(c) and the following
productions.

This commit will allow

[http://example]

but still fail for the following:

[:foo]

This will be a bit more complicated to allow.

It also still fails for this:

[foo:]

This shouldn't be allowed. After discussing with @flyx my understanding is
that the spec has a mistake here:

[153] nb-plain-char(c) ::= c = flow-out ⇒ nb-plain-char-out
                           c = flow-in  ⇒ nb-plain-char-in
                           c = flow-key ⇒ nb-plain-char-in
[154] nb-plain-char-out ::=   ( nb-char - “:” - “#” - #x9 /*TAB*/ )
                            | ( ns-plain-char(flow-out) “#” )
                            | ( “:” ns-plain-char(flow-out) )
[155] nb-plain-char-in ::= nb-plain-char-out - “,” - “[” - “]” - “{” - “}”
[156] ns-plain-char(c) ::= nb-plain-char(c) - #x20 /*SP*/

Because nb-plain-char-out points to ns-plain-char(flow-out), so
theoretically this would be allowed:

{key:}}
# equal to
{"key:}": }

I think allowing colons in the middle of a flow style scalar is a good thing,
while leaving the other cases alone for now, because they are rare and you
can then always use quotes.

Edit:
With this patch the following will be allowed, too:

{foo::: bar}

While this is valid for 1.2, I'm not sure about 1.1. (Edit: I think it's valid in 1.1 too.)

Copy link

@flyx flyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no reason to refuse [:foo]. It is valid YAML 1.1 meaning [ ":foo" ]. My proposed change would make it to be successfully parsed. It would also cause [foo:] to be parsed as [ "foo:]" (because that's what the spec defines). It could be valid if another ] follows.

|| CHECK_AT(parser->buffer, '{', 1)
|| CHECK_AT(parser->buffer, '}', 1)
)
) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is undesirable. Regardless of how strange it is, [foo:]] is valid YAML 1.1 meaning [ "foo:]" ]. Moreover, ? certainly is not a flow indicator, so I am unsure how it found its way in here.

I think the correct fix would be to remove this if statement altogether (frankly, I have no idea why it is there in the first place; x:x is completely valid in a plain scalar inside flow content). : with succeeding space is handled later on. Note the comment about example 8.13 in the spec. That example is wrong! It shows this YAML:

{
  ? foo :°,
  ?° : bar,
}

° meaning empty scalar. This is not valid according to the productions, because there must be space after the : before the ,.

However, if I understand the rest of the code correctly, removing the if statement would cause [foo:] be parsed as [ "foo:" ] because the code is not designed to eat the character after the : as it should according to the spec. My proposed solution would be having a local ate_colon and then instead of the if:

ate_colon = CHECK(parser->buffer, ':');

and then at the end of the loop:

/* Copy the character. */

if (!READ(parser, string)) goto error;
if (ate_colon) if (!READ(parser, string)) goto error; /* <<< add this line */

end_mark = parser->mark;

if (!CACHE(parser, 2)) goto error;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moreover, ? certainly is not a flow indicator, so I am unsure how it found its way in here.

I added this for consistency, because it's also in the next if-statement. Maybe I should take it out in both statements. Then [foo:?bar] would be allowed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is undesirable. Regardless of how strange it is, [foo:]] is valid YAML 1.1

The point is that this currently is not allowed in libyaml, and I just keep it like that with this change. The only thing which changes is to allow [foo:bar].
ns-plain-char - ,[]{} characters after the colon. So I don't know why this change would be undesirable.

Could you clarify what you mean?

The goal of this PR is to accept things that make sense and are valid, but leaving the other cases alone for now, as I wrote above.

@perlpunk
Copy link
Member Author

perlpunk commented Feb 3, 2018

I see no reason to refuse [:foo]

The problem is, if I allow that, then other cases break.
Currently libyaml accepts { "foo":bar }, although this is only valid in YAML 1.2

If I change the code to allow [:foo], { "foo":bar } breaks. This would be acceptable since it's not valid YAML 1.1, however, forbidding something that has been accepted might not be desirable.

The code can probably be fixed allowing [:foo] while still accepting { "foo":bar }, but that's a more complicated change, I think. You would have to find out if the previous scalar token was a quoted one.

@perlpunk
Copy link
Member Author

perlpunk commented Feb 3, 2018

Regardless of how strange it is, [foo:]] is valid YAML 1.1 meaning [ "foo:]" ].

I agree that the 1.1 spec production says that, but the sentence before production 154 says something different. http://yaml.org/spec/1.1/#id907281
I think it was a mistake and doesn't make sense. In such cases it is ok IMHO to not allow such cases and let them be invalid.

@perlpunk
Copy link
Member Author

perlpunk commented Feb 3, 2018

@flyx I removed the ? in both if statements.

However, this is a change on its own, allowing [foo?bar] and even [foo ? bar]. It's valid according to the spec as far as I can see, but PyYAML and SnakeYAML don't accept it. Maybe it should be an extra PR.

Edit: I reverted this change

@perlpunk
Copy link
Member Author

perlpunk commented Feb 3, 2018

I created PR #105 to allow question marks.
I'm not sure if this change is as important as adding the colon, though.
Together with #104 this would allow things like [http://example/query?a=b]

@asomov
Copy link

asomov commented Feb 6, 2018

@perlpunk : what is https://github.com/yaml/yaml-test-suite ?
How can I run it with SnakeYAML ? How do I know which tests work and which do not ?
The documentation did not help. I could not even find the test cases in the project....

@perlpunk
Copy link
Member Author

perlpunk commented Feb 6, 2018

@asomov It's a collection of test cases for YAML 1.2.
The test cases are written in TestML format, each test has one .tml file (they are in the test directory).
For convenience, there is a data branch, which contains the data for each test in seperate files, generated from the TestML. I agree the documentation is pretty sparse so far.
Also have a look at the wiki, there's a documentation for the test.event file, but not complete yet: https://github.com/yaml/yaml-test-suite/wiki/test-event

You take the in.yaml, parse it with your parser and compare the events you get with the test.event file.

Edit: Actually, you should get the data from the releases: https://github.com/yaml/yaml-test-suite/releases
As the data branch is for development, and not all commits will be kept. This is a recent change and not yet in the README.

@asomov
Copy link

asomov commented Feb 6, 2018

@perlpunk cool ! But I do not understand how you run the test suite against SnakeYAML.

@perlpunk
Copy link
Member Author

perlpunk commented Feb 6, 2018

@asomov for generating http://matrix.yaml.io/ we are using the programs in https://github.com/yaml/yaml-editor.
Scripts that don't need to be compiled are in https://github.com/yaml/yaml-editor/tree/master/sbin

Here are the ones for SnakeYAML: https://github.com/yaml/yaml-editor/tree/master/docker/src/java/src/main/java/org/yaml/editor
Feel free to use this for integrating it into SnakeYAML.

(Getting a bit off topic here, for specific questions maybe create an issue or join #yaml on freenode)

@perlpunk
Copy link
Member Author

I compared several cases with various parsers and libyaml master and this PR applied:
https://gist.github.com/perlpunk/de2c631a7b0e9002de351a680eadb573

This is a followup to yaml#28

See http://yaml.org/spec/1.1/#nb-plain-char(c) and the following
productions.

This commit will allow `[http://example]`, but still fail for:
- `[:foo]`
- `[foo:]`
@perlpunk
Copy link
Member Author

Rebased to current master and squashed the two commits

@ingydotnet
Copy link
Member

Applied. Pushed. Thanks!

@ingydotnet ingydotnet closed this Jun 30, 2018
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Apr 1, 2019
Changes
=======

* yaml/libyaml#95 -- build: do not install config.h
* yaml/libyaml#97 -- appveyor.yml: fix Release build
* yaml/libyaml#103 -- Remove unused code in yaml_document_delete
* yaml/libyaml#104 -- Allow colons in plain scalars inside flow collections
* yaml/libyaml#109 -- Fix comparison in tests/run-emitter.c
* yaml/libyaml#117 -- Fix typo error
* yaml/libyaml#119 -- The closing single quote needs to be indented...
* yaml/libyaml#121 -- fix token name typos in comments
* yaml/libyaml#122 -- Revert removing of open_ended after top level plain scalar
* yaml/libyaml#125 -- Cherry-picks from PR 27
* yaml/libyaml#135 -- Windows/C89 compatibility
* yaml/libyaml#136 -- allow override of Windows static lib name
Jehops pushed a commit to Jehops/freebsd-ports-legacy that referenced this pull request Apr 11, 2019
Fix portlint errors in Makefile

Changes in 0.2.2:
* yaml/libyaml#95 -- build: do not install config.h
* yaml/libyaml#97 -- appveyor.yml: fix Release build
* yaml/libyaml#103 -- Remove unused code in yaml_document_delete
* yaml/libyaml#104 -- Allow colons in plain scalars inside flow collections
* yaml/libyaml#109 -- Fix comparison in tests/run-emitter.c
* yaml/libyaml#117 -- Fix typo error
* yaml/libyaml#119 -- The closing single quote needs to be indented...
* yaml/libyaml#121 -- fix token name typos in comments
* yaml/libyaml#122 -- Revert removing of open_ended after top level plain scalar
* yaml/libyaml#125 -- Cherry-picks from PR 27
* yaml/libyaml#135 -- Windows/C89 compatibility
* yaml/libyaml#136 -- allow override of Windows static lib name


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@498674 35697150-7ecd-e111-bb59-0022644237b5
uqs pushed a commit to freebsd/freebsd-ports that referenced this pull request Apr 11, 2019
Fix portlint errors in Makefile

Changes in 0.2.2:
* yaml/libyaml#95 -- build: do not install config.h
* yaml/libyaml#97 -- appveyor.yml: fix Release build
* yaml/libyaml#103 -- Remove unused code in yaml_document_delete
* yaml/libyaml#104 -- Allow colons in plain scalars inside flow collections
* yaml/libyaml#109 -- Fix comparison in tests/run-emitter.c
* yaml/libyaml#117 -- Fix typo error
* yaml/libyaml#119 -- The closing single quote needs to be indented...
* yaml/libyaml#121 -- fix token name typos in comments
* yaml/libyaml#122 -- Revert removing of open_ended after top level plain scalar
* yaml/libyaml#125 -- Cherry-picks from PR 27
* yaml/libyaml#135 -- Windows/C89 compatibility
* yaml/libyaml#136 -- allow override of Windows static lib name


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@498674 35697150-7ecd-e111-bb59-0022644237b5
uqs pushed a commit to freebsd/freebsd-ports that referenced this pull request Apr 11, 2019
Fix portlint errors in Makefile

Changes in 0.2.2:
* yaml/libyaml#95 -- build: do not install config.h
* yaml/libyaml#97 -- appveyor.yml: fix Release build
* yaml/libyaml#103 -- Remove unused code in yaml_document_delete
* yaml/libyaml#104 -- Allow colons in plain scalars inside flow collections
* yaml/libyaml#109 -- Fix comparison in tests/run-emitter.c
* yaml/libyaml#117 -- Fix typo error
* yaml/libyaml#119 -- The closing single quote needs to be indented...
* yaml/libyaml#121 -- fix token name typos in comments
* yaml/libyaml#122 -- Revert removing of open_ended after top level plain scalar
* yaml/libyaml#125 -- Cherry-picks from PR 27
* yaml/libyaml#135 -- Windows/C89 compatibility
* yaml/libyaml#136 -- allow override of Windows static lib name
kwm81 pushed a commit to freebsd/freebsd-ports-gnome that referenced this pull request Apr 13, 2019
Fix portlint errors in Makefile

Changes in 0.2.2:
* yaml/libyaml#95 -- build: do not install config.h
* yaml/libyaml#97 -- appveyor.yml: fix Release build
* yaml/libyaml#103 -- Remove unused code in yaml_document_delete
* yaml/libyaml#104 -- Allow colons in plain scalars inside flow collections
* yaml/libyaml#109 -- Fix comparison in tests/run-emitter.c
* yaml/libyaml#117 -- Fix typo error
* yaml/libyaml#119 -- The closing single quote needs to be indented...
* yaml/libyaml#121 -- fix token name typos in comments
* yaml/libyaml#122 -- Revert removing of open_ended after top level plain scalar
* yaml/libyaml#125 -- Cherry-picks from PR 27
* yaml/libyaml#135 -- Windows/C89 compatibility
* yaml/libyaml#136 -- allow override of Windows static lib name
swills pushed a commit to swills/freebsd-ports that referenced this pull request Apr 14, 2019
Fix portlint errors in Makefile

Changes in 0.2.2:
* yaml/libyaml#95 -- build: do not install config.h
* yaml/libyaml#97 -- appveyor.yml: fix Release build
* yaml/libyaml#103 -- Remove unused code in yaml_document_delete
* yaml/libyaml#104 -- Allow colons in plain scalars inside flow collections
* yaml/libyaml#109 -- Fix comparison in tests/run-emitter.c
* yaml/libyaml#117 -- Fix typo error
* yaml/libyaml#119 -- The closing single quote needs to be indented...
* yaml/libyaml#121 -- fix token name typos in comments
* yaml/libyaml#122 -- Revert removing of open_ended after top level plain scalar
* yaml/libyaml#125 -- Cherry-picks from PR 27
* yaml/libyaml#135 -- Windows/C89 compatibility
* yaml/libyaml#136 -- allow override of Windows static lib name


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@498674 35697150-7ecd-e111-bb59-0022644237b5
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request May 19, 2019
Changes
=======

* yaml/libyaml#95 -- build: do not install config.h
* yaml/libyaml#97 -- appveyor.yml: fix Release build
* yaml/libyaml#103 -- Remove unused code in yaml_document_delete
* yaml/libyaml#104 -- Allow colons in plain scalars inside flow collections
* yaml/libyaml#109 -- Fix comparison in tests/run-emitter.c
* yaml/libyaml#117 -- Fix typo error
* yaml/libyaml#119 -- The closing single quote needs to be indented...
* yaml/libyaml#121 -- fix token name typos in comments
* yaml/libyaml#122 -- Revert removing of open_ended after top level plain scalar
* yaml/libyaml#125 -- Cherry-picks from PR 27
* yaml/libyaml#135 -- Windows/C89 compatibility
* yaml/libyaml#136 -- allow override of Windows static lib name
@perlpunk perlpunk deleted the colon-in-plain branch May 25, 2020 10:32
mstemm added a commit to falcosecurity/falco that referenced this pull request Sep 10, 2020
It turns out if you read this rules file with falco versions 0.24.0 and
earlier, it can't parse the bare string containing colons:

(Ignore the misleading error context, that's a different problem):

```
Thu Sep 10 10:31:23 2020: Falco initialized with configuration file
/etc/falco/falco.yaml
Thu Sep 10 10:31:23 2020: Loading rules from file
/tmp/k8s_audit_rules.yaml:
Thu Sep 10 10:31:23 2020: Runtime error: found unexpected ':'
---
  source: k8s_audit
    tags: [k8s]
    # In a local/user rules file, you could override this macro to
```

I think the change in 0.25.0 to use a bundled libyaml fixed the problem,
as it also upgraded libyaml to a version that fixed
yaml/libyaml#104.

Work around the problem with earlier falco releases by quoting the colon.
mstemm added a commit to falcosecurity/falco that referenced this pull request Sep 10, 2020
It turns out if you read this rules file with falco versions 0.24.0 and
earlier, it can't parse the bare string containing colons:

(Ignore the misleading error context, that's a different problem):

```
Thu Sep 10 10:31:23 2020: Falco initialized with configuration file
/etc/falco/falco.yaml
Thu Sep 10 10:31:23 2020: Loading rules from file
/tmp/k8s_audit_rules.yaml:
Thu Sep 10 10:31:23 2020: Runtime error: found unexpected ':'
---
  source: k8s_audit
    tags: [k8s]
    # In a local/user rules file, you could override this macro to
```

I think the change in 0.25.0 to use a bundled libyaml fixed the problem,
as it also upgraded libyaml to a version that fixed
yaml/libyaml#104.

Work around the problem with earlier falco releases by quoting the colon.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
poiana pushed a commit to falcosecurity/falco that referenced this pull request Sep 23, 2020
It turns out if you read this rules file with falco versions 0.24.0 and
earlier, it can't parse the bare string containing colons:

(Ignore the misleading error context, that's a different problem):

```
Thu Sep 10 10:31:23 2020: Falco initialized with configuration file
/etc/falco/falco.yaml
Thu Sep 10 10:31:23 2020: Loading rules from file
/tmp/k8s_audit_rules.yaml:
Thu Sep 10 10:31:23 2020: Runtime error: found unexpected ':'
---
  source: k8s_audit
    tags: [k8s]
    # In a local/user rules file, you could override this macro to
```

I think the change in 0.25.0 to use a bundled libyaml fixed the problem,
as it also upgraded libyaml to a version that fixed
yaml/libyaml#104.

Work around the problem with earlier falco releases by quoting the colon.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
leogr pushed a commit to leogr/falco that referenced this pull request May 9, 2022
It turns out if you read this rules file with falco versions 0.24.0 and
earlier, it can't parse the bare string containing colons:

(Ignore the misleading error context, that's a different problem):

```
Thu Sep 10 10:31:23 2020: Falco initialized with configuration file
/etc/falco/falco.yaml
Thu Sep 10 10:31:23 2020: Loading rules from file
/tmp/k8s_audit_rules.yaml:
Thu Sep 10 10:31:23 2020: Runtime error: found unexpected ':'
---
  source: k8s_audit
    tags: [k8s]
    # In a local/user rules file, you could override this macro to
```

I think the change in 0.25.0 to use a bundled libyaml fixed the problem,
as it also upgraded libyaml to a version that fixed
yaml/libyaml#104.

Work around the problem with earlier falco releases by quoting the colon.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
leogr pushed a commit to falcosecurity/plugins that referenced this pull request May 9, 2022
It turns out if you read this rules file with falco versions 0.24.0 and
earlier, it can't parse the bare string containing colons:

(Ignore the misleading error context, that's a different problem):

```
Thu Sep 10 10:31:23 2020: Falco initialized with configuration file
/etc/falco/falco.yaml
Thu Sep 10 10:31:23 2020: Loading rules from file
/tmp/k8s_audit_rules.yaml:
Thu Sep 10 10:31:23 2020: Runtime error: found unexpected ':'
---
  source: k8s_audit
    tags: [k8s]
    # In a local/user rules file, you could override this macro to
```

I think the change in 0.25.0 to use a bundled libyaml fixed the problem,
as it also upgraded libyaml to a version that fixed
yaml/libyaml#104.

Work around the problem with earlier falco releases by quoting the colon.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
leogr pushed a commit to falcosecurity/plugins that referenced this pull request May 9, 2022
It turns out if you read this rules file with falco versions 0.24.0 and
earlier, it can't parse the bare string containing colons:

(Ignore the misleading error context, that's a different problem):

```
Thu Sep 10 10:31:23 2020: Falco initialized with configuration file
/etc/falco/falco.yaml
Thu Sep 10 10:31:23 2020: Loading rules from file
/tmp/k8s_audit_rules.yaml:
Thu Sep 10 10:31:23 2020: Runtime error: found unexpected ':'
---
  source: k8s_audit
    tags: [k8s]
    # In a local/user rules file, you could override this macro to
```

I think the change in 0.25.0 to use a bundled libyaml fixed the problem,
as it also upgraded libyaml to a version that fixed
yaml/libyaml#104.

Work around the problem with earlier falco releases by quoting the colon.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
poiana pushed a commit to falcosecurity/plugins that referenced this pull request May 9, 2022
It turns out if you read this rules file with falco versions 0.24.0 and
earlier, it can't parse the bare string containing colons:

(Ignore the misleading error context, that's a different problem):

```
Thu Sep 10 10:31:23 2020: Falco initialized with configuration file
/etc/falco/falco.yaml
Thu Sep 10 10:31:23 2020: Loading rules from file
/tmp/k8s_audit_rules.yaml:
Thu Sep 10 10:31:23 2020: Runtime error: found unexpected ':'
---
  source: k8s_audit
    tags: [k8s]
    # In a local/user rules file, you could override this macro to
```

I think the change in 0.25.0 to use a bundled libyaml fixed the problem,
as it also upgraded libyaml to a version that fixed
yaml/libyaml#104.

Work around the problem with earlier falco releases by quoting the colon.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
leogr pushed a commit to falcosecurity/rules that referenced this pull request Dec 21, 2022
It turns out if you read this rules file with falco versions 0.24.0 and
earlier, it can't parse the bare string containing colons:

(Ignore the misleading error context, that's a different problem):

```
Thu Sep 10 10:31:23 2020: Falco initialized with configuration file
/etc/falco/falco.yaml
Thu Sep 10 10:31:23 2020: Loading rules from file
/tmp/k8s_audit_rules.yaml:
Thu Sep 10 10:31:23 2020: Runtime error: found unexpected ':'
---
  source: k8s_audit
    tags: [k8s]
    # In a local/user rules file, you could override this macro to
```

I think the change in 0.25.0 to use a bundled libyaml fixed the problem,
as it also upgraded libyaml to a version that fixed
yaml/libyaml#104.

Work around the problem with earlier falco releases by quoting the colon.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
leogr pushed a commit to falcosecurity/rules that referenced this pull request Dec 21, 2022
It turns out if you read this rules file with falco versions 0.24.0 and
earlier, it can't parse the bare string containing colons:

(Ignore the misleading error context, that's a different problem):

```
Thu Sep 10 10:31:23 2020: Falco initialized with configuration file
/etc/falco/falco.yaml
Thu Sep 10 10:31:23 2020: Loading rules from file
/tmp/k8s_audit_rules.yaml:
Thu Sep 10 10:31:23 2020: Runtime error: found unexpected ':'
---
  source: k8s_audit
    tags: [k8s]
    # In a local/user rules file, you could override this macro to
```

I think the change in 0.25.0 to use a bundled libyaml fixed the problem,
as it also upgraded libyaml to a version that fixed
yaml/libyaml#104.

Work around the problem with earlier falco releases by quoting the colon.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
softwarefactory-project-zuul bot pushed a commit to ansible-collections/amazon.aws that referenced this pull request Mar 13, 2024
Quote scalars with colons in flow style collection

SUMMARY

Older versions of libyaml and pyyaml don't support colons in scalars that appear in flow style collections. This adds quotes to the handful of cases where they are used in the integration tests.
This was uncovered by downstream testing. I am only able to reproduce the problem on the supported ee-minimal-rhel8 image. I believe this is because even though pyyaml should be recent enough, it has likely been compiled against an older version of libyaml that does not have the fix.
See:
yaml/libyaml#104
yaml/pyyaml#45
It's worth noting that running ansible-lint --fix will undo these changes, which is how I think they were made in the first place.

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Bikouo Aubin
Reviewed-by: GomathiselviS
patchback bot pushed a commit to ansible-collections/amazon.aws that referenced this pull request Mar 13, 2024
Quote scalars with colons in flow style collection

SUMMARY

Older versions of libyaml and pyyaml don't support colons in scalars that appear in flow style collections. This adds quotes to the handful of cases where they are used in the integration tests.
This was uncovered by downstream testing. I am only able to reproduce the problem on the supported ee-minimal-rhel8 image. I believe this is because even though pyyaml should be recent enough, it has likely been compiled against an older version of libyaml that does not have the fix.
See:
yaml/libyaml#104
yaml/pyyaml#45
It's worth noting that running ansible-lint --fix will undo these changes, which is how I think they were made in the first place.

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Bikouo Aubin
Reviewed-by: GomathiselviS
(cherry picked from commit 68fb0a3)
softwarefactory-project-zuul bot pushed a commit to ansible-collections/amazon.aws that referenced this pull request Mar 13, 2024
[PR #2014/68fb0a31 backport][stable-7] Quote scalars with colons in flow style collection

This is a backport of PR #2014 as merged into main (68fb0a3).
SUMMARY

Older versions of libyaml and pyyaml don't support colons in scalars that appear in flow style collections. This adds quotes to the handful of cases where they are used in the integration tests.
This was uncovered by downstream testing. I am only able to reproduce the problem on the supported ee-minimal-rhel8 image. I believe this is because even though pyyaml should be recent enough, it has likely been compiled against an older version of libyaml that does not have the fix.
See:
yaml/libyaml#104
yaml/pyyaml#45
It's worth noting that running ansible-lint --fix will undo these changes, which is how I think they were made in the first place.

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Mark Chappell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants