Closed Bug 1800870 Opened 1 year ago Closed 1 year ago

Cannot run most mach commands when mercurial runs against Python 3.11: .hgignore: invalid pattern (relre): (?i)(^|/)TAGS$

Categories

(Firefox Build System :: Mach Core, defect)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1800776

People

(Reporter: jlorenzo, Unassigned)

References

(Blocks 1 open bug)

Details

I'm filing this bug just for the sake of documenting what happens. The real fix is likely on the Mercurial side. I just filed a bug on their bugzilla instance[1].

macOS users on Brew now get mercurial installed on Python 3.11[2]. So anyone who runs brew upgrade will face this bug no matter what Python version they use to run mach. I recommend reinstalling an earlier version:

cd "$(brew --prefix)/Library/Taps/homebrew/homebrew-core/Formula"
git checkout 37e85eab944e8d72e1048bc4c9ca38ff0ae00e2e -- mercurial.rb
brew reinstall mercurial

There's a line in our .hgignore[3] that now breaks Mercurial. I don't think this line should be fixed on our end. For more info, see the hg bug.

[1] https://bz.mercurial-scm.org/show_bug.cgi?id=6759
[2] https://github.com/Homebrew/homebrew-core/commit/f0a032259231526eb1cf1f2c2828562c6e284daf
[3] https://hg.mozilla.org/mozilla-central/file/f130aa968d7eac720e17f4ddef0fec9b57a11d08/.hgignore#l6

Fixed with a workaround by :Glandium in bug 1800776.

Status: NEW → RESOLVED
Closed: 1 year ago
Duplicate of bug: 1800776
Resolution: --- → DUPLICATE

Also, I think this is a somewhat expected change with Python 3.11: Regex inline flags "not at the start of a regular expression" were deprecated in Python 3.6 and I think removed in Python 3.11.

Though, it seems that our regex in .hgignore that got caught by this does seem to be at the start of the regular expression, so maybe it's a bug on the Python side in regards to the 'removal' in Python 3.11?

Thanks for finding this dupe, :ahochheiden! It's actually a bug in mercurial. They do a few things with the regexes (like adding .* at the beginning, and merging all lines in .hgignore in one big regex). I left more details in the this ticket[1]. I tested their most recent fix[2] and it worked fine on my end.

[1] https://bz.mercurial-scm.org/show_bug.cgi?id=6759
[2] https://foss.heptapod.net/mercurial/mercurial-devel/-/merge_requests/306

(In reply to Johan Lorenzo [:jlorenzo] from comment #3)

They do a few things with the regexes (like adding .* at the beginning, and merging all lines in .hgignore in one big regex.

Ah okay, that makes sense actually!

I'm sure we'll have to fix plenty of more regular expressions for Python 3.11 compatibility, so keeping concatenation in mind is probably a good idea.

Thanks!

You need to log in before you can comment on or make changes to this bug.