-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Only strip surrounding quotes if there are at least two characters. #5074
Conversation
Welcome @plobsing! |
Hi @plobsing. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Hi @plobsing
Could you please describe in detail when this bug occurred? I'm waiting for your response! /triage needs-information |
The panic occurs when a configmap value is specified to be the length-1 string cat >kustomization.yaml <<EOF
configMapGenerator:
- name: test
literals:
- TEST='
EOF
kustomize build Fails with this diagnostic:
|
/triage accepted |
Hi @plobsing And, your PR failed to lint check. |
th.AssertActualEqualsExpected( | ||
m, `apiVersion: v1 | ||
data: | ||
TEST: '''' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think three single quartation is more correct in this part.
Do you have any problems?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think three single quartation is more correct in this part. Do you have any problems?
I believe the YAML 1.2 spec requires four single quote characters to represent this string. To satisfy the overall single-quoted string literal production (c-single-quoted(n,c)
), the first quote introduces the literal (token: c-single-quote
), the next two quotes act as an escaped single-quote character (token: c-quoted-quote
), and the fourth quote terminates the literal (token: c-single-quote
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I understand what happens to this line!
Otherwise, a value consisting of a single quote character triggers a panic: go test krusty/configmaps_test.go --- FAIL: TestDataIsSingleQuote (0.00s) panic: runtime error: slice bounds out of range [1:0] [recovered] panic: runtime error: slice bounds out of range [1:0]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And, your PR failed to lint check. Looks like this fail is not the specific line on your PR, So could you try
rebase master
? Maybe that fixes this failure.
Thanks for the advice. Rebased, although I'm still seeing what appear to be problems with make lint
locally so I'm not entirely confident I've cleared the issue (it seems like go fmt
is taking issue with several files not modified by this PR).
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: KnVerey, plobsing The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Otherwise, a value consisting of a single quote character triggers a panic: