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

Unexpected debug.ModuleVersion output in debug logs #2959

Open
AnomalRoil opened this issue Oct 2, 2024 · 1 comment
Open

Unexpected debug.ModuleVersion output in debug logs #2959

AnomalRoil opened this issue Oct 2, 2024 · 1 comment
Assignees
Labels
bug Defects
Milestone

Comments

@AnomalRoil
Copy link
Member

Summary

It seems we might be invoking the debug.ModuleVersion function on a wrong backend here:

// Version returns the version of this backend.
func (s *Store) Version(context.Context) semver.Version {
return debug.ModuleVersion("github.com/gopasspw/gopass/internal/backend/fs")
}

But I'm not sure I understand what it's supposed to do and how it works, so maybe that's expected on a local dev branch and should only be correct in releases?

Steps To Reproduce

export GOPASS_HOMEDIR=/tmp/gopasstest
export GOPASS_DEBUG_LOG=init.log
gopass init --crypto age test
<should crash because test is not a good key>
cat init.log | grep backend

This should contain the following logs roughly

2024/10/02 21:15:02.558600 leaf/store.go:52	leaf.New	Instantiating "" at "/tmp/gopasstest3/.local/share/gopass/stores/root"
2024/10/02 21:15:02.558608 backend/storage.go:66	backend.DetectStorage	Failed to use requested gitfs for /tmp/gopasstest3/.local/share/gopass/stores/root: git repo does not exist at /tmp/gopasstest3/.local/share/gopass/stores/root/.git
2024/10/02 21:15:02.558614 backend/storage.go:73	backend.DetectStorage	Using fallback "fs" for "/tmp/gopasstest3/.local/share/gopass/stores/root"
2024/10/02 21:15:02.558654 debug/version.go:34	debug.ModuleVersion	no module github.com/gopasspw/gopass/internal/backend/fs found
2024/10/02 21:15:02.558659 fs/loader.go:29	fs.loader.New	Using Storage Backend: fs(0.0.0,path:/tmp/gopasstest3/.local/share/gopass/stores/root)
2024/10/02 21:15:02.558682 debug/version.go:34	debug.ModuleVersion	no module github.com/gopasspw/gopass/internal/backend/fs found
2024/10/02 21:15:02.558664 leaf/store.go:64	leaf.New	Storage for  => /tmp/gopasstest3/.local/share/gopass/stores/root initialized as fs(0.0.0,path:/tmp/gopasstest3/.local/share/gopass/stores/root)
2024/10/02 21:15:02.558690 age/loader.go:23	age.loader.New	Using Crypto Backend: age

Expected behavior

I expect not to see the lines about

debug.ModuleVersion	no module github.com/gopasspw/gopass/internal/backend/fs found

But when I try to correct the code to use github.com/gopasspw/gopass/internal/backend/storage/fs instead, which seems to exist:

import _ "github.com/gopasspw/gopass/internal/backend/storage/fs" // register fs backend

it also doesn't work.

Environment

  • OS: Ubuntu 22.04
  • OS version: Linux 6.9.3-76060903-generic
  • gopass Version: master
  • Installation method: go build
@dominikschulz
Copy link
Member

return debug.ModuleVersion("github.com/gopasspw/gopass/internal/backend/fs") is almost certainly wrong. But I wonder why it doesn't work with the correct module. Maybe it never properly worked ...

@dominikschulz dominikschulz added the bug Defects label Oct 5, 2024
@dominikschulz dominikschulz added this to the 1.x.x milestone Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Defects
Projects
None yet
Development

No branches or pull requests

2 participants