diff options
author | Eli Schwartz <eschwartz93@gmail.com> | 2024-07-29 11:00:54 -0400 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2024-07-30 12:28:43 -0700 |
commit | a05b790d6600586449471d3fe957442896dec2a7 (patch) | |
tree | 464b73c14c31355cffaffa1263721bc72d788500 | |
parent | 077d540c10a103fd5a41d0747b8140fef87b02ef (diff) | |
download | meson-a05b790d6600586449471d3fe957442896dec2a7.zip meson-a05b790d6600586449471d3fe957442896dec2a7.tar.gz meson-a05b790d6600586449471d3fe957442896dec2a7.tar.bz2 |
mdist: correctly detect dirty hg repos with non-English locale
The command we use to heuristically parse whether it is dirty by
interpreting prose descriptions of the repository state, is vulnerable
to changes in locale resulting in failing to match the English word that
means it is clean.
Unfortunately, I am no mercurial expert so I am unaware if mercurial
supports scripting, like git does. Perhaps the technology simply does
not exist. A quick attempt at searching for the answer turned nothing
up. It appears that #4278 had good cause indeed for using this prose
parsing command.
So, we simply sanitize the environment due to lack of any better idea.
Bug: https://bugs.gentoo.org/936670
-rw-r--r-- | mesonbuild/mdist.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mesonbuild/mdist.py b/mesonbuild/mdist.py index 0c82cd3..8e35bb8 100644 --- a/mesonbuild/mdist.py +++ b/mesonbuild/mdist.py @@ -223,7 +223,9 @@ class GitDist(Dist): class HgDist(Dist): def have_dirty_index(self) -> bool: '''Check whether there are uncommitted changes in hg''' - out = subprocess.check_output(['hg', '-R', self.src_root, 'summary']) + env = os.environ.copy() + env['LC_ALL'] = 'C' + out = subprocess.check_output(['hg', '-R', self.src_root, 'summary'], env=env) return b'commit: (clean)' not in out def create_dist(self, archives: T.List[str]) -> T.List[str]: |