Skip to content

Conversation

@CrazyRoka
Copy link
Contributor

Description:

Running ptx file file would only output the content of the file once. This caused the GNU test ptx ws.in ws.in | sort | uniq -u to fail (it expects identical output twice, which uniq -u filters out; we were outputting once, so uniq -u printed it).

Input files were stored in a HashMap keyed by filename. The second occurrence of the file overwrote the first.

Fix

Changed the internal FileMap storage to a Vec to preserve the order and multiplicity of input files.

Tests

  • Some edge cases intests/ptx/ptx-overrun.sh are now passing correctly.
  • Added regression test test_duplicate_input_files in tests/by-util/test_ptx.rs.

for word_ref in words {
let file_map_value: &FileContent = file_map
.get(&word_ref.filename)
let (_, file_map_value) = file_map
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment about what the purpose of this filtering is for? Its not the most intuitive, my understanding is that its to find which of the files you're referencing when there's duplicates but it would be good to explain how using those two values it lets you disambiguate

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or even better why it matters to have the right content reference even its the same file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants