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

Improve extracted archive file clean up #714

Merged
merged 5 commits into from
Dec 17, 2024

Conversation

egibs
Copy link
Member

@egibs egibs commented Dec 17, 2024

Closes: #711

This PR ensures that tmpRoot is removed before processArchive returns (and only if tmpRoot is not ""). Previously, we would only remove the directory if no errors were encountered during scanning.

@egibs egibs requested a review from tstromberg December 17, 2024 15:28
@egibs egibs force-pushed the fix-temp-file-removal branch from a15f3e5 to bad2b00 Compare December 17, 2024 15:36
Copy link
Collaborator

@tstromberg tstromberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can

@egibs egibs merged commit e6d7f01 into chainguard-dev:main Dec 17, 2024
8 checks passed
tstromberg pushed a commit to tstromberg/malcontent that referenced this pull request Dec 17, 2024
* Improve extracted archive file clean up

Signed-off-by: egibs <[email protected]>

* Wrap tmpRoot removal in a defer instead

Signed-off-by: egibs <[email protected]>

* Only remove if tmpRoot is created successfully

Signed-off-by: egibs <[email protected]>

---------

Signed-off-by: egibs <[email protected]>
tstromberg added a commit that referenced this pull request Dec 17, 2024
* Add exception for SonarAnalyzer.CSharp.dll

* Improve extracted archive file clean up (#714)

* Improve extracted archive file clean up

Signed-off-by: egibs <[email protected]>

* Wrap tmpRoot removal in a defer instead

Signed-off-by: egibs <[email protected]>

* Only remove if tmpRoot is created successfully

Signed-off-by: egibs <[email protected]>

---------

Signed-off-by: egibs <[email protected]>

* Add tests

* update testdata

---------

Signed-off-by: egibs <[email protected]>
Co-authored-by: Evan Gibler <[email protected]>
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

Successfully merging this pull request may close these issues.

.jar files extracted to $TMPDIR are not cleaned up after execution
2 participants