Skip to content

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

Open
@chegde20121

Description

@chegde20121

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions