Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

dd: incorrect seek on oseek=1Bx2x4 #5903

Closed
jfinkels opened this issue Jan 28, 2024 · 1 comment · Fixed by #6050
Closed

dd: incorrect seek on oseek=1Bx2x4 #5903

jfinkels opened this issue Jan 28, 2024 · 1 comment · Fixed by #6050
Labels

Comments

@jfinkels
Copy link
Collaborator

jfinkels commented Jan 28, 2024

Coreutils dd v9.4.113-c01ee:

$ echo abcdefghijklm | ../gnu/src/dd oseek=1Bx2x4 bs=5 > out 2> /dev/null && cat out
^@^@^@^@^@^@^@^@abcdefghijklm

(The ^@ are null bytes.)

On uutils dd:

$ echo abcdefghijklm | ./target/debug/dd oseek=1Bx2x4 bs=5 > out 2> /dev/null && cat out
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@abcdefghijklm

This is from the GNU test suite file tests/dd/bytes.sh.

@matrixhead
Copy link
Contributor

seems like coreutil's dd treats the oseek operand as bytes if it contains a 'B' anywhere in the argument, even though it's says in the man page that it will only do so if the argument ends in a 'B' but in our implementation we only check for the 'B' at the end of the string. In this case 1Bx2x4 'B' appears not at the end of the string so it treats it as blocks and failing the test case

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants