Skip to content

Commit

Permalink
MONGOCRYPT-685 fix disabling patching and whitespace (#837)
Browse files Browse the repository at this point in the history
* set `patch_disabled` to OFF first

Prevents reading a prior value of `patch_disabled` set in the same scope.

* pass `--ignore-whitespace` to `git apply`

To fix observed issue patching libbson on Windows (without Cygwin).
  • Loading branch information
kevinAlbs authored Jun 17, 2024
1 parent 54f98ea commit 5e49a13
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmake/FetchMongoC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set (MONGOC_FETCH_TAG_FOR_LIBBSON "1.27.1" CACHE STRING "The Git tag of mongo-c-

# Add an option to disable patching if a patch command is unavailable.
option (LIBBSON_PATCH_ENABLED "Whether to apply patches to the libbson library" ON)
set (patch_disabled OFF)
if (NOT LIBBSON_PATCH_ENABLED)
set (patch_disabled ON)
endif ()
Expand Down
1 change: 1 addition & 0 deletions cmake/IntelDFP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ if (NOT INTEL_DFP_LIBRARY_URL_SHA256 STREQUAL "no-verify")
set (_hash_arg URL_HASH "${INTEL_DFP_LIBRARY_URL_HASH}")
endif ()

set (patch_disabled OFF)
if (NOT INTEL_DFP_LIBRARY_PATCH_ENABLED)
set (patch_disabled ON)
endif ()
Expand Down
2 changes: 2 additions & 0 deletions cmake/Patch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ function(make_patch_command out)
if(patch_STRIP_COMPONENTS)
list(APPEND cmd -p${patch_STRIP_COMPONENTS})
endif()
# Ignore whitespace errors to fix patch errors on Windows: The patch file may be converted to \r\n by git, but libbson fetched with \n.
list(APPEND cmd "--ignore-whitespace")
# git accepts patch filepaths as positional arguments
list(APPEND cmd ${patch_PATCHES})
else()
Expand Down

0 comments on commit 5e49a13

Please sign in to comment.