Skip to content

Commit

Permalink
Patch libarchive to remove path separator conversion.
Browse files Browse the repository at this point in the history
  • Loading branch information
DDoSolitary committed Aug 23, 2020
1 parent 93a24a0 commit f1a59d4
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' |
Expand Down
47 changes: 47 additions & 0 deletions misc/remove-slash-conversion.patch
Original file line number Diff line number Diff line change
@@ -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;
}


0 comments on commit f1a59d4

Please sign in to comment.