Bug 548450
| Summary: | the file command returns zero exit code even in case of unexisting file being tested | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 5 | Reporter: | Martin Cermak <mcermak> | ||||
| Component: | file | Assignee: | Jan Kaluža <jkaluza> | ||||
| Status: | CLOSED ERRATA | QA Contact: | BaseOS QE Security Team <qe-baseos-security> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | low | ||||||
| Version: | 5.4 | CC: | ksrot, mmalik, ovasik | ||||
| Target Milestone: | rc | ||||||
| Target Release: | --- | ||||||
| Hardware: | All | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | file-4.17-18 | Doc Type: | Bug Fix | ||||
| Doc Text: |
The file utility can exit with the 0 exit code even if some input files have not been found. This behavior is correct; refer to the file(1) man page for more information.
|
Story Points: | --- | ||||
| Clone Of: | |||||||
| : | 580046 608686 (view as bug list) | Environment: | |||||
| Last Closed: | 2012-02-21 05:46:06 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 580046, 608686 | ||||||
| Attachments: |
|
||||||
|
Description
Martin Cermak
2009-12-17 13:52:40 UTC
This request was evaluated by Red Hat Product Management for inclusion, but this component is not scheduled to be updated in the current Red Hat Enterprise Linux release. If you would like this request to be reviewed for the next minor release, ask your support representative to set the next rhel-x.y flag to "?". Created attachment 405246 [details]
a patch
a patch to return non-zero status when error occurs
got this answer from upstream while submitting patch: --------- Imagine the scenario where we have to classify many files. What should happen if one of them does not exist/cannot be read? According to: http://www.opengroup.org/onlinepubs/009695399/utilities/file.html If file does not exist, cannot be read, or its file status could not be determined, the output shall indicate that the file was processed, but that its type could not be determined. So it is reallly not an error if something went wrong dealing with a particular file. "The output" means stdout to me. ---------- does this mean we are supposed to not use the patch and treat the whole thing as NOTABUG? We should IMHO distinguish between situation when file does not exist or cannot be read, which should end up with a non-zero exitcode. Another thing is situation where the file utility can't determine the file type - in this case I would expect a "can not determine file type" message at stdout and zero exitcode. This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unfortunately unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate and relevant, in the next release of Red Hat Enterprise Linux. This request was erroneously denied for the current release of Red Hat Enterprise Linux. The error has been fixed and this request has been re-proposed for the current release. This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unfortunately unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate and relevant, in the next release of Red Hat Enterprise Linux.
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
New Contents:
Cause: File exits with 0 exit code even some input files were not found.
This behaviour is OK according to POSIX specification and have been documented in file man page.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2012-0201.html
Technical note updated. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
Diffed Contents:
@@ -1,3 +1 @@
-Cause: File exits with 0 exit code even some input files were not found.
+The file utility can exit with the 0 exit code even if some input files have not been found. This behavior is correct; refer to the file(1) man page for more information.-
-This behaviour is OK according to POSIX specification and have been documented in file man page.
|