diff --git a/Makefile b/Makefile index d5f7ea2c3a97d..ef0b693610ee8 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ juicefs: Makefile cmd/*.go pkg/*/*.go go.* go build -ldflags="$(LDFLAGS)" -o juicefs . juicefs.lite: Makefile cmd/*.go pkg/*/*.go - go build -tags nogateway,nowebdav,nocos,nobos,nohdfs,noibmcos,noobs,nooss,noqingstor,noscs,nosftp,noswift,noupyun,noazure,nogs,noufile,nob2,nosqlite,nomysql,nopg,notikv,nobadger,noetcd \ + go build -tags nogateway,nowebdav,nocos,nobos,nohdfs,noibmcos,noobs,nooss,noqingstor,noscs,nosftp,noswift,noupyun,noazure,nogs,noufile,nob2,nonfs,nosqlite,nomysql,nopg,notikv,nobadger,noetcd \ -ldflags="$(LDFLAGS)" -o juicefs.lite . juicefs.ceph: Makefile cmd/*.go pkg/*/*.go diff --git a/cmd/sync.go b/cmd/sync.go index cc34a8972c2b2..96ccfd880b7b1 100644 --- a/cmd/sync.go +++ b/cmd/sync.go @@ -309,6 +309,7 @@ func createSyncStorage(uri string, conf *sync.Config) (object.ObjectStorage, err secretKey, _ = user.Password() } name := strings.ToLower(u.Scheme) + var endpoint string if name == "file" { endpoint = u.Path diff --git a/pkg/object/object_storage.go b/pkg/object/object_storage.go index 6d3824b445c9b..f888abb936f41 100644 --- a/pkg/object/object_storage.go +++ b/pkg/object/object_storage.go @@ -214,7 +214,7 @@ func ListAllWithDelimiter(store ObjectStorage, prefix, start, end string, follow if key < start && !strings.HasPrefix(start, key) { continue } - if !entries[i].IsDir() || key == prefix || !followLink && entries[i].IsSymlink() { + if !entries[i].IsDir() || key == prefix { continue } @@ -244,7 +244,7 @@ func ListAllWithDelimiter(store ObjectStorage, prefix, start, end string, follow } else if !strings.HasPrefix(start, key) { continue } - if !entries[i].IsDir() || key == prefix || !followLink && entries[i].IsSymlink() { + if !entries[i].IsDir() || key == prefix { continue } diff --git a/pkg/sync/sync.go b/pkg/sync/sync.go index a8caaf9ffd153..c956984e5fd74 100644 --- a/pkg/sync/sync.go +++ b/pkg/sync/sync.go @@ -554,15 +554,17 @@ func worker(tasks <-chan object.Object, src, dst object.ObjectStorage, config *C break } var err error - var dataCopied bool if config.Links && obj.IsSymlink() { - err = copyLink(src, dst, key) + if err = copyLink(src, dst, key); err == nil { + copied.Increment() + break + } + logger.Errorf("copy link failed: %s", err) } else { - dataCopied = true err = copyData(src, dst, key, obj.Size()) } - if err == nil && (config.CheckAll || config.CheckNew) && dataCopied { + if err == nil && (config.CheckAll || config.CheckNew) { var equal bool if equal, err = checkSum(src, dst, key, obj.Size()); err == nil && !equal { err = fmt.Errorf("checksums of copied object %s don't match", key)