D7130: automation: avoid '~' in the temp directory on Windows

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Thu Oct 17 23:31:06 UTC 2019


mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  If a long-ish username is used, the environment variable ends up with a '~' to
  be 8.3 path compatible.  That in turn causes a handful of tests (mostly ssh
  related) to add quotes around $TESTMP.
  
  I have no AWS experience, so I have no idea if this is the proper way to do it.
  But I've hit this problem locally, and redirecting the directory is a
  workaround.  I don't recall if the directory is created on demand by the test
  harness, but presumably if this is configured before the machine boots, Windows
  will do it for us.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7130

AFFECTED FILES
  contrib/automation/hgautomation/aws.py

CHANGE DETAILS

diff --git a/contrib/automation/hgautomation/aws.py b/contrib/automation/hgautomation/aws.py
--- a/contrib/automation/hgautomation/aws.py
+++ b/contrib/automation/hgautomation/aws.py
@@ -191,6 +191,10 @@
 $Setting = 'LocalAccountTokenFilterPolicy'
 Set-ItemProperty -Path $Key -Name $Setting -Value 1 -Force
 
+# Avoid long usernames in the temp directory path because the '~' causes extra quoting in ssh output
+[System.Environment]::SetEnvironmentVariable('TMP', 'C:\Temp', [System.EnvironmentVariableTarget]::User)
+[System.Environment]::SetEnvironmentVariable('TEMP', 'C:\Temp', [System.EnvironmentVariableTarget]::User)
+
 # Configure and restart the WinRM Service; Enable the required firewall exception
 Stop-Service -Name WinRM
 Set-Service -Name WinRM -StartupType Automatic



To: mharbison72, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list