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

Fix version parsing #50

Merged
merged 2 commits into from
Aug 26, 2023
Merged
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
2 changes: 1 addition & 1 deletion incusd/storage/drivers/driver_zfs_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func (d *zfs) version() (string, error) {
// This function is only really ever relevant on Ubuntu as the only
// distro that ships out of sync tools and kernel modules
out, err := shared.RunCommand("dpkg-query", "--showformat=${Version}", "--show", "zfsutils-linux")
if err == nil {
if out != "" && err == nil {
return strings.TrimSpace(string(out)), nil
}

Expand Down
2 changes: 1 addition & 1 deletion shared/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func Parse(s string) (*DottedVersion, error) {

matches := r.FindStringSubmatch(s)
if len(matches) == 0 {
return nil, fmt.Errorf("Can't parse a version")
return nil, fmt.Errorf("Can't parse a version: %s", s)
}

return NewDottedVersion(matches[1])
Expand Down
Loading