+
Skip to content

Conversation

BenWiederhake
Copy link
Collaborator

Inspired by #6167: #6175 is a bug in uutils, caused by an unexpectedly empty string.

Note that the empty string regularly causes interesting behavior:

$ echo hello world | hd
00000000  68 65 6c 6c 6f 20 77 6f  72 6c 64 0a              |hello world.|
0000000c
$ echo hello "" world | hd # Additional space!
00000000  68 65 6c 6c 6f 20 20 77  6f 72 6c 64 0a           |hello  world.|
0000000d

(uutils already behaves correctly here.)

However, uutils sometimes doesn't behave correctly. To prove my point, I just found this bug merely by inserting the empty string in various places:

$ rm -rf target/test/; mkdir target/test/; cp LICENSE "" README.md target/test/; echo "EXITCODE GNU: $?"; ls -l target/test/; echo "(end)"      
cp: cannot stat '': No such file or directory
EXITCODE GNU: 1
total 12
-rw-r--r-- 1 user user 1056 Apr  1 21:12 LICENSE
-rw-r--r-- 1 user user 7973 Apr  1 21:12 README.md
(end)
$ rm -rf target/test/; mkdir target/test/; cargo run cp LICENSE "" README.md target/test/; echo "EXITCODE uutils: $?"; ls -l target/test/; echo "(end)"
    Finished dev [unoptimized + debuginfo] target(s) in 0.13s
     Running `target/debug/coreutils cp LICENSE '' README.md target/test/`
error: a value is required for '[paths]...' but none was supplied

For more information, try '--help'.
EXITCODE uutils: 1
total 0
(end)

I hope this is enough motivation that we should include the empty string during fuzzing.

Inspired by uutils#6167, uutils#6175, and the observation that 'echo hello "" world | hd' outputs extra spaces.
@sylvestre
Copy link
Contributor

sounds good, thanks :)

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

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载