shred: implement and test feature --random-source #7948
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes issue #5711.
This PR introduces the
--random-source
feature, and implements it faithfully: Copy the data from the source into the file-to-be-shredded. Note that the "random" data is not modified in any way. This is good, because no deterministic transformation can ever increase the entropy in random data; and it also makes it much simpler to verify thatshred
uses the specified source.Note that the second of the two new tests is broken because the functionality was always broken, but only now becomes more visible. See #7947.
Note that this PR is not yet sufficient to pass
shred-passes.log
. A future PR will have to adjust the test in order to accept our implementation.Note a final distinction: The GNU implementation also takes the "shuffled" order of passes from the random source (making it truly deterministic when
--random-source
is provided). However, since we don't case about determinism (only the ability to provide a different source of entropy), I don't think we should follow GNU behavior here. What do you think?