-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
ValueAddTransformer crashes w/ stack overflow under Windows if target value contains / as path separator #5078
Comments
There appears to be an issue in the ValueAddTransformer code, @ephesused will provide some more code details here later. Some relevant code snippets: While we would accept a fix to prevent the stack overflow error from happening, we would like to encourage you to switch over to using the ReplacementTransformer instead. The ReplacementTransformer provides a superset of features over the ValueAddTransformer, and are considering deprecating ValueAddTransformer. The related issue is here: #4520 /triage accepted |
The crash comes from infinite recursion in filesys.PathSplit. The call to filepath.Split honors both / and \ as path separators on windows. However, filesys.PathSplit expects only os.PathSeparator (both here and here). When "resources/prod" is processed, the first PathSplit execution breaks it into "resources/" and "prod". It then recurses with a value of "resources/". The TrimSuffix at line 51 does nothing, which means it recurses again with a value of "resources/". This continues until the stack overflow. |
OK... but, may I ask what you think about my comment on #4520? |
This issue has not been updated in over 1 year, and should be re-triaged. You can:
For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/ /remove-triage accepted |
What happened?
When setting up a ValueAddTransfomer using kustomize Windows executable that access the kustomization directory basename as value, a Go stack overflow is triggered if the target value contains a forward slash as path separator
What did you expect to happen?
kustomize should not crash, but instead be able to process Unix-like paths seamlessly also if running under Windows.
Still better would if kustomize would perform a "normalization" of paths to forward slash Unix notation -- IME, Windows can cope with such paths w/o problems, while generating paths containing backslashes as separators makes it impossible to do trans-platform development (i.e. develop kustomizations under Windows and use them under Unix)
How can we reproduce it (as minimally and precisely as possible)?
Expected output
Actual output
kustomize Windows executables crash w/ go stack overflow
Kustomize version
v4.5.7 and v5.0.0
Operating system
Windows
The text was updated successfully, but these errors were encountered: