forked from opencontainers/image-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
image: fix the interaction of findManifest and findConfig with walker…
….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>
- Loading branch information
Showing
3 changed files
with
21 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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