Skip to content

Commit

Permalink
try disabling seek instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Son Roy Almerol committed Nov 14, 2024
1 parent 8a36685 commit 6a0e499
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 35 deletions.
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.23.2
toolchain go1.23.3

require (
github.com/billgraziano/dpapi v0.5.0
github.com/getlantern/systray v1.2.2
github.com/kardianos/service v1.2.2
github.com/mattn/go-sqlite3 v1.14.24
Expand All @@ -15,7 +16,7 @@ require (
)

require (
github.com/billgraziano/dpapi v0.5.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 // indirect
github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7 // indirect
github.com/getlantern/golog v0.0.0-20190830074920-4ef2e798c2d7 // indirect
Expand All @@ -27,5 +28,6 @@ require (
github.com/kr/fs v0.1.0 // indirect
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/stretchr/testify v1.9.0 // indirect
)
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
github.com/billgraziano/dpapi v0.5.0 h1:pcxA17vyjbDqYuxCFZbgL9tYIk2xgbRZjRaIbATwh+8=
github.com/billgraziano/dpapi v0.5.0/go.mod h1:lmEcZjRfLCSbUTsRu8V2ti6Q17MvnKn3N9gQqzDdTh0=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 h1:NRUJuo3v3WGC/g5YiyF790gut6oQr5f3FBI88Wv0dx4=
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520/go.mod h1:L+mq6/vvYHKjCX2oez0CgEAJmbq1fbb/oNJIWQkBybY=
Expand Down Expand Up @@ -38,8 +39,9 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/sftp v1.13.7 h1:uv+I3nNJvlKZIQGSr8JVQLNHFU9YhhNpvC14Y6KgmSM=
github.com/pkg/sftp v1.13.7/go.mod h1:KMKI0t3T6hfA+lTR/ssZdunHo+uwq7ghoN09/FSu3DY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
Expand Down
13 changes: 6 additions & 7 deletions internal/agent/sftp/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ func compileExcludedPaths() []*regexp.Regexp {
`AppData\Local\Microsoft\Windows\WebCache`,
`AppData\Local\Microsoft\Windows Store`,
`AppData\Local\Packages`,
`AppData\Local\Veritas`,
`Application Data\Apple Computer\Mobile Sync`,
`Application Data\Application Data**`,
`Dropbox\Dropbox.exe.log`,
Expand All @@ -95,7 +94,12 @@ func compileExcludedPaths() []*regexp.Regexp {
`Google\Chrome\**LOCK**`,
`Google\Chrome\**Current**`,
`Google\Chrome\Safe Browsing**`,
`BraveSoftware\Brave-Browser`,
`BraveSoftware\Brave-Browser\User Data\Default\Cache`,
`BraveSoftware\Brave-Browser\User Data\Default\Cookies`,
`BraveSoftware\Brave-Browser\User Data\Default\Cookies-journal`,
`BraveSoftware\Brave-Browser\**LOCK**`,
`BraveSoftware\Brave-Browser\**Current**`,
`BraveSoftware\Brave-Browser\Safe Browsing**`,
`iPhoto Library\iPod Photo Cache`,
`cookies.sqlite-**`,
`permissions.sqlite-**`,
Expand Down Expand Up @@ -138,10 +142,5 @@ func (h *SftpHandler) skipFile(path string) bool {
return true
}

probablyLocked, err := inconsistentSize(path)
if err != nil || probablyLocked {
return true
}

return false
}
25 changes: 0 additions & 25 deletions internal/agent/sftp/windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,3 @@ func invalidAttributes(path string) (bool, error) {

return false, nil
}

func inconsistentSize(path string) (bool, error) {
file, err := os.Open(path)
if err != nil {
return true, err
}
defer file.Close()

si := &FileStandardInfo{}
err = windows.GetFileInformationByHandleEx(windows.Handle(file.Fd()), windows.FileStandardInfo, (*byte)(unsafe.Pointer(si)), uint32(unsafe.Sizeof(*si)))
if err != nil {
return true, err
}

stat, err := os.Lstat(path)
if err != nil {
return true, err
}

if si.EndOfFile == stat.Size() {
return false, nil
}

return true, nil
}
1 change: 1 addition & 0 deletions internal/backend/mount/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func Mount(target *store.Target) (*AgentMount, error) {
"mount",
"--daemon",
"--vfs-cache-mode", "minimal",
"--no-seek",
"--read-only",
"--uid", "0",
"--gid", "0",
Expand Down

0 comments on commit 6a0e499

Please sign in to comment.