adrianlopezroche / fdupes

FDUPES is a program for identifying or deleting duplicate files residing within specified directories.
2.42k stars 186 forks source link

Exit codes [feature request] #161

Open NicoWeio opened 2 years ago

NicoWeio commented 2 years ago

A command like fdupes x y prints

fdupes: could not chdir to x
fdupes: could not chdir to y

to stderr if the directories x and y do not exist, but the process has the exit code 0, despite obviously failing. This caused me quite a headache today, because it just assumed that fdupes would give another exit code in such a case.

I don't see anything about exit codes in this GitHub repo nor the man page, so I assume that there are none at the moment. How exactly the error codes should be defined is a question I'm not qualified to answer, but I sure hope they will be added in the future. Thank you!

adrianlopezroche commented 2 years ago

The problem is that failure to chdir into a directory isn't generally a fatal error. It can happen at any time during program execution such as during filesystem traversal any number of directories deep (via --recurse) or after having successfully processed the first n directories listed as command line arguments but failing on argument n+1.

Given all this I choose to treat failure to chdir as a warning instead of an error.

NicoWeio commented 2 years ago

I agree, that's understandable. Nonetheless, one might consider…