8000 vcpkg_download_distfile no longer downloads files off a network store [with VS2022 version of vcpkg] · Issue #45686 · microsoft/vcpkg · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

vcpkg_download_distfile no longer downloads files off a network store [with VS2022 version of vcpkg] #45686

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

Closed
jblaisdev opened this issue May 24, 2025 · 7 comments
Assignees
Labels
category:question This issue is a question

Comments

@jblaisdev
Copy link
jblaisdev commented May 24, 2025

Describe the bug
Using vcpkg_download_distfile now fails. For example, this network path to an archive file will fail:
URLS file://some/network/path/file.zip

Environment

  • OS: Windows 10
  • Compiler: VS2022 17.14.2

To Reproduce

  1. Simply create a portfile that uses vcpkg_download_distfile as mentioned above

Expected behavior
The download should not fail.

Additional context
I believe the issue was added in Commit 93c2011 and that it can be fixed by reverting the params assignment to use the full download path instead of just the arg_FILENAME. I've tested this change and it works for network archive files as expected again.

Here is a commit with the change, I can issue a pull request if that would be helpful:
master...jblaisdev:vcpkg:master

@dg0yt
Copy link
Contributor
dg0yt commented May 25, 2025

I fail to see a link between source file:// urls and destination filepath changes.

@jblaisdev
Copy link
Author
jblaisdev commented May 25, 2025

I fail to see a link between source file:// urls and destination filepath changes.

Sorry, I should have been more clear. It's not specific to file urls, that's just an easy way to reproduce the issue. If you look at two spots of the script, and assume the download with matching hash does not already exist in the downloads folder:

line 48:
set(downloaded_file_path "${DOWNLOADS}/${arg_FILE 8000 NAME}")

line 117:

vcpkg_list(SET params "x-download" "${arg_FILENAME}")
foreach(url IN LISTS arg_URLS)
    vcpkg_list(APPEND params "--url=${url}")
endforeach()

Only the filename of each URL is being appended to the params variable now, and that variable is later used in a call to vcpkg_execute_in_download_mode, which will understandably fail. Commit 93c2011 changed downloaded_file_path to arg_FILENAME on line 117 which causes the issue. Changing it back will fix the reported issue.

@dg0yt
Copy link
Contributor
dg0yt commented May 25, 2025

But it works for everyone else, doesn't it? There are 400 calls to this function in vcpkg ports, for tools, sources and patches.

I don't want to say there couldn't be a problem. But maybe the focus needs to be shifted towards your environment instead. Did you re-run bootstrap after updating your git checkout? Check your vcpkg tool version. It is also included in the issue_body.md created for most build failures.

@jblaisdev
Copy link
Author
jblaisdev commented May 25, 2025

Presumably it does, but yes that's a good point - it could be an environmental issue. The system that's failing is using vcpkg that's integrated with VS2022 (v17.14.2) and everything worked before the VS update (which AFAIK included the above mentioned changes to vcpkg_download_distfile). Next week I'll setup a test repository on a fresh vcpkg clone and dig deeper into what's going on.

@Cheney-W Cheney-W added the category:question This issue is a question label May 26, 2025
@jblaisdev
Copy link
Author
jblaisdev commented May 28, 2025

I'm able to reproduce this issue in a clean environment. I've also setup a test repository that can be used to replicate the issue here:
https://github.com/jblaisdev/ddtest, which should be testable as long as someone has access to any network storage location which they can access via UNC paths.

The README includes steps to use a fresh Windows Sandbox environment and new install of the latest VS2022 (17.14.2 at the time of writing) and vcpkg that ships with Visual Studio. Following the steps in the README should lead to download failure; making the single cmake script change mentioned in the README should then allow the download to complete successfully.

Anyone who can test this, or offer some advice of what to check next would be greatly appreciated.

If helpful, these are the variable values sent into the script at the time of the call:

arg_FILENAME: ddtest-1.0.0.zip
downloaded_file_path: C:/Users/WDAGUtilityAccount/AppData/Local/vcpkg/downloads/ddtest-1.0.0.zip
DOWNLOADS: C:/Users/WDAGUtilityAccount/AppData/Local/vcpkg/downloads
VCPKG_COMMAND: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/vcpkg/vcpkg.exe

When arg_FILENAME is used to build params (currently failing), params looks like this:

x-download;ddtest-1.0.0.zip;--url=file://server/path/to/archive/ddtest-1.0.0.zip;--sha512=

When downloaded_file_path is used to build params (working on test repo), params it looks like this:

x-download;C:/Users/WDAGUtilityAccount/AppData/Local/vcpkg/downloads/ddtest-1.0.0.zip;--url=file://server/path/to/archive/ddtest-1.0.0.zip;--sha512=

The params variable is then used in vcpkg_execute_in_download_mode.cmake in a cmake_language CALL with these variables:

Z_VCPKG_EXECUTE_PROCESS_NAME: execute_process
arg_UNPARSED_ARGUMENTS: COMMAND;C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/vcpkg/vcpkg.exe;<params-argument-from-above>;WORKING_DIRECTORY;C:/Users/WDAGUtilityAccount/AppData/Local/vcpkg/downloads

I haven't dug into vcpkg-tools, but from a quick glace it looks like vcpkg-tool/src/vcpkg/base/files.cpp::Filesystem::create_directories is possibly being asked to create an empty string when it fails:

create_directories(""): The system cannot find the path specified.

@jblaisdev jblaisdev changed the title vcpkg_download_distfile no longer downloads files off a network store vcpkg_download_distfile no longer downloads files off a network store [with VS2022 version of vcpkg] May 29, 2025
@jblaisdev
Copy link
Author

I've verified that this is a bug in the version of vcpkg that ships with Visual Studio 2022 17.14.2 and 17.14.3. The needed fix has been added to vcpkg-tool and I verified it fixes the issue:

autoantwort/vcpkg-tool@309b951b

The fix will presumably be in the next release of VS (17.14.4). I'll close this issue and retest again in the future once 17.14.4 is released. Thanks for your feedback @dg0yt!

@dg0yt
Copy link
Contributor
dg0yt commented May 29, 2025

Thanks for the feedback.

Let me add the trace to the first reported issue:
autoantwort/vcpkg-tool@309b951b -> microsoft/vcpkg-tool#1639 -> #44832 (comment).
Really only for some remote locations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:question This issue is a question
Projects
None yet
Development

No branches or pull requests

3 participants
0