SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9400

AFFECTED FILES
  rust/hg-core/src/requirements.rs
  tests/test-rhg.t

CHANGE DETAILS

diff --git a/tests/test-rhg.t b/tests/test-rhg.t
--- a/tests/test-rhg.t
+++ b/tests/test-rhg.t
@@ -140,3 +140,8 @@
   sparserevlog
   store
   indoor-pool
+
+  $ echo -e '\xFF' >> .hg/requires
+  $ rhg debugrequirements
+  abort: .hg/requires is corrupted
+  [255]
diff --git a/rust/hg-core/src/requirements.rs b/rust/hg-core/src/requirements.rs
--- a/rust/hg-core/src/requirements.rs
+++ b/rust/hg-core/src/requirements.rs
@@ -24,7 +24,7 @@
         .map(|line| {
             // Python uses Unicode `str.isalnum` but feature names are all
             // ASCII
-            if line[0].is_ascii_alphanumeric() {
+            if line[0].is_ascii_alphanumeric() && line.is_ascii() {
                 Ok(String::from_utf8(line.into()).unwrap())
             } else {
                 Err(())



To: SimonSapin, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to