Skip to content

cat: always exit with 1 on error - #14216

Open
mtvb wants to merge 1 commit into
uutils:mainfrom
mtvb:cat_error_counting
Open

cat: always exit with 1 on error#14216
mtvb wants to merge 1 commit into
uutils:mainfrom
mtvb:cat_error_counting

Conversation

@mtvb

@mtvb mtvb commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

I am unsure if returning the number of errors as exit code is a feature, and found the commit that introduced it.
2106ddd08 ("migrate cat code to UResult #2464")
Before it, cat_files returned Err(error_count: u32) and uumain collapsed any error into a plain exit code 1.

My commit restores this behavior, matching gnu cat.

I had to modify one test, "test_write_to_self", it was expecting exit code 2, now it will return 1.

Fixes #14215

@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/dd/misc. tests/dd/misc is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/df/over-mount-device. tests/df/over-mount-device is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/follow-name (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cat/splice is no longer failing!
Congrats! The gnu test tests/cp/cp-a-selinux is no longer failing!
Congrats! The gnu test tests/cut/cut is no longer failing!
Congrats! The gnu test tests/cut/mb-non-utf8 is no longer failing!
Congrats! The gnu test tests/dd/partial-write is no longer failing!
Congrats! The gnu test tests/expand/mb is no longer failing!
Congrats! The gnu test tests/ls/stat-free-symlinks is no longer failing!
Congrats! The gnu test tests/misc/close-stdout is no longer failing!
Congrats! The gnu test tests/mktemp/write-error is no longer failing!
Congrats! The gnu test tests/mv/dir2dir is no longer failing!
Congrats! The gnu test tests/mv/mv-exchange is no longer failing!
Congrats! The gnu test tests/nl/multibyte is no longer failing!
Congrats! The gnu test tests/od/od-float is no longer failing!
Congrats! The gnu test tests/od/od-j is no longer failing!
Congrats! The gnu test tests/ptx/ptx-overrun is no longer failing!
Congrats! The gnu test tests/sort/sort-merge-fdlimit is no longer failing!
Congrats! The gnu test tests/unexpand/mb is no longer failing!
Note: The gnu test tests/dd/fail-ftruncate-fstat was skipped on 'main' but is now failing.

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.

cat: exit code wraps to 0 (false success) on exactly a multiple of 256 failures

1 participant