Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Oct 2018 14:21:34 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 232730] usr.bin/file does not return correct exit code on missing input file
Message-ID:  <bug-232730-227-lkEdbj4Ize@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-232730-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-232730-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D232730

Tobias Kortkamp <tobik@freebsd.org> changed:

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

--- Comment #1 from Tobias Kortkamp <tobik@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, issu=
e 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 specifi=
ed:
           =E2=80=A2   A file cannot be found
           =E2=80=A2   There is no permission to read a file
           =E2=80=A2   The file type cannot be determined

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

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-232730-227-lkEdbj4Ize>