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

Yaml file with regex is parsed with invalid characters in json format on s390x platform (>v4.35.2) #2093

Open
chegde20121 opened this issue Jul 5, 2024 · 1 comment
Labels

Comments

@chegde20121
Copy link

chegde20121 commented Jul 5, 2024

Describe the bug
When I parse a yaml file which contains regex with escape characters into json format on s390x platform,
Note that any how to questions should be posted in the discussion board and not raised as an issue.

**On s390x:- **
version: v4.44.2
Platform: s390x
input yaml:-

divisor:
  anyOf:
  - type: integer
  - type: string
  description: Specifies the output format of the exposed resources, defaults to "1"
  pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
  x-kubernetes-int-or-string: true
./yq_linux_s390x eval -o=json postgres_edb.yaml > postgres_edb.json
jq . postgres_edb.json
parse error: Invalid escape at line 1989, column 165

Parsed line from yq in s390x is

Actual Output:-

 "pattern": "^(\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",

** On x86**
version: v4.44.2
Platform: x86
input yaml:-

divisor:
  anyOf:
  - type: integer
  - type: string
  description: Specifies the output format of the exposed resources, defaults to "1"
  pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
  x-kubernetes-int-or-string: true

command:

./bin/yq eval -o=json postgres_edb.yaml > postgres_edb.json

Output

 "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$"

In x86 there is no issue. But only in s390x the yaml with escape charecters is not parsed as expected

Command
The command you ran:

./yq_linux_s390x eval -o=json postgres_edb.yaml > postgres_edb.json

Actual behavior

"pattern": "^(\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$"

Expected behavior

 "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$"

**Additional context**
This issue is occurring in all the versions above v4.35.2 of s390x distribution
@mikefarah
Copy link
Owner

Weird - I'm not doing anything special for s390x other than using the go-compiler to build the binary. So you're saying it produces a different JSON output to the x86 binary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants