Version parsing failure in unikraft.go discards underlying error detail
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 85/100
Research direction
Open pkg/unikontainers/unikernels/unikraft.go and start at the version.NewVersion error branch. Preserve the existing fallback behavior while checking that the returned error retains both the sentinel and parsing detail. Run the relevant Go tests, if available, and confirm callers can still identify ErrVersionParsing.
Written by the indexing model from the issue text.
Description
In pkg/unikontainers/unikernels/unikraft.go:
unikernelVersion, err := version.NewVersion(u.Version)
if err != nil {
setCurrentArgs()
return ErrVersionParsing
}
Right now, when the version string fails to parse, urunc throws away the actual parsing error and just returns a generic ErrVersionParsing. So you can see that something failed, but not why, was the string empty, malformed, using the wrong separator, etc.
There's already a fallback (setCurrentArgs()) that kicks in, so it doesn't break anything but it makes it harder than necessary to identify when the version string is invalid.
hashicorp/go-version returns ordinary errors rather than typed or sentinel errors, so errors.Is/errors.As cannot be used to distinguish the failure reason. Wrapping the original error preserves both the existing sentinel and the parsing details:
- return ErrVersionParsing
+ return fmt.Errorf("%w: %w", ErrVersionParsing, err)
This keeps errors.Is(err, ErrVersionParsing) working for callers while exposing the underlying parse error in the returned message. The fallback behavior remains unchanged because setCurrentArgs() is still executed.
Related: #884
- Dominant language
- Go
- Stars
- 298
- Forks
- 202
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 28
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from urunc-dev/urunc
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
do-not-merge invalid
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·