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

dub add breaks ~>x.0 dependency specification #2830

Closed
ArthaTi opened this issue Jan 24, 2024 · 1 comment · Fixed by #2928
Closed

dub add breaks ~>x.0 dependency specification #2830

ArthaTi opened this issue Jan 24, 2024 · 1 comment · Fixed by #2928

Comments

@ArthaTi
Copy link

ArthaTi commented Jan 24, 2024

System information

  • dub version: 1.32.0
  • OS Platform and distribution: ArchLinux 6.6.8-zen1-1-zen
  • compiler version v2.106.0

Bug Description

DUB documentation specifies the two version specifications ~>a.b and ~>a.b.c, where the former accepts any minor and patch release since a.b.0, and the latter accepts any patch release since a.b.c. The documentation does not define any behavior for specification ~>a like ~>5.

DUB appears to incorrectly reformat any version specification following the ~>a.b format, if the minor version is specified to be 0, to the ~>a format. Since behavior of this format is undocumented, it is unclear how it is to be understood — would ~>5 also include version 6.0.0 or not?

How to reproduce?

Add a dependency and set the version specification. For example:

{
	"authors": [
		"artha"
	],
	"dependencies": {
		"raylib-d": "~>5.0"
	},
	"description": "A minimal D application.",
	"license": "proprietary",
	"name": "dubtest"
}

Add any other dependency with dub add, for example dub add fluid. The package will be reformatted, and the previously added dependency, which in this example is raylib-d, will have the "dot zero" part removed.

Expected Behavior

The version specifier should stay as is, with minor version preserved. DUB should reject the major-only specification ~>a as invalid.

Logs

Using dub registry url 'https://code.dlang.org/'
Note: Failed to determine version of package dubtest at .. Assuming ~master.
  Version selection for dependency raylib-d (raylib-d) of dubtest is missing.
  Missing dependency raylib-d ~>5 of dubtest
             Adding dependency fluid >=0.6.0-alpha <0.7.0-0
Geod24 added a commit to Geod24/dub that referenced this issue Jun 11, 2024
Dub was correct in outputting only the major version,
however this can lead to some confusion for users
as pointed out in dlang#2830. Accepting ~>5 but only exposing
two states (~>5.0 and ~>5.0.0) will hopefully make
things a bit more obvious.
@Geod24
Copy link
Member

Geod24 commented Jun 11, 2024

This is not a bug, but should probably be changed regardless: #2928

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants