Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use standard fsck exit codes in fsck.fat #89

Open
fstirlitz opened this issue May 30, 2018 · 0 comments
Open

Use standard fsck exit codes in fsck.fat #89

fstirlitz opened this issue May 30, 2018 · 0 comments

Comments

@fstirlitz
Copy link
Contributor

fstirlitz commented May 30, 2018

Excerpt from fsck(8):

       The exit code returned by fsck is the sum of the following conditions:

              0      No errors
              1      Filesystem errors corrected
              2      System should be rebooted
              4      Filesystem errors left uncorrected
              8      Operational error
              16     Usage or syntax error
              32     Checking canceled by user request
              128    Shared-library error

The way this is implemented in /sbin/fsck is by performing bitwise OR on exit codes of the filesystem-specific fsck subprocesses it spawns; this relies on them in turn implementing the same convention in their exit codes.

fsck.fat does not conform to this standard: for example, invalid command lines result in exit code 2. Quitting at an interactive prompt results in exit code 0. The program chooses between exit codes 0 and 1 based on whether the changes were written to the file system image, not based on whether errors were detected.

Software which relies on these exit codes being used properly may perform erroneously. Apart from /sbin/fsck, this includes systemd-fsck and probably other software.

(Discovered while investigating issue #88; also subsumes #48.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants