--- Begin Message ---
Subject: |
Should "diff" on binary files throw an exit code 2? |
Date: |
Tue, 26 Jun 2007 21:40:09 +0200 |
User-agent: |
KMail/1.9.7 |
Hello everybody,
as the author of FSVS (http://fsvs.tigris.org/) I'm challenged with a problem,
and hope you can help.
Please keep my CC'ed, I'm not subscribed.
FSVS is one of the callers of diff; it checks the exit code (as every Good
Program should do :-).
According to the documentation
"An exit status of 0 means no differences were found, 1 means some
differences were found, and 2 means trouble."
So an exit status of 1 is simply ignored (as that's the expected result), but
for 2 FSVS currently throws an error.
Now one of the users has stumbled upon the fact that binary files cause "diff"
to return the same error code as some other unspecified error; see
http://www.mail-archive.com/users%40fsvs.tigris.org/msg00184.html for the
mail.
Now here is my problem:
1) I don't want to replicate the binary-ness check in FSVS, as that possibly
means reading both files fully - which can take arbitrary long, and is soon
after re-done by diff.
2) Always adding the "-a" switch is also not an option - for eg. mp3 files we
don't want a diff printed, that would (at least) mess up the console.
3) Just ignoring the exit code seems to be another bad way ... I'd really like
to see when "diff" has a problem.
AFAICT the best way would be to change "diff" to not return a 2 for binary
files, but a 1. That's not a completely compatible change, but returning a 3
or 0 doesn't really change the situation, or does it?
Please tell me other ideas, or what I can do to do that 'correctly'.
Thank you very much in advance!
Regards,
Phil
--
Versioning your /etc, /home or even your whole installation?
Try fsvs (fsvs.tigris.org)!
--- End Message ---
--- Begin Message ---
Subject: |
confirm 5353caf98b1ceb1fc3bc2e23f6b76af0c761c2e2 |
If you reply to this message, keeping the Subject: header intact,
Mailman will discard the held message. Do this if the message is
spam. If you reply to this message and include an Approved: header
with the list password in it, the message will be approved for posting
to the list. The Approved: header can also appear in the first line
of the body of the reply.
--- End Message ---