Closed Bug 1476147 Opened Last year Closed Last year

'mach bootstrap' fails to get hg version

Categories

(Firefox Build System :: Bootstrap Configuration, defect)

Unspecified
Linux
defect
Not set

Tracking

(firefox63 fixed)

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: scarrillo, Assigned: TYLin)

Details

Attachments

(1 file)

Error running mach:

    ['bootstrap']

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:

OSError: [Errno 13] Permission denied

  File "/home/mozilla/src/gecko/python/mozboot/mozboot/mach_commands.py", line 32, in bootstrap
    bootstrapper.bootstrap()
  File "/home/mozilla/src/gecko/python/mozboot/mozboot/bootstrap.py", line 283, in bootstrap
    hg_installed, hg_modern = self.instance.ensure_mercurial_modern()
  File "/home/mozilla/src/gecko/python/mozboot/mozboot/base.py", line 472, in ensure_mercurial_modern
    installed, modern, version = self.is_mercurial_modern()
  File "/home/mozilla/src/gecko/python/mozboot/mozboot/base.py", line 465, in is_mercurial_modern
    our = self._parse_version(hg, 'version', self._hg_cleanenv())
  File "/home/mozilla/src/gecko/python/mozboot/mozboot/base.py", line 434, in _parse_version
    stderr=subprocess.STDOUT)
  File "/home/mozilla/src/gecko/python/mozboot/mozboot/base.py", line 363, in check_output
    return fn(*args, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 216, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
    raise child_exception


I debugged a little and found that in 460 of base.py, 'which hg' is getting my cinnabar path: /home/mozilla/src/git-cinnabar/hg instead of /usr/bin/hg (the output of 'which hg' from terminal)
Flags: needinfo?(mh+mozilla)
At the very least we should have better error messages for things like this that say what we failed to execute.
ISTR we've hit this problem before, where which.py happily considers directories as a valid result. Shells' which doesn't, and properly skip those and return the next result.

You could place your cinnabar path last in your PATH as a workaround.
Flags: needinfo?(mh+mozilla)
hmm... I do have it last. Any other ideas on how to fix?
O_o How does which.py not find /usr/bin/hg if /usr/bin is before the git-cinnabar path?
¯\_(ツ)_/¯ going to try restarting, bc even in a new shell, the cinnabar path was found. Thanks for your help!
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → INVALID
FWIW, with the git-cinnabar path *before* /usr/bin in my PATH, the following python script prints /usr/bin/hg:

from which import which
which('hg')

And instrumenting which does show it looking at the hg directory in the git-cinnabar directory. (it also revealed a pretty explicit os.path.isfile() in the code). I really don't know what's going on on your machine.
(I will, however, rename the directory in git-cinnabar)
Yes, I did notice that the hg directory in cinnabar was new so maybe renaming that would help... but honestly I've been having a bunch of issues on my machine so I wasn't surprised by the weirdness. I restarted and 'mach bootstrap' worked now, so I have no idea what made the difference. gps encouraged me to file the bug though just to check out what was happening :)
This excludes directories, and returns true only if it's an executable file.
Comment on attachment 9000087 [details]
Bug 1476147 - Use path.isfile() instead of patch.exists() in which().

Mike Hommey [:glandium] has approved the revision.
Attachment #9000087 - Flags: review+
Pushed by aethanyc@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/c9d65d413d06
Use path.isfile() instead of patch.exists() in which(). r=glandium
Assignee: nobody → aethanyc
Resolution: INVALID → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.