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

FileCache: Delete the new cache file on exception #34623

Merged
merged 7 commits into from Jan 10, 2023

Conversation

blue42u
Copy link
Contributor

@blue42u blue42u commented Dec 20, 2022

The code in FileCache for write_transaction attempts to delete the temporary file when an exception occurs under the context by calling shutil.rmtree. However, rmtree only operates on directories while the rest of FileCache uses normal files. This causes an empty file to be written to the cache key when unneeded.

Use os.remove instead which operates on normal files.

@spackbot-app spackbot-app bot added core PR affects Spack core functionality utilities labels Dec 20, 2022
@spackbot-app spackbot-app bot added the tests General test capability(ies) label Dec 20, 2022
lib/spack/spack/test/util/file_cache.py Outdated Show resolved Hide resolved
lib/spack/spack/util/file_cache.py Outdated Show resolved Hide resolved
@haampie
Copy link
Member

haampie commented Dec 21, 2022

Thanks for splitting this out, since this can be backported.

@haampie haampie added this to the v0.19.1 milestone Dec 21, 2022
@haampie
Copy link
Member

haampie commented Dec 21, 2022

@spackbot run pipeline

@spackbot-app
Copy link

spackbot-app bot commented Dec 21, 2022

I've started that pipeline for you!

@haampie haampie merged commit 6879c35 into spack:develop Jan 10, 2023
haampie added a commit that referenced this pull request Jan 10, 2023
The code in FileCache for write_transaction attempts to delete the temporary file when an exception occurs under the context by calling shutil.rmtree. However, rmtree only operates on directories while the rest of FileCache uses normal files. This causes an empty file to be written to the cache key when unneeded.

Use os.remove instead which operates on normal files.

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
@haampie haampie mentioned this pull request Jan 10, 2023
20 tasks
haampie added a commit that referenced this pull request Jan 18, 2023
The code in FileCache for write_transaction attempts to delete the temporary file when an exception occurs under the context by calling shutil.rmtree. However, rmtree only operates on directories while the rest of FileCache uses normal files. This causes an empty file to be written to the cache key when unneeded.

Use os.remove instead which operates on normal files.

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
haampie added a commit that referenced this pull request Jan 24, 2023
The code in FileCache for write_transaction attempts to delete the temporary file when an exception occurs under the context by calling shutil.rmtree. However, rmtree only operates on directories while the rest of FileCache uses normal files. This causes an empty file to be written to the cache key when unneeded.

Use os.remove instead which operates on normal files.

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
haampie added a commit that referenced this pull request Jan 24, 2023
The code in FileCache for write_transaction attempts to delete the temporary file when an exception occurs under the context by calling shutil.rmtree. However, rmtree only operates on directories while the rest of FileCache uses normal files. This causes an empty file to be written to the cache key when unneeded.

Use os.remove instead which operates on normal files.

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
RikkiButler20 pushed a commit to RikkiButler20/spack that referenced this pull request Jan 24, 2023
The code in FileCache for write_transaction attempts to delete the temporary file when an exception occurs under the context by calling shutil.rmtree. However, rmtree only operates on directories while the rest of FileCache uses normal files. This causes an empty file to be written to the cache key when unneeded.

Use os.remove instead which operates on normal files.

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
haampie added a commit that referenced this pull request Feb 7, 2023
The code in FileCache for write_transaction attempts to delete the temporary file when an exception occurs under the context by calling shutil.rmtree. However, rmtree only operates on directories while the rest of FileCache uses normal files. This causes an empty file to be written to the cache key when unneeded.

Use os.remove instead which operates on normal files.

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
alalazo pushed a commit that referenced this pull request Feb 7, 2023
The code in FileCache for write_transaction attempts to delete the temporary file when an exception occurs under the context by calling shutil.rmtree. However, rmtree only operates on directories while the rest of FileCache uses normal files. This causes an empty file to be written to the cache key when unneeded.

Use os.remove instead which operates on normal files.

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
amd-toolchain-support pushed a commit to amd-toolchain-support/spack that referenced this pull request Feb 16, 2023
The code in FileCache for write_transaction attempts to delete the temporary file when an exception occurs under the context by calling shutil.rmtree. However, rmtree only operates on directories while the rest of FileCache uses normal files. This causes an empty file to be written to the cache key when unneeded.

Use os.remove instead which operates on normal files.

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
techxdave pushed a commit to Tech-XCorp/spack that referenced this pull request Feb 17, 2023
The code in FileCache for write_transaction attempts to delete the temporary file when an exception occurs under the context by calling shutil.rmtree. However, rmtree only operates on directories while the rest of FileCache uses normal files. This causes an empty file to be written to the cache key when unneeded.

Use os.remove instead which operates on normal files.

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
jmcarcell pushed a commit to key4hep/spack that referenced this pull request Apr 13, 2023
The code in FileCache for write_transaction attempts to delete the temporary file when an exception occurs under the context by calling shutil.rmtree. However, rmtree only operates on directories while the rest of FileCache uses normal files. This causes an empty file to be written to the cache key when unneeded.

Use os.remove instead which operates on normal files.

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core PR affects Spack core functionality tests General test capability(ies) utilities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants