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

Support bundle redaction fails on Windows #1607

Open
manderson23 opened this issue Sep 4, 2024 · 2 comments
Open

Support bundle redaction fails on Windows #1607

manderson23 opened this issue Sep 4, 2024 · 2 comments

Comments

@manderson23
Copy link

Bug Description

Running the support-bundle executable on Windows with redaction (either when collecting the bundle or running against an existing bundle) fails will an error saying a file is in use.

Expected Behavior

support-bundle with redaction should succeed with no errors on Windows.

Steps To Reproduce

Run support-bundle.exe ./support-bundle.yaml gives error

Error: failed to run collect and analyze process: failed to run collectors: failed to redact in cluster collector results: failed to create redacted result: failed to rename tmp file: rename C:\Users\212534~1\AppData\Local\Temp\replace-22978352 C:\Users\212534~1\AppData\Local\Temp\supportbundle458253607\support-bundle-2024-09-04T10_29_56\cluster-resources\jobs\simulation-worker.json: The process cannot access the file because it is being used by another process.

Run support-bundle.exe redact redactor.yaml --bundle support-bundle-2024-09-04T09_12_48.tar.gz gives error

Error: failed to redact support bundle: failed to create redacted result: failed to rename tmp file: rename C:\Users\212534~1\AppData\Local\Temp\replace-603473377 C:\Users\212534~1\AppData\Local\Temp\troubleshoot-k8s1501536515\support-bundle-2024-09-04T09_12_48\cluster-resources\limitranges\default.json: The process cannot access the file because it is being used by another process.

Additional Context

Windows 10 - same error in git bash, command or powershell

@xavpaice
Copy link
Member

Hi, thanks for the report.

Please try this with WSL, which is more like the environment we test on. At this stage we do not have testing environments for Windows and consider Windows unsupported.

@manderson23
Copy link
Author

I've investigated this further and I've found 2 issues that prevent redaction running on Windows.

  1. defer tmpFile.Close()
    closing the temp file is relying on defer but on Windows it must be closed before os.Rename is called
  2. defer r.Close()
    another case of using defer but on Windows this must be closed before input.ReplaceResult is called

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

No branches or pull requests

2 participants