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

numbers with commas in space manifests get parsed as an integer, not a string #2193

Closed
sethboyles opened this issue Apr 13, 2021 · 3 comments · Fixed by #2807 or #3486
Closed

numbers with commas in space manifests get parsed as an integer, not a string #2193

sethboyles opened this issue Apr 13, 2021 · 3 comments · Fixed by #2807 or #3486
Labels
bug upstream-bug Bugs caused by upstream dependencies

Comments

@sethboyles
Copy link
Member

sethboyles commented Apr 13, 2021

Issue

When pushing an application with the following manifest file:

applications:
- name: dora

env:
INTEGER: 1234,567,89

When they run cf env the variable INTEGER is not handled correctly and is returned as follows:

INTEGER: 123456789

The commas are removed and the field is parsed as an integer instead of a string. This is different than CF CLI v6's behavior and contrary to the YAML spec definition of an integer (and float): https://yaml.org/spec/1.2/spec.html#id2803828

Context

This is caused by an issue with Ruby's included YAML parsing library, Psych. There is an old issue from 2016 where they note it is not fixed due to backwards compatibility concerns.

Expected result

INTEGER: 1234,567,89 should be parsed as a string (EDIT: actually maybe it should be an array?)

Current result

INTEGER: 1234,567,89 is parsed as an integer 1234,567,89

Possible Fix

We could make a PR into https://github.com/ruby/psych, or we could switch libraries (if there even are others to choose from).

We could try pre-parsing the YAML before we pass it to Psych, however I would expect that to be difficult and fraught with other issues.

@sethboyles sethboyles added the bug label Apr 13, 2021
@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/177751284

The labels on this github issue will be updated when the story is started.

@sethboyles sethboyles added the upstream-bug Bugs caused by upstream dependencies label Apr 13, 2021
@sethboyles sethboyles changed the title Integers with commas in space manifests gets parsed numbers with commas in space manifests gets parsed as an integer, not a string Apr 15, 2021
@sethboyles sethboyles changed the title numbers with commas in space manifests gets parsed as an integer, not a string numbers with commas in space manifests get parsed as an integer, not a string Apr 15, 2021
@thelangley
Copy link

hey it looks like a potential fix was merged into psych. ruby/psych#273

do we need an official release of psych to be cut before testing this new strict_integer functionality?

@sethboyles
Copy link
Member Author

Yeah, we are just waiting for a Psych release at this point.

moleske added a commit that referenced this issue Oct 20, 2023
- in #2807 we manually set psych so we could resolve #2193
- the newer psych is available as a default gem in [ruby 3.2](https://www.ruby-lang.org/en/news/2022/12/25/ruby-3-2-0-released/)
@moleske moleske mentioned this issue Oct 20, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug upstream-bug Bugs caused by upstream dependencies
Projects
None yet
4 participants