This repository was archived by the owner on Jan 15, 2026. It is now read-only.
image: fix the interaction of findManifest and findConfig with walker.find#206
Open
knieriem wants to merge 1 commit intoopencontainers:masterfrom
Open
image: fix the interaction of findManifest and findConfig with walker.find#206knieriem wants to merge 1 commit intoopencontainers:masterfrom
knieriem wants to merge 1 commit intoopencontainers:masterfrom
Conversation
….find Before rev. 9027d58 findManifest and findConfig called w.walk directly, providing a walkFunc that returned errEOW in case a file has been found and processed successfully. A switch construct evaluating the error-result of w.walk then tested for the errEOW case, meaning the file has been found. Starting with rev. 9027d58 the call to w.walk in findManifest and findConfig has been replaced by w.find. Though, the function literal provided by findManifest and findConfig to w.find -- now a findFunc, not a walkFunc anymore -- still returns errEOW. As a consequence, walker.find implementations for tar and zip would treat errEOW as an error, making oci-image-tool 'validate' and 'create' stop with an error: <tar-image>: find failed: unable to walk: end of walk This patch adjusts tarWalker's and zipWalker's implementations of walker.find, using errEOW to stop w.walk early in case of success; there is no need for the 'done' variable anymore. Additionally, places where w.find is called, functions findManifest, unpackManifest, and findConfig, have been adapted so that their findFunc argument to w.find does not return errEOW anymore; instead nil is returned on success. Consequently, the switch constructs now test err for 'nil' instead of 'errEOW', and 'os.ErrNotExist' instead of nil. Fixes opencontainers#205 Signed-off-by: Michael Teichgräber <mteichgraeber@gmx.de>
|
Just wondering if there's anything blocking this PR? I ran into this issue with some |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Before rev. 9027d58 findManifest and findConfig called w.walk directly,
providing a walkFunc that returned errEOW in case a file has been
found and processed successfully. A switch construct evaluating the
error-result of w.walk then tested for the errEOW case, meaning the file
has been found.
Starting with rev. 9027d58 the call to w.walk in findManifest and
findConfig has been replaced by w.find. Though, the function literal
provided by findManifest and findConfig to w.find -- now a findFunc,
not a walkFunc anymore -- still returns errEOW. As a consequence,
walker.find implementations for tar and zip would treat errEOW as an
error, making oci-image-tool 'validate' and 'create' stop with an error:
This patch adjusts tarWalker's and zipWalker's implementations of
walker.find, using errEOW to stop w.walk early in case of success; there
is no need for the 'done' variable anymore. Additionally, places where
w.find is called, functions findManifest, unpackManifest, and findConfig,
have been adapted so that their findFunc argument to w.find does not
return errEOW anymore; instead nil is returned on success. Consequently,
the switch constructs now test err for 'nil' instead of 'errEOW', and
'os.ErrNotExist' instead of nil.
Fixes #205
Signed-off-by: Michael Teichgräber mteichgraeber@gmx.de