Skip to content

Commit

Permalink
Fix lakectl local with windows (#6464)
Browse files Browse the repository at this point in the history
* Fix lakectl local with windows

* Transferred repo
  • Loading branch information
N-o-Z authored Aug 23, 2023
1 parent 6ee7649 commit 436b028
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ require (
github.com/hashicorp/go-retryablehttp v0.7.2
github.com/hashicorp/go-version v1.6.0
github.com/jackc/pgx/v5 v5.3.1
github.com/karrick/godirwalk v1.17.0
github.com/karrick/godirwalk v0.0.0-00010101000000-000000000000
github.com/puzpuzpuz/xsync v1.5.2
go.uber.org/ratelimit v0.2.0
)
Expand Down Expand Up @@ -216,3 +216,5 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
pgregory.net/rapid v0.4.0 // indirect
)

replace github.com/karrick/godirwalk => github.com/treeverse/godirwalk v1.17.3
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,6 @@ github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+
github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw=
github.com/karrick/godirwalk v1.17.0 h1:b4kY7nqDdioR/6qnbHQyDvmA17u5G1cZ6J+CZXwSWoI=
github.com/karrick/godirwalk v1.17.0/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk=
github.com/kataras/golog v0.0.9/go.mod h1:12HJgwBIZFNGL0EJnMRhmvGA0PQGx8VFwrZtM4CqbAk=
github.com/kataras/golog v0.0.10/go.mod h1:yJ8YKCmyL+nWjERB90Qwn+bdyBZsaQwU3bTVFgkFIp8=
github.com/kataras/iris/v12 v12.0.1/go.mod h1:udK4vLQKkdDqMGJJVd/msuMtN6hpYJhg/lSzuxjhO+U=
Expand Down Expand Up @@ -760,6 +758,8 @@ github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8
github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
github.com/thanhpk/randstr v1.0.4 h1:IN78qu/bR+My+gHCvMEXhR/i5oriVHcTB/BJJIRTsNo=
github.com/thanhpk/randstr v1.0.4/go.mod h1:M/H2P1eNLZzlDwAzpkkkUvoyNNMbzRGhESZuEQk3r0U=
github.com/treeverse/godirwalk v1.17.3 h1:IwJ9rTv0C0itU80q0pQZyJlQxVKhCA1i59IGMnAJY5s=
github.com/treeverse/godirwalk v1.17.3/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk=
github.com/tsenart/go-tsz v0.0.0-20180814232043-cdeb9e1e981e/go.mod h1:SWZznP1z5Ki7hDT2ioqiFKEse8K9tU2OUvaRI0NeGQo=
github.com/tsenart/vegeta/v12 v12.8.4 h1:UQ7tG7WkDorKj0wjx78Z4/vsMBP8RJQMGJqRVrkvngg=
github.com/tsenart/vegeta/v12 v12.8.4/go.mod h1:ZiJtwLn/9M4fTPdMY7bdbIeyNeFVE8/AHbWFqCsUuho=
Expand Down
9 changes: 6 additions & 3 deletions pkg/fileutil/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"io/fs"
"os"
"path"
"path/filepath"
"strings"

Expand Down Expand Up @@ -39,7 +38,8 @@ func FindInParents(dir, filename string) (string, error) {
if err != nil {
return "", err
}
for fullPath != string(filepath.Separator) && fullPath != filepath.VolumeName(fullPath) {
volumeName := filepath.VolumeName(fullPath)
for fullPath != filepath.Join(volumeName, string(filepath.Separator)) {
info, err := os.Stat(fullPath)
if err != nil {
return "", fmt.Errorf("%s: %w", fullPath, err)
Expand Down Expand Up @@ -69,6 +69,9 @@ func IsDirEmpty(dir string) (bool, error) {
if err != nil {
return false, err
}
defer func() {
_ = s.Close()
}()
// Attempt to read only the first directory entry. Note that Scan skips both "." and ".." entries.
hasAtLeastOneChild := s.Scan()
if err = s.Err(); err != nil {
Expand Down Expand Up @@ -139,7 +142,7 @@ func FileExists(p string) (bool, error) {

func VerifyAbsPath(absPath, basePath string) error {
// check we have a valid abs path
if !path.IsAbs(absPath) || path.Clean(absPath) != absPath {
if !filepath.IsAbs(absPath) || filepath.Clean(absPath) != absPath {
return ErrBadPath
}
// point to storage namespace
Expand Down
2 changes: 1 addition & 1 deletion pkg/local/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (

const (
DefaultDirectoryMask = 0o755
ClientMtimeHeaderKey = api.LakeFSHeaderInternalPrefix + "client-mtime"
ClientMtimeMetadataKey = api.LakeFSMetadataPrefix + "client-mtime"
)

Expand Down Expand Up @@ -329,6 +328,7 @@ func (s *SyncManager) deleteRemote(ctx context.Context, remote *uri.URI, change
if err != nil {
b.Error()
} else {
atomic.AddUint64(&s.tasks.Removed, 1)
b.Done()
}
}()
Expand Down

0 comments on commit 436b028

Please sign in to comment.