[tools] Fix missing executable permission on downloaded tools for Unix#1911
Merged
BillyONeal merged 1 commit intomicrosoft:mainfrom Feb 11, 2026
Merged
Conversation
BillyONeal
requested changes
Feb 10, 2026
On macOS/Linux, tools downloaded by `download_tool()` could lack the executable bit, causing "Permission denied" when vcpkg attempts to run them. This affects both raw binary downloads (e.g., coscli) and some archive extractions (e.g., powershell-core .tar.gz) where permissions are lost during the extract-and-rename process. Add `Filesystem::set_executable()` virtual method that calls chmod 0755 on Unix and is a no-op on Windows. Call it in `download_tool()` before returning the exe path, consistent with the CMake-side handling in `vcpkg_find_acquire_program.cmake` and `bootstrap.sh`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
639cab2 to
7329941
Compare
BillyONeal
added a commit
to BillyONeal/vcpkg
that referenced
this pull request
Feb 18, 2026
https://github.com/microsoft/vcpkg-tool/releases/tag/2026-02-17 Meaningful changes: * Test/fix internal dependencies in top level manifest. by @dg0yt in microsoft/vcpkg-tool#1890 * dependencies.cpp optimizations by @dg0yt in microsoft/vcpkg-tool#1891 * Switch default Ninja minimal version to a reasonable value by @cqundefine in microsoft/vcpkg-tool#1897 * Install files in parallel, redux by @BillyONeal in microsoft/vcpkg-tool#1896 * [tools] Fix missing executable permission on downloaded tools for Unix by @zynfly in microsoft/vcpkg-tool#1911 * Use libcurl rather than curl command line by @BillyONeal in microsoft/vcpkg-tool#1906 * Deduplicate "additional_file" in abi info. by @BillyONeal in microsoft/vcpkg-tool#1914 * Clamp invalid elapsed time instead of crashing in track_elapsed_us by @clee704 in microsoft/vcpkg-tool#1918
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On macOS/Linux, tools downloaded by
download_tool()insrc/vcpkg/tools.cppcan lack the executable bit (0644instead of0755), causingPermission denied(exit code 126) when vcpkg immediately attempts to run the tool to determine its version.This affects:
cosclion macOS/Linux always gets0644from HTTP downloadpowershell-core.tar.gzloses execute permission during the extract-to-temp-then-rename processThe PowerShell Core cross-platform tool support was recently introduced in microsoft/vcpkg#49910, adding
powershell-coreentries for macOS and Linux tovcpkg-tools.json. This makes the permission issue more visible, asvcpkg fetch powershell-corenow fails on these platforms without this fix.The CMake-side equivalent (
vcpkg_find_acquire_program.cmake) already handles this correctly viaFILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE ..., but the C++download_tool()path had no such handling.Fix
Add
chmod(exe_path, 0755)beforereturn exe_pathindownload_tool(), covering both the raw-binary and archive code paths in a single call. The helper is gated behind#if !defined(_WIN32)and usesDebug::printlnfor non-fatal failure reporting.Changes are confined to a single file (
src/vcpkg/tools.cpp, +18 lines).Test Results
Tested on macOS arm64 by comparing
vcpkg fetch <tool>between the unpatched and patched binaries after clearing tool caches:0644— Permission denied0755— OK0644— Permission denied0755— OK0755— OK (preserved)0755— OK0755— OK (preserved)0755— OKConsistency
This follows the same "chmod at placement time" pattern used throughout the vcpkg ecosystem:
vcpkg_find_acquire_program.cmake—file(COPY ... FILE_PERMISSIONS OWNER_EXECUTE ...)bootstrap.sh—chmod +xbeforemvapplocal.py—chmod 755after copying dependencies