Closed Bug 1448349 Opened 4 years ago Closed 2 years ago

configure fails when git for Windows is in PATH ahead of MozillaBuild's msys (/usr/bin/grep: nul: No such file or directory)

Categories

(Firefox Build System :: General, defect)

3 Branch
defect
Not set
normal

Tracking

(firefox72 fixed)

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: daleharvey, Assigned: mars)

Details

Attachments

(1 file, 2 obsolete files)

Fresh build on windows 10, latest mozillaBuild, I have hit this twice in a row following the installation instructions @ https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Windows_Prerequisites

https://gist.github.com/daleharvey/f2d48c0b7b371a22bcbb3469925ca743
is the full log: 

 0:08.67 checking for autoconf... C:/mozilla-build/msys/local/bin/autoconf-2.13
 0:08.67 Refreshing c:/Users/daleharvey/src/gecko-dev/old-configure with C:/mozilla-build/msys/local/bin/autoconf-2.13
 0:08.73 /usr/bin/sed: -e expression #1, char 10: unterminated `s' command
 0:08.85 autoconf: Undefined macros:
0:08.91 /usr/bin/grep: nul: No such file or directory

Seemm the most relevant for the error
So the error here was, this is a git clone, the mozillabuild shell could not see git (although the command prompt could) and failed so I added the git path to my bash_profile, but adding it to the start of the path sonds like its msys tools were used instead of the supported versions causing problems, If I added the git path to the end of my $PATH it looks to be working properly
This sounds like something we could potentially detect in moz.configure. I think the specific error here is probably that the shell we wound up using to execute autoconf was from git. If we're on Windows we could check that the shell in PATH is from MozillaBuild, and error if it's not.
Summary: /usr/bin/grep: nul: No such file or directory → configure fails when git for Windows is in PATH ahead of MozillaBuild's msys (/usr/bin/grep: nul: No such file or directory)
FWIW `nul` is a reserved filename on Windows. Any attempts to access files of that name will fail.

Git doesn't recognize these reserved filenames and you'll get run-time failures if a file with a reserved filename is in the repo. Mercurial aborts more gracefully.

Not sure where this `nul` file is coming from though.
Version: Version 3 → 3 Branch
Assignee: nobody → mars
Status: NEW → ASSIGNED

Autoconf on Windows will use the first sh it detects in $PATH. If the user has
installed other mingw programs and put them in $PATH before the mozilla-build
tools then Autoconf will pick up a foreign tool's copy of sh. When Autoconf
runs our checks with the foreign sh all of our checks fail.

This patch adds a check to the old.configure autoconf tool check to detect
if a shell outside mozilla-build will be picked up before our mozilla-build
shell is. configure fails if it detects a foreign copy of sh.

Sometimes users modify $PATH on Windows to install other MinGW-packaged
programs, such as Git. If the /bin directory for these other tools comes first
in the MozillaBuild shell $PATH then our Autoconf scripts will pick up the
Unix tools from the foreign MingGW package instead of the tools we package in
/mozilla-build. The foreign tools break and crash mach configure.

This patch ensures that the /mozilla-build directory always comes first in
$PATH when calling Autoconf during mach configure.

Attachment #9106749 - Attachment is obsolete: true

Detect if Unix utilities on win32 are being picked up from a foreign
installation of MinGW, such as the tools packaged with Git for Windows.
If autoconf dies during ./mach configure and foreign tools are found
in $PATH then warn the user that their $PATH may need to change to fix
the problem.

Attachment #9107630 - Attachment is obsolete: true
Pushed by mfogels@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7dcc2fa474a8
Warn about autoconf $PATH problems on win32 r=firefox-build-system-reviewers,chmanchester

My guess is the failure was due to the @imports('os'), which changed the meaning of many of the os.foo things in the function. Try @imports(_from='os', _import='environ')

My tests were passing locally and in Try, however :tomprince pointed out that I was running artifact builds in both. I was able to reproduce the failure using mach try --no-artifact.

Flags: needinfo?(mars)
Pushed by mfogels@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/55d7f113d4ae
Warn about autoconf $PATH problems on win32 r=firefox-build-system-reviewers,chmanchester
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
You need to log in before you can comment on or make changes to this bug.