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

v1.30.0 dependency resolution regression with subpackages in dependency #2587

Closed
WebFreak001 opened this issue Feb 12, 2023 · 4 comments · Fixed by #2591
Closed

v1.30.0 dependency resolution regression with subpackages in dependency #2587

WebFreak001 opened this issue Feb 12, 2023 · 4 comments · Fixed by #2591

Comments

@WebFreak001
Copy link
Member

WebFreak001 commented Feb 12, 2023

Reproduction:

// a/dub.json
{
        "name": "a",
        "dependencies": {
                "b": {"path":"../b"}
        }
}
// b/dub.json
{
        "name": "b",
        "dependencies": {
                "b:sub":"*"
        },
        "subPackages": [
                {
                        "name": "sub",
                        "dependencies": {
                                "c": {"path":"../c"}
                        }
                }
        ]
}
// c/dub.json
{
        "name": "c"
}

In b the subpackage can be embedded in the recipe or standalone, it doesn't matter for the upgrade bug.

Trying to run dub upgrade in a causes

Error Unresolvable dependencies to package c:
  b:sub @/tmp/repr/b depends on c @/tmp/repr/c

Worked with 1.29.2 and before.

@WebFreak001
Copy link
Member Author

introduced by 65fb2fa @Geod24

@WebFreak001
Copy link
Member Author

readding toHash does not seem to fix this in current stable branch

@WebFreak001
Copy link
Member Author

when readding toHash in the git history, 4e86806 seems to be the introducing commit

@WebFreak001
Copy link
Member Author

possible factor: toHash + opEquals used to only check on the version range, ignoring path and repo based values - this might be altering the internal AA state

Additional weirdness: packages in dub.d getPackageRaw (name, dep) don't match:

old working calls:

getPackageRaw: a ~master
getPackageRaw: b ~master
getPackageRaw: a >=0.0.0 @/home/webfreak/dev/dub/test/issue2587-subpackage-dependency-resolution/b
getPackageRaw: b >=0.0.0 @/home/webfreak/dev/dub/test/issue2587-subpackage-dependency-resolution/b
getPackageRaw: b:sub >=0.0.0 @/home/webfreak/dev/dub/test/issue2587-subpackage-dependency-resolution/b
getPackageRaw: c ~master
getPackageRaw: c >=0.0.0 @/home/webfreak/dev/dub/test/issue2587-subpackage-dependency-resolution/c

new broken calls:

getPackageRaw: a ~master
getPackageRaw: b ~master
getPackageRaw: a @/home/webfreak/dev/dub/test/issue2587-subpackage-dependency-resolution/b
getPackageRaw: b @/home/webfreak/dev/dub/test/issue2587-subpackage-dependency-resolution/b
getPackageRaw: b:sub @/home/webfreak/dev/dub/test/issue2587-subpackage-dependency-resolution/b
getPackageRaw: c ~master
getPackageRaw: b:sub @/home/webfreak/dev/dub/test/issue2587-subpackage-dependency-resolution/c
getPackageRaw: b @/home/webfreak/dev/dub/test/issue2587-subpackage-dependency-resolution/c

although there is also weirdness in both versions, that a would search inside the b folder, now it looks like b and b:sub also search both in the b and the c folder

WebFreak001 referenced this issue Feb 12, 2023
A major issue when dealing with the 'Dependency' type is that it evolved from a simple type,
which stored a version range and perhaps one or two boolean,
to one that stores 4 kinds of dependencies: version range (including exact version),
branches, repository + hash, and path.
Instead of using a discrete type (e.g. a tagged union), the type is a mix of style,
and repository and branch are piggybacking on the field used for the version range.

Switching to std.sumtype makes interaction between fields more obvious.
Most importantly, it forces the programmer to answer the hard questions,
such as how do we compare completely different dependency (version vs repository).

Hopefully this will make the code easier to understand, and in the future,
make it easier to add a new kind of dependency.
WebFreak001 added a commit to WebFreak001/dub that referenced this issue Feb 12, 2023
WebFreak001 added a commit to WebFreak001/dub that referenced this issue Feb 12, 2023
@ibuclaw ibuclaw mentioned this issue Feb 13, 2023
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.

1 participant