mach mercurial-setup fails with "ConfigObjError: Parsing failed with several errors."

RESOLVED FIXED in mozilla27


Firefox Build System
Mach Core
5 years ago
3 months ago


(Reporter: emorley, Assigned: emorley)


Windows 8

Firefox Tracking Flags

(Not tracked)



(1 attachment)



5 years ago
$ mach mercurial-setup
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:

ConfigObjError: Parsing failed with several errors.
First error at line 3.

  File "c:\src-gecko\mozilla-central\tools/mercurial/", line 29, in mercurial_bootstrap
    result ='~/.hgrc'))
  File "c:\src-gecko\mozilla-central\tools/mercurial\hgsetup\", line 102, in run
    c = MercurialConfig(config_path)
  File "c:\src-gecko\mozilla-central\tools/mercurial\hgsetup\", line 25, in __init__
    write_empty_values=True, list_values=False)
  File "c:\src-gecko\mozilla-central\python/configobj\", line 1242, in __init__
    self._load(infile, configspec)
  File "c:\src-gecko\mozilla-central\python/configobj\", line 1332, in _load
    raise error

$ head ~/mercurial.ini
username = Ed Morley <>
ssh = "C:\Program Files\TortoiseHg\tortoiseplink.exe" -l -i C:\Users\Ed\.ssh\putty-rsa.ppk -C
merge = diffmerge3
editor = "C:\Program Files (x86)\Notepad++\notepad++.exe" -multiInst
slash = True

git = True
showfunc = True

Comment 1

5 years ago
If I remove the quotes on line 3 (the |ssh=| line), it doesn't fail on that line (same for line 5).

The spec used by configobj ( doesn't match what it actually permitted by Mercurial :-(

Comment 2

5 years ago
Unfortunately we can't use the Mercurial API for reading config files because:

1) The Mercurial Python API isn't always available on machines. I mean it is there, but doing an |import| isn't always reliable.
2) The API doesn't support writing values.
3) The Python code is GPL and this would make the mach command and possible the mach core be GPL. This is highly undesirable.

I think we'll need to trap parsing failures in the setup wizard and exit gracefully. Hopefully we can print a list of suggestions for making parsing work.

Best effort is sadly the best we can do.

Comment 3

5 years ago
Created attachment 810240 [details] [diff] [review]
Output more useful error messages for parsing exceptions


[/c/src-gecko/inbound]$ mach mercurial-setup
Error importing existing mercurial config!
Parse error in value at line 5.
If using quotes, they must wrap the entire string.
Attachment #810240 - Flags: review?(gps)


5 years ago
Assignee: nobody → emorley

Comment 4

5 years ago
Comment on attachment 810240 [details] [diff] [review]
Output more useful error messages for parsing exceptions

Review of attachment 810240 [details] [diff] [review]:

Attachment #810240 - Flags: review?(gps) → review+
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27


3 months ago
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.