daemon/builder/remotecontext: remove detection of system.XattrError

Both locations checked an error from `filepath.Rel` in stdlib, which
would never return a `system.XattrError`, so this was just dead code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-07-29 09:36:13 +02:00
parent 1e835a8cf5
commit 4c1ab68c6c

View File

@@ -8,7 +8,6 @@ import (
"github.com/docker/docker/daemon/builder"
"github.com/docker/docker/daemon/builder/remotecontext/internal/tarsum"
"github.com/docker/docker/pkg/longpath"
"github.com/docker/docker/pkg/system"
"github.com/moby/go-archive/chrootarchive"
"github.com/moby/go-archive/compression"
"github.com/moby/sys/symlink"
@@ -25,11 +24,10 @@ func (c *archiveContext) Close() error {
}
func convertPathError(err error, cleanpath string) error {
switch err := err.(type) {
case *os.PathError:
err.Path = cleanpath
case *system.XattrError:
err.Path = cleanpath
var pErr *os.PathError
if errors.As(err, &pErr) {
pErr.Path = cleanpath
err = pErr
}
return err
}
@@ -98,14 +96,14 @@ func (c *archiveContext) Remove(path string) error {
}
func (c *archiveContext) Hash(path string) (string, error) {
cleanpath, fullpath, err := normalize(path, c.root)
cleanPath, fullPath, err := normalize(path, c.root)
if err != nil {
return "", err
}
rel, err := filepath.Rel(c.root, fullpath)
rel, err := filepath.Rel(c.root, fullPath)
if err != nil {
return "", convertPathError(err, cleanpath)
return "", convertPathError(err, cleanPath)
}
// Use the checksum of the followed path(not the possible symlink) because