From f1a59d4562c1e9a302675ec0d653351e9f42404d Mon Sep 17 00:00:00 2001 From: DDoSolitary Date: Sun, 23 Aug 2020 20:04:14 +0800 Subject: [PATCH] Patch libarchive to remove path separator conversion. #142 libarchive/libarchive#1430 --- .github/workflows/build.yml | 4 +++ misc/remove-slash-conversion.patch | 47 ++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 misc/remove-slash-conversion.patch diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f2ede2..e4d5d5b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,6 +39,10 @@ jobs: .\bootstrap-vcpkg.bat popd vcpkg integrate install + $portPath = "$Env:VCPKG_INSTALLATION_ROOT\ports\libarchive\" + Copy-Item misc\remove-slash-conversion.patch $portPath + $portfilePath = (Join-Path $portPath portfile.cmake) + (Get-Content $portfilePath) -replace 'PATCHES', 'PATCHES remove-slash-conversion.patch' | Set-Content $portfilePath vcpkg install libarchive boost-program-options boost-format tinyxml2 git fetch --unshallow --tags cmd /c '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" & set' | diff --git a/misc/remove-slash-conversion.patch b/misc/remove-slash-conversion.patch new file mode 100644 index 0000000..1419a28 --- /dev/null +++ b/misc/remove-slash-conversion.patch @@ -0,0 +1,47 @@ +diff --git a/libarchive/archive_windows.c b/libarchive/archive_windows.c +index 624e2700..c923ca9d 100644 +--- a/libarchive/archive_windows.c ++++ b/libarchive/archive_windows.c +@@ -748,41 +748,7 @@ fix_pathseparator(struct archive_entry *entry) + struct archive_entry * + __la_win_entry_in_posix_pathseparator(struct archive_entry *entry) + { +- struct archive_entry *entry_main; +- const wchar_t *wp; +- int has_backslash = 0; +- int ret; +- +- wp = archive_entry_pathname_w(entry); +- if (wp != NULL && wcschr(wp, L'\\') != NULL) +- has_backslash = 1; +- if (!has_backslash) { +- wp = archive_entry_hardlink_w(entry); +- if (wp != NULL && wcschr(wp, L'\\') != NULL) +- has_backslash = 1; +- } +- if (!has_backslash) { +- wp = archive_entry_symlink_w(entry); +- if (wp != NULL && wcschr(wp, L'\\') != NULL) +- has_backslash = 1; +- } +- /* +- * If there is no backslash chars, return the original. +- */ +- if (!has_backslash) +- return (entry); +- +- /* Copy entry so we can modify it as needed. */ +- entry_main = archive_entry_clone(entry); +- if (entry_main == NULL) +- return (NULL); +- /* Replace the Windows path-separator '\' with '/'. */ +- ret = fix_pathseparator(entry_main); +- if (ret < ARCHIVE_WARN) { +- archive_entry_free(entry_main); +- return (NULL); +- } +- return (entry_main); ++ return entry; + } + +