D6615: extdata: demonstrate bad behavior when a subprocess emits garbage

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Mon Jul 8 18:05:36 UTC 2019


durin42 created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-extdata.t

CHANGE DETAILS

diff --git a/tests/test-extdata.t b/tests/test-extdata.t
--- a/tests/test-extdata.t
+++ b/tests/test-extdata.t
@@ -13,6 +13,7 @@
   > notes = notes.txt
   > shelldata = shell:cat extdata.txt | grep 2
   > emptygrep = shell:cat extdata.txt | grep empty
+  > badparse = shell:cat badparse.txt
   > EOF
   $ cat <<'EOF' > extdata.txt
   > 2 another comment on 2
@@ -58,6 +59,17 @@
   abort: unknown extdata source 'unknown'
   [255]
 
+test a zero-exiting source that emits garbage to confuse the revset parser
+
+  $ cat > badparse.txt <<'EOF'
+  > +---------------------------------------+
+  > 9de260b1e88e
+  > EOF
+
+BUG: this should print the revset parse error
+  $ hg log -qr "extdata(badparse)" 2>&1 | grep ValueError
+  ValueError: Mixing iteration and read methods would lose data
+
 test template support:
 
   $ hg log -r:3 -T "{node|short}{if(extdata('notes'), ' # {extdata('notes')}')}\n"



To: durin42, #hg-reviewers
Cc: mjpieters, mercurial-devel


More information about the Mercurial-devel mailing list