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
Open

Remove use of os.Chdir #2682

phillebaba opened this issue Jul 1, 2024 · 0 comments

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
None yet
Projects
Status: Triage
Development

Successfully merging a pull request may close this issue.

2 participants