Skip to content
Closed
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
16 changes: 2 additions & 14 deletions src/vcpkg/commands.build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1419,20 +1419,8 @@ namespace vcpkg
port_dir_cache_entry.files = std::move(rel_port_files);
}
const auto& rel_port_files = port_dir_cache_entry.files;
// Technically the pre_build_info is not part of the port_dir cache key, but a given port_dir is only going
// to be associated with 1 port
for (size_t i = 0; i < abi_info.pre_build_info->hash_additional_files.size(); ++i)
{
const auto& file = abi_info.pre_build_info->hash_additional_files[i];
if (file.is_relative() || !fs.is_regular_file(file))
{
Checks::msg_exit_with_message(
VCPKG_LINE_INFO, msgInvalidValueHashAdditionalFiles, msg::path = file);
}
abi_tag_entries.emplace_back(
fmt::format("additional_file_{}", i),
Hash::get_file_hash(fs, file, Hash::Algorithm::Sha256).value_or_exit(VCPKG_LINE_INFO));
}
// Note: hash_additional_files are triplet-specific, not port-specific,
// so they are processed outside this cache lambda (see lines 1474-1488)
Comment on lines +1422 to +1423
Copy link
Contributor

Choose a reason for hiding this comment

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

should still run through per port customization though. Maybe add a testcase which shows the issue.

Copy link
Author

Choose a reason for hiding this comment

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

i think this comment is a bit misleading, i will remove it

this is my first change in this project, and i feel a bit uncomfortable to do the change by myself as i have not a complete picture in the project, for me the PR was more about to show the issue, but this was going wrong in this case :D

So i understand your comment. Per port customizations should be untouched by the change. Adding a test is hard as nearly no function is accessible for the test..

The problem is actual really simple.
When using a response file you can install the same port for different triplets

gtest
gtest:our-x86-windows-static

the first entry use the triplet from vcpkg command, the second the port mentioned in the response file. If the triplet has now a VCPKG_HASH_ADDITIONAL_FILES variable, the first entry was adding the VCPKG_HASH_ADDITIONAL_FILES to the
port_dir_cache_entry & to the abi_tag_entries +1422 to +1423
-> as i'm not 100% sure perhaps it is better to actual add it to port_dir_cache_entry.abi_entries

between +1472 to

this code is doing this as well, so actual the action for the first port is doubled (can be easily retested with some port have VCPKG_HASH_ADDITIONAL_FILES)

you will get additional_file_0 xxx 2 times, always

the second port now runs the code again in same vcpkg.exe instance, as the port_dir_cache_entry is already filled, the removed code was skipped and was resulting in additional_file_0 xxx once

This is a problem with my cache
as now

vcpkg install gtest:our-x64-windows-static --overlay-triplet=xxx
vcpkg install gtest:our-x86-windows-static --overlay-triplet=xxx

and
vcpkg install --triplet=our-x64-windows-static --overlay-triplet=xxx @responefile

results in different abi for gtest:our-x86-windows-static


for (const Path& rel_port_file : rel_port_files)
{
Expand Down
Loading