From cad3244c712f61a6b5dbe90037a2c4475fdf6b7d Mon Sep 17 00:00:00 2001 From: Tryggvi Larusson Date: Wed, 16 Oct 2024 15:13:21 +0000 Subject: [PATCH 1/3] Implementing default getOSFileInfo implementation for other platforms --- file/file_other.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 file/file_other.go diff --git a/file/file_other.go b/file/file_other.go new file mode 100644 index 0000000..8209e93 --- /dev/null +++ b/file/file_other.go @@ -0,0 +1,20 @@ +//go:build !windows && !darwin && !dragonfly && !freebsd && !linux && !nacl && !netbsd && !openbsd && !solaris + +package file + +import ( + "os" + "syscall" +) + +func getOSFileInfo(info os.FileInfo) *FileInfo { + fi := &FileInfo{} + if s, ok := info.Sys().(*syscall.Stat_t); ok { + fi.Nlink = uint32(s.Nlink) + fi.UID = s.Uid + fi.GID = s.Gid + fi.Fileid = s.Ino + return fi + } + return nil +} From 3baf29003309c4b3fcd6a834a4e685feba893c08 Mon Sep 17 00:00:00 2001 From: Tryggvi Larusson Date: Thu, 24 Oct 2024 11:55:24 +0000 Subject: [PATCH 2/3] Updated for specific case for wasm --- file/file_other.go | 13 ++----------- file/file_wasm.go | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 file/file_wasm.go diff --git a/file/file_other.go b/file/file_other.go index 8209e93..13fea5d 100644 --- a/file/file_other.go +++ b/file/file_other.go @@ -1,20 +1,11 @@ -//go:build !windows && !darwin && !dragonfly && !freebsd && !linux && !nacl && !netbsd && !openbsd && !solaris +//go:build !windows && !darwin && !dragonfly && !freebsd && !linux && !nacl && !netbsd && !openbsd && !solaris && !wasm package file import ( "os" - "syscall" ) -func getOSFileInfo(info os.FileInfo) *FileInfo { - fi := &FileInfo{} - if s, ok := info.Sys().(*syscall.Stat_t); ok { - fi.Nlink = uint32(s.Nlink) - fi.UID = s.Uid - fi.GID = s.Gid - fi.Fileid = s.Ino - return fi - } +func getOSFileInfo(_ os.FileInfo) *FileInfo { return nil } diff --git a/file/file_wasm.go b/file/file_wasm.go new file mode 100644 index 0000000..1afe9ec --- /dev/null +++ b/file/file_wasm.go @@ -0,0 +1,20 @@ +//go:build wasm + +package file + +import ( + "os" + "syscall" +) + +func getOSFileInfo(info os.FileInfo) *FileInfo { + fi := &FileInfo{} + if s, ok := info.Sys().(*syscall.Stat_t); ok { + fi.Nlink = uint32(s.Nlink) + fi.UID = s.Uid + fi.GID = s.Gid + fi.Fileid = s.Ino + return fi + } + return nil +} From 3326b4125637bca5ebee418146690a04e731f8ee Mon Sep 17 00:00:00 2001 From: Tryggvi Larusson Date: Thu, 24 Oct 2024 12:03:10 +0000 Subject: [PATCH 3/3] Updated go-billy to v5.6.0 --- go.mod | 6 +++--- go.sum | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 473f687..7ca2152 100644 --- a/go.mod +++ b/go.mod @@ -3,17 +3,17 @@ module github.com/willscott/go-nfs go 1.19 require ( - github.com/go-git/go-billy/v5 v5.5.0 + github.com/go-git/go-billy/v5 v5.6.0 github.com/google/uuid v1.6.0 github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/rasky/go-xdr v0.0.0-20170124162913-1a41d1a06c93 github.com/willscott/go-nfs-client v0.0.0-20240104095149-b44639837b00 github.com/willscott/memphis v0.0.0-20210922141505-529d4987ab7e - golang.org/x/sys v0.16.0 + golang.org/x/sys v0.24.0 ) require ( - github.com/cyphar/filepath-securejoin v0.2.4 // indirect + github.com/cyphar/filepath-securejoin v0.2.5 // indirect github.com/polydawn/go-timeless-api v0.0.0-20220821201550-b93919e12c56 // indirect github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e // indirect github.com/polydawn/rio v0.0.0-20220823181337-7c31ad9831a4 // indirect diff --git a/go.sum b/go.sum index 61a630a..7a82908 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,13 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= +github.com/cyphar/filepath-securejoin v0.2.5 h1:6iR5tXJ/e6tJZzzdMc1km3Sa7RRIVBKAK32O2s7AYfo= +github.com/cyphar/filepath-securejoin v0.2.5/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= +github.com/go-git/go-billy/v5 v5.6.0 h1:w2hPNtoehvJIxR00Vb4xX94qHQi/ApZfX+nBE2Cjio8= +github.com/go-git/go-billy/v5 v5.6.0/go.mod h1:sFDq7xD3fn3E0GOwUSZqHo9lrkmx8xJhA0ZrfvjBRGM= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -51,6 +55,8 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=