delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/08/07/07:20:49

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:cc:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=tONGVK6YDymMZIp/UxG+1IuaXBIma/Mb4uIcWDRbH2WbGzuFogHoK
iddoPHX3kXgf26FN/nwvmjPlw10bWtI0uQ1OYGvBpCUrKmsPyCY0sTXXEk6KMk7s
o3/OdPv+VOrnxG9vw8K/HDd/adxMCZ1N3f3HUk3kgGI10fqlczwKas=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:cc:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=lr+9F0kvOY8O/s+/6HFfwuPP+lo=; b=xmcDjrtLFcxt+f6YWSskTrOlZ5sv
TmjGuVgonly66tnekxPYcwaKVXviYhoGd+FUBIul6wHxbviNkv7AlZQO9ueBXOhu
Qpi4Q4bglMDnvQtUlCbEb/alLdaL4UkMoQoxwRiLMZDaWwH5toJpS73WLMQ6avjM
N6SLDa6azQ6Ij0Q=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-104.2 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1869, letter, device
X-HELO: mout.kundenserver.de
Date: Wed, 7 Aug 2019 13:19:43 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: Michael Haubenwallner <michael DOT haubenwallner AT ssi-schaefer DOT com>
Cc: cygwin AT cygwin DOT com
Subject: Re: How to query the value of %SystemDrive% in an empty environment?
Message-ID: <20190807111943.GC11632@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: Michael Haubenwallner <michael DOT haubenwallner AT ssi-schaefer DOT com>, cygwin AT cygwin DOT com
References: <089bb243-1dbb-048a-39aa-f54048a39e26 AT ssi-schaefer DOT com> <0f9d219c-a9ae-237a-afcf-9dcc5a13bc01 AT SystematicSw DOT ab DOT ca> <ebba0d18-d4d1-dd3c-bd52-b91489106cbf AT ssi-schaefer DOT com>
MIME-Version: 1.0
In-Reply-To: <ebba0d18-d4d1-dd3c-bd52-b91489106cbf@ssi-schaefer.com>
User-Agent: Mutt/1.11.3 (2019-02-01)

--zOr5JpMIiGv/Oaxu
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Aug  7 13:08, Michael Haubenwallner wrote:
> On 8/7/19 4:33 AM, Brian Inglis wrote:
> > On 2019-08-06 09:20, Michael Haubenwallner wrote:
> >> using 'env -i' to create an empty environment, the SYSTEMROOT and WIND=
IR
> >> environment variables are preserved (or recreated):
> >>  $ /usr/bin/env -i /usr/bin/env
> >>  SYSTEMROOT=3DC:\Windows
> >>  WINDIR=3DC:\Windows
> >> And with cygpath, there is the -A, -D, -H, -O, -P, -S, -W and even -F =
flags
> >> to query the values for various directories.
> >> Now what I've failed to find is how to query the value for the "System=
Drive"
> >> environment variable.
> >> The problem behind is that I'm using "vswhere.exe" to locate some Visu=
al Studio
> >> environment from within some scripts run via 'env -i', causing vswhere=
.exe to
> >> create a directory named "%SystemDrive%" in the current working direct=
ory:
> >> So I better ensure the SystemDrive environment variable is set for vsw=
here.exe.
> >> Any ideas?
> >=20
> > There is a reg entry:
> >=20
> > $ head
> > /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Syst=
emBootDevice;
> > echo
> > multi(0)disk(0)rdisk(1)partition(3)
> >=20
> > but how do you convert that to a device letter?
> >=20
> > SYSTEMDRIVE is a dynamic env var created at startup pointing to the boo=
t drive
> > letter. It is not instantiated anywhere else as far I could find. A num=
ber of
> > low level reg entries use that env var. Only option is to pass it throu=
gh:
>=20
> Heck, even CreateEnvironmentBlock() relies on SYSTEMROOT env var being se=
t,
> otherwise returning things like ProgramData=3D"%SystemDrive%\ProgramData".

So, what does this have to do with Cygwin in case you clean out the
environment?  This is nothing you want to do if you plan to start
a non-Cygwin executable.


Corinna

--=20
Corinna Vinschen
Cygwin Maintainer

--zOr5JpMIiGv/Oaxu
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl1Ks88ACgkQ9TYGna5E
T6AIkA/+LzyMXZDrPvSjZy6NiQQRQI+ceRApUfOY5ZWqTc7vkTGTnpF7iPJX3c23
Ip9rs+6G/r1GsgkhxHXE/mEw36wqxguJgHomftO2s54ItX+iOfRUrOwgnU7p3Dls
ERpn8ctZSUp8jfCZloQ7RyOqcsBY+5tT9Ty9kygHYh4MLFPB5IyF9rjTpG3aQl61
UfnW+kqkYKcr17dFOc0Va3mbToh0kYVJ7ev0DfvA1kDs1nDMfZA5FrBDLXPF8KAz
xocw1sYA/5Fs+mTByvhR6ZGZeNxqZXKK8hCDAEacHogv3OXkJ10zdM00EcadhgSO
BvQfuuujStonLuFPU6xeanKi/4C9pR2xS6+/BybEFFKxwcPw44ctC5fbav0dja9e
6RTWDXR5IR2GH0ptTeQnWd3/03vbjNgNHtylBoWCqQ/CVXnF2Fy3RuAQek0+FWQr
lWgfQGgsuOX7CngZpdmalgNxIX+V2q8cIGpaxyHRhi1MkKWHoedeSLD/ZJam2T0p
ofvT0eOHDPetjN9WwHggOx9r0OuVThtAYtRvNdZTNPxIJ/K0hPuY/Hl/iQ0k5qg2
6gqZR28msXXPF5CFSInZWptscbjLxMmkzm/5bxUCV41f48/dyr7/KrYSIqAc2PN8
V/brRPnL+GW7xpdDAa+56SxPuggct1+3n/Zk2bdwPKzNmItFh08=
=VNZy
-----END PGP SIGNATURE-----

--zOr5JpMIiGv/Oaxu--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019