mirror of
https://github.com/containers/podman.git
synced 2025-12-09 15:19:35 +08:00
vendor: bump c/storage
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
8
vendor/github.com/containers/storage/pkg/archive/changes_linux.go
generated
vendored
8
vendor/github.com/containers/storage/pkg/archive/changes_linux.go
generated
vendored
@@ -316,7 +316,11 @@ func parseDirent(buf []byte, names []nameIno) (consumed int, newnames []nameIno)
|
||||
// with respect to the parent layers
|
||||
func OverlayChanges(layers []string, rw string) ([]Change, error) {
|
||||
dc := func(root, path string, fi os.FileInfo) (string, error) {
|
||||
return overlayDeletedFile(layers, root, path, fi)
|
||||
r, err := overlayDeletedFile(layers, root, path, fi)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("overlay deleted file query: %w", err)
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
return changes(layers, rw, dc, nil, overlayLowerContainsWhiteout)
|
||||
}
|
||||
@@ -351,7 +355,7 @@ func overlayDeletedFile(layers []string, root, path string, fi os.FileInfo) (str
|
||||
// If the directory isn't marked as opaque, then it's just a normal directory.
|
||||
opaque, err := system.Lgetxattr(filepath.Join(root, path), getOverlayOpaqueXattrName())
|
||||
if err != nil {
|
||||
return "", err
|
||||
return "", fmt.Errorf("failed querying overlay opaque xattr: %w", err)
|
||||
}
|
||||
if len(opaque) != 1 || opaque[0] != 'y' {
|
||||
return "", err
|
||||
|
||||
31
vendor/github.com/containers/storage/pkg/archive/filter.go
generated
vendored
31
vendor/github.com/containers/storage/pkg/archive/filter.go
generated
vendored
@@ -26,6 +26,19 @@ func getFilterPath(name string) string {
|
||||
return path.(string)
|
||||
}
|
||||
|
||||
type errorRecordingReader struct {
|
||||
r io.Reader
|
||||
err error
|
||||
}
|
||||
|
||||
func (r *errorRecordingReader) Read(p []byte) (int, error) {
|
||||
n, err := r.r.Read(p)
|
||||
if r.err == nil && err != io.EOF {
|
||||
r.err = err
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
// tryProcFilter tries to run the command specified in args, passing input to its stdin and returning its stdout.
|
||||
// cleanup() is a caller provided function that will be called when the command finishes running, regardless of
|
||||
// whether it succeeds or fails.
|
||||
@@ -38,22 +51,20 @@ func tryProcFilter(args []string, input io.Reader, cleanup func()) (io.ReadClose
|
||||
|
||||
var stderrBuf bytes.Buffer
|
||||
|
||||
inputWithError := &errorRecordingReader{r: input}
|
||||
|
||||
r, w := io.Pipe()
|
||||
cmd := exec.Command(path, args[1:]...)
|
||||
cmd.Stdin = input
|
||||
cmd.Stdin = inputWithError
|
||||
cmd.Stdout = w
|
||||
cmd.Stderr = &stderrBuf
|
||||
go func() {
|
||||
err := cmd.Run()
|
||||
if err != nil && stderrBuf.Len() > 0 {
|
||||
b := make([]byte, 1)
|
||||
// if there is an error reading from input, prefer to return that error
|
||||
_, errRead := input.Read(b)
|
||||
if errRead != nil && errRead != io.EOF {
|
||||
err = errRead
|
||||
} else {
|
||||
err = fmt.Errorf("%s: %w", strings.TrimRight(stderrBuf.String(), "\n"), err)
|
||||
}
|
||||
// if there is an error reading from input, prefer to return that error
|
||||
if inputWithError.err != nil {
|
||||
err = inputWithError.err
|
||||
} else if err != nil && stderrBuf.Len() > 0 {
|
||||
err = fmt.Errorf("%s: %w", strings.TrimRight(stderrBuf.String(), "\n"), err)
|
||||
}
|
||||
w.CloseWithError(err) // CloseWithErr(nil) == Close()
|
||||
cleanup()
|
||||
|
||||
Reference in New Issue
Block a user