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

Remove use of os.Chdir #2682

Open
phillebaba opened this issue Jul 1, 2024 · 0 comments · May be fixed by #2683
Open

Remove use of os.Chdir #2682

phillebaba opened this issue Jul 1, 2024 · 0 comments · May be fixed by #2683
Labels
tech-debt 💳 Debt that the team has charged and needs to repay

Comments

@phillebaba
Copy link
Member

Describe what should be investigated or refactored

There are a couple of places in the code base where os.Chdir is used to access files in specific paths. Change of working directory is done temporarily in a function. Usually in the function the working directory is changed back in a deferred function. This is not a thread safe operation as setting the working directory is a per process system call. Packager and other components should support being used in multiple goroutines. For this reason we need to remove any use of os.Chdir.

Links to any relevant code

https://github.com/defenseunicorns/zarf/blob/601a282c78701bb039924c6c72802690656395df/src/pkg/packager/publish.go#L51
https://github.com/defenseunicorns/zarf/blob/601a282c78701bb039924c6c72802690656395df/src/pkg/packager/dev.go#L37

Additional context

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech-debt 💳 Debt that the team has charged and needs to repay
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

1 participant