-
Notifications
You must be signed in to change notification settings - Fork 234
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
chunked: various improvements #1072
Conversation
5349a54
to
8a89267
Compare
pkg/chunked/storage_linux.go
Outdated
@@ -230,21 +230,21 @@ func makeEstargzChunkedDiffer(ctx context.Context, store storage.Store, blobSize | |||
func copyFileFromOtherLayer(file *internal.FileMetadata, source string, otherFile *internal.FileMetadata, dirfd int, useHardLinks bool) (bool, *os.File, int64, error) { | |||
srcDirfd, err := unix.Open(source, unix.O_RDONLY, 0) | |||
if err != nil { | |||
return false, nil, 0, err | |||
return false, nil, 0, errors.Wrapf(err, "open source file %q", source) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a stutter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the unix.Open
call doesn't include any extra information except the errno
pkg/chunked/storage_linux.go
Outdated
} | ||
defer unix.Close(srcDirfd) | ||
|
||
srcFile, err := openFileUnderRoot(otherFile.Name, srcDirfd, unix.O_RDONLY, 0) | ||
if err != nil { | ||
return false, nil, 0, err | ||
return false, nil, 0, errors.Wrapf(err, "open source file %q under target rootfs", otherFile.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am worried about stutter here as well. Doesn't this end up calling an unix.Open()? Which will report an error with the file that the open failed on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, it won't use unix.Open
but call directly the openat2 wrapper, that only produces the UNIX error without any additional information.
pkg/chunked/storage_linux.go
Outdated
@@ -828,7 +828,10 @@ func safeSymlink(dirfd int, mode os.FileMode, metadata *internal.FileMetadata, o | |||
destDirFd = int(f.Fd()) | |||
} | |||
|
|||
return unix.Symlinkat(metadata.Linkname, destDirFd, destBase) | |||
if err := unix.Symlinkat(metadata.Linkname, destDirFd, destBase); err != nil { | |||
return errors.Wrapf(err, "create symlink %q pointing to %q", metadata.Name, metadata.Linkname) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stutter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without the extra information, we only get the UNIX error without any pointer to what symlink we were creating
LGTM other then concerns about stutter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I fine then.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the nit LGTM
pkg/chunked/storage_linux.go
Outdated
@@ -89,7 +89,7 @@ func copyFileContent(srcFd int, destFile string, dirfd int, mode os.FileMode, us | |||
src := fmt.Sprintf("/proc/self/fd/%d", srcFd) | |||
st, err := os.Stat(src) | |||
if err != nil { | |||
return nil, -1, err | |||
return nil, -1, errors.Wrapf(err, "copy file content for %q", destFile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: using fmt.Errorf
would be more modern
8a89267
to
8e3b7fa
Compare
thanks. Changed to use |
add more context to the error messages generated while unpacking the image. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
when creating a new file, handle the case where any of the parent directories are missing and create them automatically if needed. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
when dealing with symlink, open the parent directory and use the symlink basename to set its attributes. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
8e3b7fa
to
a72972c
Compare
some improvements and fixes for issues I've found while playing with docker.io/gscrivano/zstd-chunked:fcos-rawhide and docker.io/gscrivano/zstd-chunked:fcos-latest.
More details in each commit.
Signed-off-by: Giuseppe Scrivano gscrivan@redhat.com