Bug 2296201 - fold exit code is zero for non-existent file
Summary: fold exit code is zero for non-existent file
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: 40
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Lukáš Zaoral
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-07-07 19:15 UTC by Sohum M
Modified: 2024-07-18 04:06 UTC (History)
10 users (show)

Fixed In Version: coreutils-9.4-7.fc40 coreutils-9.3-6.fc39
Clone Of:
Environment:
Last Closed: 2024-07-17 02:33:21 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Package Sources coreutils pull-request 16 0 None None None 2024-07-09 06:21:16 UTC

Description Sohum M 2024-07-07 19:15:05 UTC
Description of problem:
When using fold on a non-existent file, a zero exit code is returned.

Version-Release number of selected component (if applicable):
coreutils-9.4-6.fc40.src.rpm
Speculated to have existed since commit 66a4fe9b1acf28e5d156be7d84a2d7830a776b8b, see:
  * <https://src.fedoraproject.org/rpms/coreutils/blame/coreutils-i18n.patch?identifier=rawhide#2185>
  * <https://src.fedoraproject.org/rpms/coreutils/c/66a4fe9b1acf28e5d156be7d84a2d7830a776b8b>

Reproducible: Always

Steps to Reproduce:
1.
  $ fold badfile
  fold: badfile: No such file or directory
  $ echo "$?"
  0              # <<< should be non-zero 
Actual Results:  
The return code is successful.

Expected Results:  
If any file fails to open, the return code should be an error.

* I checked the upstream GNU coreutils sources, and they don't have this same error.
* I implemented a patch for this which should resolve it and tested it locally in a quay.io/fedora/fedora:40 container (Image: a0d555a3386f), but I'd appreciate any feedback.

Commit on my fork: https://src.fedoraproject.org/fork/ssmendon/rpms/coreutils/tree/7dd145deac885c3274b6557890e53a00e5c333b2
PR to coreutils/f40: https://src.fedoraproject.org/rpms/coreutils/pull-request/16#

Comment 1 Lukáš Zaoral 2024-07-09 06:21:17 UTC
Thank you for the report, Sohum!  I'll respond directly in the PR.

Comment 2 Fedora Update System 2024-07-15 10:58:34 UTC
FEDORA-2024-5e81f7f653 (coreutils-9.4-7.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-5e81f7f653

Comment 3 Fedora Update System 2024-07-15 10:58:37 UTC
FEDORA-2024-852cf8cfb3 (coreutils-9.3-6.fc39) has been submitted as an update to Fedora 39.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-852cf8cfb3

Comment 4 Fedora Update System 2024-07-16 01:25:39 UTC
FEDORA-2024-5e81f7f653 has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-5e81f7f653`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-5e81f7f653

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2024-07-16 02:10:28 UTC
FEDORA-2024-852cf8cfb3 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-852cf8cfb3`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-852cf8cfb3

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2024-07-17 02:33:21 UTC
FEDORA-2024-5e81f7f653 (coreutils-9.4-7.fc40) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 7 Fedora Update System 2024-07-18 04:06:07 UTC
FEDORA-2024-852cf8cfb3 (coreutils-9.3-6.fc39) has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.