Skip to content

Commit

Permalink
Check .csh and .pl for absolute paths (microsoft#1426)
Browse files Browse the repository at this point in the history
* Check .csh and .pl for absolute paths

* e2e test absolute path policy on script files
  • Loading branch information
dg0yt authored Jun 17, 2024
1 parent 2e27bc7 commit c5e532a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ endif()
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include")
file(WRITE "${CURRENT_PACKAGES_DIR}/include/vcpkg-policy-absolute-paths.h" "${PROBLEM_TEXT}")

file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
file(WRITE "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin/port-config.sh" "${PROBLEM_TEXT}")

if("policy" IN_LIST FEATURES)
set(VCPKG_POLICY_SKIP_ABSOLUTE_PATHS_CHECK enabled)
endif()
1 change: 1 addition & 0 deletions azure-pipelines/end-to-end-tests-dir/post-build-checks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,7 @@ note: Absolute paths were found in the following files
$($packagesRoot)$($NativeSlash)vcpkg-policy-absolute-paths_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here
note: include/vcpkg-policy-absolute-paths.h
note: share/pkgconfig/vcpkg-policy-absolute-paths.pc
note: tools/vcpkg-policy-absolute-paths/bin/port-config.sh
"@

foreach ($bad_dir in @('build-dir', 'downloads', 'installed-root', 'package-dir')) {
Expand Down
2 changes: 1 addition & 1 deletion src/vcpkg/postbuildlint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,7 @@ namespace vcpkg
}

if (extension == ".py" || extension == ".sh" || extension == ".cmake" || extension == ".pc" ||
extension == ".conf")
extension == ".conf" || extension == ".csh" || extension == ".pl")
{
const auto contents = fs.read_contents(file, IgnoreErrors{});
return Strings::contains_any_ignoring_hash_comments(contents, searcher_paths);
Expand Down

0 comments on commit c5e532a

Please sign in to comment.