X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/060d38d627bd1e51dd2b3c6e7de9af6aa7d7b6f3..bb1d0c7499ad7c8d48c28a611c2d6a99c170265b:/sdk/go/crunchrunner/upload.go diff --git a/sdk/go/crunchrunner/upload.go b/sdk/go/crunchrunner/upload.go index fd24908ad6..2848d1087c 100644 --- a/sdk/go/crunchrunner/upload.go +++ b/sdk/go/crunchrunner/upload.go @@ -9,14 +9,15 @@ import ( "crypto/md5" "errors" "fmt" - "git.curoverse.com/arvados.git/sdk/go/keepclient" - "git.curoverse.com/arvados.git/sdk/go/manifest" "io" "log" "os" "path/filepath" "sort" "strings" + + "git.curoverse.com/arvados.git/sdk/go/keepclient" + "git.curoverse.com/arvados.git/sdk/go/manifest" ) type Block struct { @@ -90,7 +91,26 @@ type ManifestWriter struct { } func (m *ManifestWriter) WalkFunc(path string, info os.FileInfo, err error) error { - if info.IsDir() { + if err != nil { + return err + } + + targetPath, targetInfo := path, info + if info.Mode()&os.ModeSymlink != 0 { + // Update targetpath/info to reflect the symlink + // target, not the symlink itself + targetPath, err = filepath.EvalSymlinks(path) + if err != nil { + return err + } + targetInfo, err = os.Stat(targetPath) + if err != nil { + return fmt.Errorf("stat symlink %q target %q: %s", path, targetPath, err) + } + } + + if targetInfo.Mode()&os.ModeType != 0 { + // Skip directories, pipes, other non-regular files return nil }