Transient Windows test failures

Yuya Nishihara yuya at tcha.org
Mon Jun 19 11:30:28 EDT 2017


On Sun, 18 Jun 2017 22:19:29 -0400, Augie Fackler wrote:
> 
> > On Jun 16, 2017, at 22:02, Matt Harbison <mharbison72 at gmail.com> wrote:
> > 
> > On Fri, 16 Jun 2017 09:59:30 -0400, Augie Fackler <raf at durin42.com> wrote:
> > 
> >> On Fri, Jun 16, 2017 at 12:18:18AM -0400, Matt Harbison wrote:
> >>> So apparently, this is a symptom of not having %SystemRoot% in the
> >>> environment when calling CreateProcess().
> >>> 
> >>> https://bugs.python.org/issue13524
> >>> https://jpassing.com/2009/12/28/the-hidden-danger-of-forgetting-to-specify-systemroot-in-a-custom-environment-block/
> >>> 
> >>> I see that setup.py special cases this variable.  I did a search for 'env
> >>> =', and it looks like hooks and pager start with empty environments, so they
> >>> must not inherit this.  IDR if any recent changes were made that start with
> >>> an empty environment.
> >>> 
> >>> The thing I can't get my mind around is the hit and miss nature of the
> >>> error, if this is really the problem.
> >> 
> >> It sounds like it should be harmless to just always forward
> >> %SystemRoot% - should we just do that?
> > 
> > Seems reasonable, but run-tests._getenv() already does an os.environ.copy(), so it should be there?
> > 
> > It does seem like a good idea to do it for hooks and other things executed, where the environment is built from scratch.  The question is where?  There's util.popen[2-4](), plus some direct calls to subprocess.Popen(), and an os.system().  I considered util.shellenviron(), but there are far fewer calls to this than places where processes are spawned.

(+CC foozy since he has Windows)

Is the problem only seen in tests? I don't think environment variables are
cleared in hg side.


More information about the Mercurial-devel mailing list