dub icon indicating copy to clipboard operation
dub copied to clipboard

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

Open p0nce opened this issue 1 year ago • 2 comments

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 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.

p0nce avatar Apr 17 '24 14:04 p0nce

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.

WebFreak001 avatar Apr 17 '24 21:04 WebFreak001

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

p0nce avatar Apr 18 '24 11:04 p0nce

>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

Geod24 avatar Jun 10 '24 21:06 Geod24

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.

s-ludwig avatar Jun 11 '24 06:06 s-ludwig

Thanks!!!

p0nce avatar Jun 11 '24 14:06 p0nce