dub
dub copied to clipboard
Erased version specification for dependency, converted to "" instead of ">0.0.0"
System information
- dub version: DUB version 1.35.1, built on Jan 6 2024
- OS Platform and distribution: Windows 11
- compiler version ldc2-1.36.0-windows-multilib
Bug Description
I'm using the numem package, who has an optional dependency on tinyd-rt
In its dub.sdl:
dependency "tinyd-rt" version=">0.0.0" optional=true
But on build: it says
Indeed the version specification is converted in the DUB own directory to this JSON:
The dependency has no more version specifier, it seems it got lost in the conversion.
How to reproduce?
Clone the yxml package and try to dub upgrade:
https://github.com/AuburnSounds/yxml
Expected Behavior
A pristine and preserved version specification.
does it work if you change it to "*"?
The error probably appears because >0.0.0 is not a valid format, you probably meant >=0.0.0 - however dub should show an issue for this.
See https://dub.pm/dub-reference/dependencies/ for valid version syntaxes and what they mean.
It's not my package, and I think DUB should reject invalid version specifications.
>0.0.0 is a valid format, although slightly useless: https://devhints.io/semver
@WebFreak001 looks like your documentation is incomplete, it does not include >=1.0.0 <2.0.0 for example.
https://github.com/dlang/dub/blob/a91307124eaa87d0fbdf47a5766c21ad00dfc4f3/source/dub/dependency.d#L1037-L1110
I wonder if Version.minRelease shouldn't be "0.0.0-0" instead of just "0.0.0", as that is really the lowest representable version. Also, the condition for determining whether to add a ">" part and a "<" part during the string conversion seems a little bit off and I'd say they should include a || !m_inclusiveA / || !m_inclusiveB addition respectively.
Also, although is may be less likely to be a problem, Version.maxRelease ("99999.0.0") is completely arbitrary and doesn't seem like a meaningful constant.
Thanks!!!