Skip to content

[vcpkg_execute_required_process] check log file existence before reading#18290

Closed
alberthdev wants to merge 1 commit intomicrosoft:masterfrom
alberthdev:master
Closed

[vcpkg_execute_required_process] check log file existence before reading#18290
alberthdev wants to merge 1 commit intomicrosoft:masterfrom
alberthdev:master

Conversation

@alberthdev
Copy link
Copy Markdown
Contributor

@alberthdev alberthdev commented Jun 6, 2021

Check for the output log file existence before trying to read it.

This edge case was hit in this scenario: if the command critically fails (e.g. the executable doesn't exist), the stdout file may be missing. When this occurs, CMake stops prematurely due to not being able to read the missing file.

Sample output of the behavior being addressed:

Building package fdlibm[core]:x86-windows...
-- Fetching https://android.googlesource.com/platform/external/fdlibm...
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:91 (file):
  file failed to open for reading (No such file or directory):

    D:/a/github-actions-test/github-actions-test/vcpkg/buildtrees/fdlibm/git-init-x86-windows-out.log
Call Stack (most recent call first):
  scripts/cmake/vcpkg_from_git.cmake:85 (vcpkg_execute_required_process)
  ports/fdlibm/portfile.cmake:1 (vcpkg_from_git)
  scripts/ports.cmake:139 (include)

Desired behavior instead is to have this output its error message on process failure. Expected output instead:

-- Fetching https://android.googlesource.com/platform/external/fdlibm...
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:109 (message):
    Command failed: "C:/Program Files/Git/bin/git.exe" init git-tmp
    Working Directory: D:/a/github-actions-test/github-actions-test/vcpkg/downloads
    Error code: The system cannot find the file specified
    See logs for more information:

Call Stack (most recent call first):
  scripts/cmake/vcpkg_from_git.cmake:85 (vcpkg_execute_required_process)
  ports/fdlibm/portfile.cmake:1 (vcpkg_from_git)
  scripts/ports.cmake:139 (include)

Describe the pull request

  • What does your PR fix?

    Helps with debugging issues reported in vcpkg_from_git fails when downloads folder does not exist #18291 - mainly addresses the above corner case and allows failing gracefully from it.

  • Which triplets are supported/not supported? Have you updated the CI baseline?

    Supported for all (no specific platform changes here), No

  • Does your PR follow the maintainer guide?

    Yes

  • If you have added/updated a port: Have you run ./vcpkg x-add-version --all and committed the result?

    Not applicable

Leaving as draft PR for now until discussion on this completes in related issue: #18291. Uncertain if this is the "right" place to fix this, or if the problem itself (not writing stdout on critical errors) needs to be addressed elsewhere.

Check for the output log file existence before trying to read it. This
edge case was hit in this scenario: if the command critically fails
(e.g. the executable doesn't exist), the stdout file may be missing.
When this occurs, CMake stops prematurely due to not being able to
read the missing file. Desired behavior instead is to have this output
its error message on process failure.
@PhoebeHui PhoebeHui added the category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly label Jun 7, 2021
@dg0yt dg0yt mentioned this pull request Jun 8, 2021
@PhoebeHui
Copy link
Copy Markdown
Contributor

@PhoebeHui PhoebeHui closed this Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants