Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposed fix for cryfs filesystem issue #1566

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions nav.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,16 @@ func (nav *nav) checkDir(dir *dir) {
return
}

// Cryfs filesystems always show as having 0 blocks and are always considered to be modified at current time
// See cryfs issue: https://github.com/cryfs/cryfs/issues/327
if getBlockCount(s) == 0 {
return
}

nav.startPreview()
dir.loading = true
dir.loadTime = now

go func() {
nd := newDir(dir.path)
nd.filter = dir.filter
Expand Down
8 changes: 8 additions & 0 deletions os.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,14 @@ func linkCount(f os.FileInfo) string {
return ""
}

func getBlockCount(f os.FileInfo) int64 {
sysCallStat, isSysCall := f.Sys().(*syscall.Stat_t)
if !isSysCall {
return -1
}
return sysCallStat.Blocks
}

func errCrossDevice(err error) bool {
return err.(*os.LinkError).Err.(unix.Errno) == unix.EXDEV
}
Expand Down
4 changes: 4 additions & 0 deletions os_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ func linkCount(f os.FileInfo) string {
return ""
}

func getBlockCount(os.FileInfo) int64 {
return -1
}

func errCrossDevice(err error) bool {
return err.(*os.LinkError).Err.(windows.Errno) == 17
}
Expand Down