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

path/filepath: Glob doesn't match file on fuse.smbnetfs filesystem #66628

Open
tomamplius opened this issue Mar 31, 2024 · 0 comments
Open

path/filepath: Glob doesn't match file on fuse.smbnetfs filesystem #66628

tomamplius opened this issue Mar 31, 2024 · 0 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@tomamplius
Copy link

tomamplius commented Mar 31, 2024

Go version

go version go1.22.1 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/root/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/root/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.1'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/tmp/photoprism/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4256707123=/tmp/go-build -gno-record-gcc-switches'

What did you do?

I execute the bellow code to check 3 tests

test A : Check standard path in smbnetfs folder
test B : Check with escapes path in smbnetfs folder (with the same file use in test A )
test C : Check with escapes path not in smbnetfs folder (add z to network folder)

package main
import (
        "fmt"
        "path/filepath"
        "regexp"
)

func main() {
    file :="/var/lib/photoprism/network/data.lan.lgy.fr/ftcl/photos/2023/01-janviere/friends/PXL_20230119_184113352."
    file2 :="/var/lib/photoprism/znetwork/data.lan.lgy.fr/ftcl/photos/2023/01-janviere/friends/PXL_20230119_184113352."
    a, _ := filepath.Glob(file + "*")
    fmt.Println(file,a)

    globPattern := regexp.QuoteMeta(file) + "*"
    b, _ := filepath.Glob(globPattern)
    fmt.Println(globPattern, b)

    globPattern2 := regexp.QuoteMeta(file2) + "*"
    c, _ := filepath.Glob(globPattern2)
    fmt.Println(globPattern2, c)
}

On my environnement i have smbnetfs mount on /var/lib/photoprism/network

photoprism@photoprism:/opt/photoprism/bin$ grep smbnetfs /etc/mtab 
smbnetfs /var/lib/photoprism/network fuse.smbnetfs rw,nosuid,nodev,relatime,user_id=997,group_id=997 0 0

I check the same test in the bash and the three case return one file

photoprism@photoprism:/opt/photoprism/bin$ ls /var/lib/photoprism/network/data.lan.lgy.fr/ftcl/photos/2023/01-janviere/friends/PXL_20230119_184113352.*
/var/lib/photoprism/network/data.lan.lgy.fr/ftcl/photos/2023/01-janviere/friends/PXL_20230119_184113352.jpg
photoprism@photoprism:/opt/photoprism/bin$ ls /var/lib/photoprism/znetwork/data\.lan\.lgy\.fr/ftcl/photos/2023/01-janviere/friends/PXL_20230119_184113352\.*
/var/lib/photoprism/znetwork/data.lan.lgy.fr/ftcl/photos/2023/01-janviere/friends/PXL_20230119_184113352.jpg
photoprism@photoprism:/opt/photoprism/bin$ ls /var/lib/photoprism/network/data\.lan\.lgy\.fr/ftcl/photos/2023/01-janviere/friends/PXL_20230119_184113352\.*
/var/lib/photoprism/network/data.lan.lgy.fr/ftcl/photos/2023/01-janviere/friends/PXL_20230119_184113352.jpg

What did you see happen?

Test B return no file

/var/lib/photoprism/network/data.lan.lgy.fr/ftcl/photos/2023/01-janviere/friends/PXL_20230119_184113352. [/var/lib/photoprism/network/data.lan.lgy.fr/ftcl/photos/2023/01-janviere/friends/PXL_20230119_184113352.jpg]
/var/lib/photoprism/network/data\.lan\.lgy\.fr/ftcl/photos/2023/01-janviere/friends/PXL_20230119_184113352\.* []
/var/lib/photoprism/znetwork/data\.lan\.lgy\.fr/ftcl/photos/2023/01-janviere/friends/PXL_20230119_184113352\.* [/var/lib/photoprism/znetwork/data.lan.lgy.fr/ftcl/photos/2023/01-janviere/friends/PXL_20230119_184113352.jpg]

What did you expect to see?

test A and test B need to return the same result because we check the same file
Test C confirm that is work with escapes

@seankhliao seankhliao changed the title path/filepath with fuse.smbnetfs path/filepath: Glob doesn't match file on fuse.smbnetfs filesystem Apr 1, 2024
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

2 participants