Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This port is intentionally malformed and should not be loaded, because ../../a should be loaded instead
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "a",
"version": "0",
"intentionally-malformed"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "a",
"version": "0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$comment": "'config-overlays/a' in . should get loaded first, so we should never consider 'builtin-malformed/a'",
"overlay-ports": [ "config-overlays" ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": [
"a"
]
}
10 changes: 8 additions & 2 deletions azure-pipelines/end-to-end-tests-dir/overlays.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ $manifestInfoPath = Join-Path -Path $vcpkgDir -ChildPath "manifest-info.json"
# Tests a simple project with overlay ports and triplets configured on a vcpkg-configuration.json file
Copy-Item -Recurse -LiteralPath @(
"$PSScriptRoot/../e2e-projects/overlays-malformed-shadowing",
"$PSScriptRoot/../e2e-projects/overlays-malformed-shadowing-builtin",
"$PSScriptRoot/../e2e-projects/overlays-project-config-embedded",
"$PSScriptRoot/../e2e-projects/overlays-project-with-config"
) $TestingRoot
Expand Down Expand Up @@ -40,9 +41,9 @@ try {
--overlay-triplets=$manifestRoot/my-triplets `
--x-install-root=$installRoot `
--triplet fancy-config-embedded-triplet
Throw-IfFailed
Throw-IfFailed
} finally {
popd
popd
}

# Config with bad paths
Expand All @@ -59,6 +60,11 @@ $manifestRoot = "$TestingRoot/overlays-malformed-shadowing"
Run-Vcpkg install --x-manifest-root=$manifestRoot
Throw-IfFailed

# ... even if that subsequent port is the builtin root
$manifestRoot = "$TestingRoot/overlays-malformed-shadowing-builtin"
Run-Vcpkg install --x-manifest-root=$manifestRoot --x-builtin-ports-root "$manifestRoot/builtin-malformed"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before the fix
image

Throw-IfFailed

# Test overlay_triplet paths remain relative to the manifest root after x-update-baseline
$manifestRoot = "$TestingRoot/overlays-project-with-config"
$configurationBefore = Get-Content "$manifestRoot/vcpkg-configuration.json" | ConvertFrom-Json
Expand Down
8 changes: 4 additions & 4 deletions src/vcpkg/portfileprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,14 @@ namespace vcpkg

OverlayPortIndex(const OverlayPortPaths& paths)
{
if (auto builtin_overlay_port_dir = paths.builtin_overlay_port_dir.get())
for (auto&& overlay_port : paths.overlay_ports)
{
m_entries.emplace_back(OverlayPortKind::Directory, *builtin_overlay_port_dir);
m_entries.emplace_back(OverlayPortKind::Unknown, overlay_port);
}

for (auto&& overlay_port : paths.overlay_ports)
if (auto builtin_overlay_port_dir = paths.builtin_overlay_port_dir.get())
{
m_entries.emplace_back(OverlayPortKind::Unknown, overlay_port);
m_entries.emplace_back(OverlayPortKind::Directory, *builtin_overlay_port_dir);
}
}

Expand Down