uutils / uutils/coreutils

`dd` fails on GNU test `tests/dd/no-allocate.sh` - due to beeing more efficient

Open
#6,081 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

U - dd
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

I investigated what this test is doing and the reason on why this test is failing.

It tests with a strict limit on the usable virtual memory the internal behaviour of dd by setting a large (30M) block_size ("ibs", "obs" and "bs") and expects certain behaviour regarding when the memory for these block-sizes are allocated and not allocated.

This way the test can validade

  1. the correct behaviour for the cases where the memory should not be allocated.
  2. AND it can test cases where it expects it to be allocated by testing for unsuccessfull return code.

Now, the problem with uutils is, that it is more efficient than GNU and does not need to allocate the buffer when the test expects it to do so (for seek and skip operations). It uses io::copy(src, dst) where the dst is some dummy data sink that just ignores every write. Thus no buffer is to be allocated.
Thats why the test is red.

I successfully proved this theory by artificially allocate the memory in the expected cases. I'll link the PR to this issue.

The only remaining issue could be that dd should do only one single read per block instead of multiples. I'm not sure what the io::copy() is doing internally.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/dd/no-allocate.sh and trace the dd implementation that uses io::copy for seek and skip operations. Verify whether the test's allocation expectations and the possible multiple-read behavior match the intended dd semantics. Done means the test and implementation agree on the required behavior and the GNU test passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.