Merged
Conversation
debarshiray
reviewed
May 3, 2024
Member
debarshiray
left a comment
There was a problem hiding this comment.
Thanks, because I got tripped by these while reading the code in the context of containers/podman#22575
| // The Digest field in BlobInfo is guaranteed to be provided, Size may be -1 and MediaType may be optionally provided. | ||
| // May update BlobInfoCache, preferably after it knows for certain that a blob truly exists at a specific location. | ||
| func (s *storageImageSource) GetBlob(ctx context.Context, info types.BlobInfo, cache types.BlobInfoCache) (rc io.ReadCloser, n int64, err error) { | ||
| func (s *storageImageSource) GetBlob(ctx context.Context, info types.BlobInfo, cache types.BlobInfoCache) (io.ReadCloser, int64, error) { |
Member
There was a problem hiding this comment.
A combination of several deferred calls, and a return value that's a direct function call, which itself takes an unnamed function, makes these named return values treacherously confusing. :)
| // cleaned up on process termination (or if the caller forgets to invoke Close()) | ||
| // On older versions of Windows we will have to fallback to relying on the caller to invoke Close() | ||
| if err := os.Remove(tmpFile.Name()); err != nil { | ||
| if err := os.Remove(tmpFile.Name()); err == nil { |
Member
There was a problem hiding this comment.
I had found myself scratching my head over this logic too but had set it aside because it didn't seem directly relevant to the issue at hand.
6883af1 to
a37e4f7
Compare
Member
|
LGTM |
They get horribly confusing, especially here where we use "rc" for two completely different purposes: containers/podman#22575 (comment) Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Try unlinking it when we are done using if we _don't_ succeed unlinking it first, not if we _do succeed_. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Member
|
@giuseppe @mheon @debarshiray PTAL |
Member
|
LGTM |
Member
I already did. I couldn't spot any further changes after the initial version. :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… tangentially related to containers/podman#22575 :