[PATCH] Cygwin: environ: restore SYSTEMDRIVE if unset

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Cygwin: environ: restore SYSTEMDRIVE if unset

Michael Haubenwallner-2
Various registry values do rely on the %SystemDrive% env var to be set.
Right now, it is not known to be easily possible to query the value of
SYSTEMDRIVE environment variable other than preserving the original
environment value even across 'env -i', for use cases like the one in:
https://cygwin.com/ml/cygwin/2019-08/msg00072.html

Note: As we do not store the default value, setting SYSTEMDRIVE to the
empty value will allow it to be unset, but that has to be explicit now.
---
 winsup/cygwin/environ.cc    | 2 +-
 winsup/cygwin/release/3.1.0 | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 8fa01b2d5..75eb81e27 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -969,7 +969,7 @@ static NO_COPY spenv spenvs[] =
   {NL ("HOMEPATH="), false, false, &cygheap_user::env_homepath},
   {NL ("LOGONSERVER="), false, false, &cygheap_user::env_logsrv},
   {NL ("PATH="), false, true, NULL},
-  {NL ("SYSTEMDRIVE="), false, true, NULL},
+  {NL ("SYSTEMDRIVE="), true, true, NULL},
   {NL ("SYSTEMROOT="), true, true, &cygheap_user::env_systemroot},
   {NL ("USERDOMAIN="), false, false, &cygheap_user::env_domain},
   {NL ("USERNAME="), false, false, &cygheap_user::env_name},
diff --git a/winsup/cygwin/release/3.1.0 b/winsup/cygwin/release/3.1.0
index 2c1e8d2a8..987ec1f6c 100644
--- a/winsup/cygwin/release/3.1.0
+++ b/winsup/cygwin/release/3.1.0
@@ -24,6 +24,9 @@ What changed:
 - Eliminate a header file name collision with <X11/XLocale.h> on case
   insensitive filesystems by reverting <xlocale.h> back to <sys/_locale.h>.
 
+- Unless empty, keep the SYSTEMDRIVE environment variable for new processes.
+  Adresses: https://cygwin.com/ml/cygwin/2019-08/msg00072.html
+
 
 Bug Fixes
 ---------
--
2.21.0