git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Incorrect $HOME value when using runas on Windows

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 22, 2021, 13:54 UTC
Message-ID
<nycvar.QRO.7.76.6.2101221432460.52@tvgsbejvaqbjf.bet>
In-Reply-To
<YAoraIvKWWRj4cLJ@camp.crustytoothpaste.net>
Hi,
On Fri, 22 Jan 2021, brian m. carlson wrote:
Show 22 quoted lines
> On 2021-01-20 at 10:12:57, Mail wrote:
> > To reproduce the issue:
> > 1. Install git-windows x32 or x64 for all users.
> > 2. Install Total Commader or any other file manager that support system
> > context menu
> > 3. Add user in Windows via msc or settings app and set password. Don't
> > forget to disable "User must change password on first login" in case user
> > created via msc
> > 4. In current user session execute runas.exe /user:NewlyCreatedUser "Path To
> > File Manager"
> > 5. Right click on empty space in file list and choose Git bash here
> > 6. Type `echo $HOME` in bash console and press enter
> > 7. The $HOME is `/c/Windows/System32`. Expected `/c/Users/NewlyCreatedUser`
> > It seems git for windows uses HOMEPATH that points to system32 in case of
> > runas command. Might be using USERPROFILE variable is better.
>
> I'd recommend reporting this to the Git for Windows project[0].  The
> setting of $HOME is normally a feature provided automatically by
> Unix-like operating systems, and its behavior in the MSYS environment is
> controlled by Git for Windows.
>
> [0] https://github.com/git-for-windows/git

There is actually already a ticket about this: https://github.com/git-for-windows/git/issues/2709

I integrated a patch that fixes this from `git.exe`'s side, but had forgotten the `git-bash.exe` side. Here is a PullRequest to address this:

	https://github.com/git-for-windows/MINGW-packages/pull/45

Mail (if this is your real name, if not, please substitute your real name in your mind), feel free to test that PR's code and report back whether it solves your problem or not.

Ciao, Johannes

Previous: brian m. carlson
Message 3 of 3 in “Incorrect $HOME value when using runas on Windows”
  1. MailJan 20, 2021
  2. brian m. carlsonJan 22, 2021
  3. Johannes SchindelinJan 22, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.