Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

head: errors on very large argument to -c but shouldn't #7166

Open
jfinkels opened this issue Jan 19, 2025 · 1 comment
Open

head: errors on very large argument to -c but shouldn't #7166

jfinkels opened this issue Jan 19, 2025 · 1 comment
Labels

Comments

@jfinkels
Copy link
Collaborator

Environment: Ubuntu 20.04, uutils main branch (git commit d39dcad), GNU coreutils v9.6.3-3189c-dirty.

Steps to reproduce:

head --bytes=-18446744073709551616000 < /dev/null

What happens now: uutils head complains that the number is too large:

head: invalid number of bytes: '18446744073709551616000': Value too large for defined data type

What I expected to happen: GNU head terminates successfully with no output.

Notes: this is causing a failure in the GNU test file tests/head/head-c.sh.

@RenjiSann
Copy link
Collaborator

Can we know what the behavior is in case the number of bytes overflows unsigned long long without actually testing it (it would be kind of costly I guess) ? Like is it said somewhere esle than the actual int type in the GNU code ?

If not, maybe we can cap the value to u64::MAX, and assume this will be enough until someone proves us otherwise.

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

No branches or pull requests

2 participants