dlang / dub

Package and build management system for D
MIT License
661 stars 227 forks source link

Erased version specification for dependency, converted to "" instead of ">0.0.0" #2901

Closed p0nce closed 2 weeks ago

p0nce commented 2 months ago

System information

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 image

Indeed the version specification is converted in the DUB own directory to this JSON:

image

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.

WebFreak001 commented 2 months ago

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.

p0nce commented 2 months ago

It's not my package, and I think DUB should reject invalid version specifications.

Geod24 commented 2 weeks ago

>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

s-ludwig commented 2 weeks ago

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.

p0nce commented 2 weeks ago

Thanks!!!