Bootstrap: Mercurial version detection broken when Mercurial is in italian language

RESOLVED FIXED in mozilla28

Status

defect
RESOLVED FIXED
6 years ago
Last year

People

(Reporter: desantis.maurizio, Assigned: desantis.maurizio)

Tracking

27 Branch
mozilla28
x86_64
Linux

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [bugday-20131106])

Attachments

(1 attachment, 1 obsolete attachment)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:27.0) Gecko/20100101 Firefox/27.0 (Beta/Release)
Build ID: 20131024054843

Steps to reproduce:

Ubuntu 13.10 - italian language
Mercurial installed with italian locale (hg --version outputs: Mercurial SCM Distribuito (versione 2.7.2) )
python python/mozboot/bin/bootstrap.py


Actual results:

Display:

ERROR: Unable to identify Mercurial version.

We attempted to upgrade Mercurial to a modern version (2.5 or newer).
However, you appear to have version None still.

It's possible your package manager doesn't support a modern version of
Mercurial. It's also possible Mercurial is not being installed in the search
path for this shell. Try creating a new shell and run this bootstrapper again.

If it continues to fail, consider installing Mercurial by following the
instructions at http://mercurial.selenic.com/.



Expected results:

Display:

Your version of Mercurial (2.7.2) is sufficiently modern.
Posted patch Fix (obsolete) — Splinter Review
Assignee: nobody → desantis.maurizio
Status: UNCONFIRMED → ASSIGNED
Component: Untriaged → Build Config
Ever confirmed: true
Product: Firefox → Core
Whiteboard: [bugday-20131106]
Comment on attachment 828290 [details] [diff] [review]
Fix

Review of attachment 828290 [details] [diff] [review]:
-----------------------------------------------------------------

One-offing Italian is not a sufficient fix. What about German, Russian, French, ...

If we're going to do this, we should do it right. I'm not sure how Mercurial does it's localization, but we should attempt to set an environment variable to force English or something. Alternatively, we could change the version detection string to look for \d+\.\d+\.\d+ or something.
Attachment #828290 - Flags: review-
(In reply to Gregory Szorc [:gps] from comment #2)

> One-offing Italian is not a sufficient fix. What about German, Russian,
> French, ...

I agree, sorry for the poor quality of my patch, I did it without thinking about implications

> I'm not sure how Mercurial does it's localization, but we should attempt
> to set an environment variable to force English or something.

I tried to use LANG=C hg --version and I still have "versione" instead of "version"

> Alternatively, we could change the version
> detection string to look for \d+\.\d+\.\d+ or something.

Probably this is the best way, maybe restricting the regex scan to the first line of the output, in order to avoid false positives in an hypotetic future change of the hg --version output
I did some source code diving. `HGPLAIN=1 hg --version` should work (at least with sufficiently modern versions of Mercurial). The docs say "the output should be stable, reproducible and suitable for use in scripts or applications." This sounds like exactly what we want!
It works! HGPLAIN=1 hg --version outputs:

Mercurial Distributed SCM (version 2.7.2)

I'll upload a new patch
Fix using HGPLAIN
Attachment #828290 - Attachment is obsolete: true
Attachment #829661 - Flags: review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/84e110633bc9
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.