Closed Bug 1280022 Opened 3 years ago Closed 3 years ago

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

Categories

(Firefox Build System :: Mach Core, enhancement)

enhancement
Not set

Tracking

(firefox50 fixed)

RESOLVED FIXED
mozilla50
Tracking Status
firefox50 --- fixed

People

(Reporter: RyanVM, Assigned: gps)

References

Details

Attachments

(1 file)

Appears to be a recent regression on trunk.

================================================================================
Ensuring https://hg.mozilla.org/hgcustom/version-control-tools 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
message.

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/mach_commands.py", line 56, in mercurial_setup
    bootstrap.update_vct(hg, self._context.state_dir)
  File "c:\Users\Ryan\repos\mozilla-central\python/mozboot\mozboot\bootstrap.py", line 263, in update_vct
    vct_dir, '@')
  File "c:\Users\Ryan\repos\mozilla-central\python/mozboot\mozboot\bootstrap.py", line 312, in update_mercurial_repo
    subprocess.check_call(args, cwd=cwd)
  File "c:\mozilla-build\python\lib\subprocess.py", line 535, in check_call
    retcode = call(*popenargs, **kwargs)
  File "c:\mozilla-build\python\lib\subprocess.py", line 522, in call
    return Popen(*popenargs, **kwargs).wait()
  File "c:\mozilla-build\python\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "c:\mozilla-build\python\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
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 https://hg.mozilla.org/mozilla-central/file/tip/python/mozboot/mozboot/mach_commands.py#l53 with "which('hg.exe')" and let me know if that fixes things?
Flags: needinfo?(gps)
Yes, that works.
Assignee: nobody → gps
Status: NEW → ASSIGNED
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: https://reviewboard.mozilla.org/r/59356/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/59356/
Attachment #8762902 - Flags: review?(mh+mozilla)
Comment on attachment 8762902 [details]
Bug 1280022 - Search for hg.exe on Windows;

https://reviewboard.mozilla.org/r/59356/#review56376

::: python/mozboot/mozboot/mach_commands.py:55
(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:

https://dxr.mozilla.org/mozilla-central/source/python/which/which.py#169
Attachment #8762902 - Flags: review?(mh+mozilla)
Comment on attachment 8762902 [details]
Bug 1280022 - Search for hg.exe on Windows;

https://reviewboard.mozilla.org/r/59356/#review56382

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 gszorc@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/8f94ec370825
Search for hg.exe on Windows; r=glandium
https://reviewboard.mozilla.org/r/59356/#review56382

I added an inline comment instead.
https://hg.mozilla.org/mozilla-central/rev/8f94ec370825
https://hg.mozilla.org/mozilla-central/rev/4b35974b5b39
Status: ASSIGNED → RESOLVED
Closed: 3 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.