Closed Bug 1476147 Opened Last year Closed Last year

'mach bootstrap' fails to get hg version


(Firefox Build System :: Bootstrap Configuration, defect)

Not set


(firefox63 fixed)

Tracking Status
firefox63 --- fixed


(Reporter: scarrillo, Assigned: TYLin)



(1 file)

Error running mach:


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:

OSError: [Errno 13] Permission denied

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

I debugged a little and found that in 460 of, '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 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 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!
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

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
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.