MSYS2-packages/msys2-runtime-3.3/0028-Cygwin-make-option-for-native-inner-link-handling.patch

53 lines
1.9 KiB
Diff

From aa9dbc9c9fc47ae4371d5847b358122eb1f54750 Mon Sep 17 00:00:00 2001
From: Jeremy Drake <github@jdrake.com>
Date: Thu, 22 Jul 2021 11:59:16 -0700
Subject: [PATCH 28/N] Cygwin: make option for native inner link handling.
This code has been causing issues with SUBST and mapped network drives,
so add an option (defaulted to on) which can be used to disable it where
needed. MSYS=nonativeinnerlinks
---
winsup/cygwin/environ.cc | 1 +
winsup/cygwin/globals.cc | 1 +
winsup/cygwin/path.cc | 3 ++-
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index f4e2c68..18c37ee 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -129,6 +129,7 @@ static struct parse_thing
{"disable_pcon", {&disable_pcon}, setbool, NULL, {{false}, {true}}},
{"enable_pcon", {&disable_pcon}, setnegbool, NULL, {{true}, {false}}},
{"winjitdebug", {&winjitdebug}, setbool, NULL, {{false}, {true}}},
+ {"nativeinnerlinks", {&nativeinnerlinks}, setbool, NULL, {{false}, {true}}},
{NULL, {0}, setdword, 0, {{0}, {0}}}
};
diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc
index 5c111ab..6c15138 100644
--- a/winsup/cygwin/globals.cc
+++ b/winsup/cygwin/globals.cc
@@ -76,6 +76,7 @@ bool wincmdln = true;
winsym_t allow_winsymlinks = WSYM_deepcopy;
bool disable_pcon = true;
bool winjitdebug = false;
+bool nativeinnerlinks = true;
bool NO_COPY in_forkee;
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 9edd949..9a3ad7a 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3645,7 +3645,8 @@ restart:
goto file_not_symlink;
}
#endif /* __i386__ */
- if ((pc_flags & (PC_SYM_FOLLOW | PC_SYM_NOFOLLOW_REP)) == PC_SYM_FOLLOW)
+ if (nativeinnerlinks
+ && (pc_flags & (PC_SYM_FOLLOW | PC_SYM_NOFOLLOW_REP)) == PC_SYM_FOLLOW)
{
PWCHAR fpbuf = tp.w_get ();
DWORD ret;