fix double adding of additional_files_0...#1901
fix double adding of additional_files_0...#1901TobiasFunk wants to merge 1 commit intomicrosoft:mainfrom
Conversation
| // Note: hash_additional_files are triplet-specific, not port-specific, | ||
| // so they are processed outside this cache lambda (see lines 1474-1488) |
There was a problem hiding this comment.
should still run through per port customization though. Maybe add a testcase which shows the issue.
There was a problem hiding this comment.
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
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
|
It looks like the double adding was added by accident as part of #802 ; probably from merge conflict hell since that PR went on for so long. |
Alternative to microsoft#1901 When microsoft#802 tried to add per-directory caching of hashed contents, the additional files part got added multiple times by accident.
|
Closing due to being replaced by #1914 . Thanks for your contribution! |
Should fix #1900 but i'm not sure if i would break an additional feature (this is why i first draft the PR)
As already commented in the ticket:
There are two places where hash_additional_files are added to abi_tag_entries:
Lines 1425-1435 (INCORRECT): Inside the port_dir_cache.get_lazy() lambda, the code adds entries directly to abi_tag_entries:
Lines 1474-1488 (CORRECT): After retrieving the cache entry, the code adds the same entries again:
Why This Causes Inconsistent Behavior
First package built (cache miss): The lambda at lines 1409-1468 executes, and line 1432 incorrectly adds additional_file_* to abi_tag_entries. Then line 1486 adds them again → double entries.
Second package with same port_dir (cache hit): The lambda doesn't execute (cache hit), so only line 1486 runs → single entry.