File tree Expand file tree Collapse file tree 4 files changed +38
-1
lines changed
Expand file tree Collapse file tree 4 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -612,6 +612,8 @@ jobs:
612612
613613 env :
614614 PY_COLORS : 1
615+ MSYS2_ARG_CONV_EXCL : " *"
616+ MSYS2_ENV_CONV_EXCL : " *"
615617
616618 defaults :
617619 run :
Original file line number Diff line number Diff line change @@ -328,6 +328,29 @@ Install the dependencies with the provided script::
328328
329329 ./scripts/msys2-install-deps
330330
331+ .. _msys2_path_translation :
332+
333+ MSYS2 Path Translation
334+ ++++++++++++++++++++++
335+
336+ When running Borg within an MSYS2 (including Git Bash) environment, the shell
337+ automatically translates POSIX-style paths (like ``/tmp `` or ``/c/Users ``) to
338+ Windows paths (like ``C:\msys64\tmp `` or ``C:\Users ``) before they reach the
339+ Borg process.
340+
341+ This behavior can result in absolute Windows paths being stored in your backups,
342+ which may not be what you intended if you use POSIX paths for portability.
343+
344+ To disable this automatic translation for Borg, you can use environment variables
345+ to exclude everything from conversion. Similarly, MSYS2 also translates
346+ environment variables that look like paths. To disable this generally for Borg,
347+ set both variables::
348+
349+ export MSYS2_ARG_CONV_EXCL="*"
350+ export MSYS2_ENV_CONV_EXCL="*"
351+
352+ For more details, see the `MSYS2 documentation on filesystem paths <https://www.msys2.org/docs/filesystem-paths/ >`__.
353+
331354Windows 10's Linux Subsystem
332355++++++++++++++++++++++++++++
333356
Original file line number Diff line number Diff line change 4646 from ..helpers import ErrorIgnoringTextIOWrapper
4747 from ..helpers import msgpack
4848 from ..helpers import sig_int
49+ from ..platformflags import is_win32 , is_msystem
4950 from ..remote import RemoteRepository
5051 from ..selftest import selftest
5152except BaseException :
@@ -455,7 +456,14 @@ def parse_args(self, args=None):
455456 return args
456457
457458 def prerun_checks (self , logger , is_serve ):
458-
459+ if not is_serve :
460+ if is_win32 and is_msystem :
461+ if "MSYS2_ARG_CONV_EXCL" not in os .environ or "MSYS2_ENV_CONV_EXCL" not in os .environ :
462+ logger .warning (
463+ "MSYS2 path translation is active. This can cause POSIX paths to be mangled into "
464+ "Windows paths in archives. Consider setting MSYS2_ARG_CONV_EXCL='*' and "
465+ "MSYS2_ENV_CONV_EXCL='*'. See https://www.msys2.org/docs/filesystem-paths/ for details."
466+ )
459467 selftest (logger )
460468
461469 def _setup_implied_logging (self , args ):
Original file line number Diff line number Diff line change 44Use these flags instead of sys.platform.startswith('<os>') or try/except.
55"""
66
7+ import os
78import sys
89
910is_win32 = sys .platform .startswith ("win32" )
1516is_openbsd = sys .platform .startswith ("openbsd" )
1617is_darwin = sys .platform .startswith ("darwin" )
1718is_haiku = sys .platform .startswith ("haiku" )
19+
20+ # MSYS2/Git Bash (on Windows)
21+ is_msystem = "MSYSTEM" in os .environ
You can’t perform that action at this time.
0 commit comments