-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat: add Windows support by handling empty path case in PathSplit function #5944
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
base: master
Are you sure you want to change the base?
feat: add Windows support by handling empty path case in PathSplit function #5944
Conversation
The committers listed above are authorized under a signed CLA. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pcanilho The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Welcome @pcanilho! |
Hi @pcanilho. 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-sigs/prow repository. |
Hi @pcanilho Thanks for open PR. https://github.com/kubernetes-sigs/kustomize/blob/master/CONTRIBUTING.md#reviewer-guide
|
Bump? =) |
Goal: Fix
PathSplit
function to handle empty path case forWindows
supportContext: This PR fixes an issue I was having when adding
Windows
support for some of my utilities by updating the function to handle the case when is empty.The issue
When running on
Windows
, I was getting errors because the function wasn't handling empty paths correctly. The problem occurs becauseWindows
uses backslashes (\
) as path separators, so when resolves to\
, the path splitting logic behaves differently than on Unix systems.For example, I was seeing errors like this locally:
Causing a
stack overflow
:click here to see the stack trace... ❗️
Note:
go version go1.24.5 windows/arm64
My proposal
I added a simple check to the existing condition in . This prevents issues when working with
Windows
systems.Why this works
The existing tests already pass with this change, which confirms this change does not impact existing unix support. It is aimed at ensuring consistent behaviour across operating systems without requiring more invasive changes.
Testing notes
The existing tests exclude
Windows
intentionally, and I wasn't sure if adapting them would be straightforward since proper testing needs to be done on aWindows
host where resolves to theWindows
-specific rune.Any form of feedback is greatly appreciated.