Skip to content

Commit 74a06f8

Browse files
committed
internal/cuetxtar: error on txtar files with duplicate file entries
These could go unnoticed for a while as txtar allows them and our code happily let the last duplicated file entry win. There were two such duplicates already, both in cycle/issue990.txtar. Signed-off-by: Daniel Martí <[email protected]> Change-Id: Idb29d272534a09e455c01291a4bb20ff7df51c93 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1200855 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Roger Peppe <[email protected]>
1 parent 15fbf7f commit 74a06f8

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

Diff for: cue/testdata/cycle/issue990.txtar

-12
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,6 @@ out.subs.subs.#p: invalid structural cycle
8282
This seems to be the result of incorrect handling of disjunctions.
8383
-- diff/todo/p3 --
8484
Reordering
85-
-- diff/todo/p3 --
86-
Reordering
87-
-- out/evalalpha/stats --
88-
Leaks: 2604
89-
Freed: 263
90-
Reused: 263
91-
Allocs: 2604
92-
Retain: 0
93-
94-
Unifications: 239
95-
Conjuncts: 8656
96-
Disjuncts: 522
9785
-- out/evalalpha/stats --
9886
Leaks: 2075
9987
Freed: 218

Diff for: internal/cuetxtar/txtar.go

+3
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,9 @@ func (x *TxTarTest) run(t *testing.T, m *cuetdtest.M, f func(tc *Test)) {
483483
// Track the position of the fallback files.
484484
index := make(map[string]int, len(a.Files))
485485
for i, f := range a.Files {
486+
if _, ok := index[f.Name]; ok {
487+
t.Errorf("duplicated txtar file entry %s", f.Name)
488+
}
486489
index[f.Name] = i
487490
}
488491

0 commit comments

Comments
 (0)