[Bug 232730] usr.bin/file does not return correct exit code on missing input file

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Oct 31 14:21:36 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=232730

Tobias Kortkamp <tobik at freebsd.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tobik at freebsd.org

--- Comment #1 from Tobias Kortkamp <tobik at freebsd.org> ---
(In reply to Nicola Mingotti from comment #0)
This is documented in file(1) on CURRENT:

     -E      On filesystem errors (file not found etc), instead of handling the
             error as regular output as POSIX mandates and keep going, issue an
             error message and exit.
[...]
EXIT STATUS
     file will exit with 0 if the operation was successful or >0 if an error
was
     encountered.  The following errors cause diagnostic messages, but don't
     affect the program exit code (as POSIX requires), unless -E is specified:
           •   A file cannot be found
           •   There is no permission to read a file
           •   The file type cannot be determined

So use `file -E non-existent-file` instead.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list