Closed Bug 1280022 Opened 4 years ago Closed 4 years ago

"WindowsError: [Error 193] %1 is not a valid Win32 application" error when running ./mach mercurial-setup


(Firefox Build System :: Mach Core, enhancement)

Not set


(firefox50 fixed)

Tracking Status
firefox50 --- fixed


(Reporter: RyanVM, Assigned: gps)




(1 file)

Appears to be a recent regression on trunk.

Ensuring is up to date at c:/Users/Ryan/.mozbuild\version-control-tools
Error running mach:

    ['mercurial-setup', '--update-only']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.

You should consider filing a bug for this issue.

If filing a bug, please include the full output of mach, including this error

The details of the failure are as follows:

WindowsError: [Error 193] %1 is not a valid Win32 application

  File "c:\Users\Ryan\repos\mozilla-central\python/mozboot/mozboot/", line 56, in mercurial_setup
    bootstrap.update_vct(hg, self._context.state_dir)
  File "c:\Users\Ryan\repos\mozilla-central\python/mozboot\mozboot\", line 263, in update_vct
    vct_dir, '@')
  File "c:\Users\Ryan\repos\mozilla-central\python/mozboot\mozboot\", line 312, in update_mercurial_repo
    subprocess.check_call(args, cwd=cwd)
  File "c:\mozilla-build\python\lib\", line 535, in check_call
    retcode = call(*popenargs, **kwargs)
  File "c:\mozilla-build\python\lib\", line 522, in call
    return Popen(*popenargs, **kwargs).wait()
  File "c:\mozilla-build\python\lib\", line 710, in __init__
    errread, errwrite)
  File "c:\mozilla-build\python\lib\", line 958, in _execute_child
Looks like bug 1277406 added the function in question.
Blocks: 1277406
Flags: needinfo?(gps)
Bleh. This is likely the `which` implementation in this Python code grabbing `hg` instead of `hg.exe`. Should be easy enough to fix.

I don't have access to a Windows machine this week. Can you try replacing the "which('hg')" at with "which('hg.exe')" and let me know if that fixes things?
Flags: needinfo?(gps)
Yes, that works.
Assignee: nobody → gps
Without this, we attempt to execute "hg" as a native Win32 program
and get the dreaded "%1 is not a valid Win32 application" error because
"hg" has a shebang and only executes inside a UNIX-like shell.

Review commit:
See other reviews:
Attachment #8762902 - Flags: review?(mh+mozilla)
Comment on attachment 8762902 [details]
Bug 1280022 - Search for hg.exe on Windows;

::: python/mozboot/mozboot/
(Diff revision 1)
> -        hg = which.which('hg')
> +        if sys.platform in ('win32', 'msys'):
> +            hg = which.which('hg.exe')
> +        else:
> +            hg = which.which(hg)

This doesn't seem right. which.which should already deal with .exe extensions:
Attachment #8762902 - Flags: review?(mh+mozilla)
Comment on attachment 8762902 [details]
Bug 1280022 - Search for hg.exe on Windows;

Ah no, this is right... but the commit message should mention that what's happening is that which.which('hg') finds a hg file without extension in the PATH
Attachment #8762902 - Flags: review+
Pushed by
Search for hg.exe on Windows; r=glandium

I added an inline comment instead.
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
Duplicate of this bug: 1280161
Duplicate of this bug: 1280815
I still observe the error reported in duplicate Bug 1280815 with comm-central/mozilla-central from today although Bug 1280022 was fixed 4 days ago.
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.