bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

info diff - diff exitcodes (and perhaps wrong exitcodes in diff)


From: Christian Boltz
Subject: info diff - diff exitcodes (and perhaps wrong exitcodes in diff)
Date: Tue, 14 Oct 2003 21:07:07 +0200
User-agent: KMail/1.5.3

Hello,

(you may answer in German if you want)

I use   diff (GNU diffutils) 2.8.1   on SuSE Linux 8.2.

There is an unclear statement in "info diff":

| An exit status of 0 means no differences were found, 1 means some
| differences were found, and 2 means trouble.

This sentence can be misinterpreted - what does "means trouble" mean?
IMHO, it means trouble to programmers that use diff in their scripts ;-)

I use diff to compare fonts (see mail signature) and expected the 
exitcode ($?) beeing  1  when calling   diff '1.ttf' '2.ttf' on 
different files. Instead, I get exitcode  2.

(I could resolve the problem by using   diff -q '1.ttf' '2.ttf' which 
returns the expected exitcode 1 on different binaries.)

improvement suggestion for 'info diff':
===
Exit status
- 0 means no differences were found
- 1 means some differences were found and (if not using -q) a patch
  could be created
- 2 means trouble. Reasons for this can be:
  - differences in binary files and -q was *not* given
  - one of the given files does not exist or is not readable
  - ...
===


BTW: perhaps there's a wrong exitcode in diff. When calling
    diff -r dir1/ dir2/   # *without* -N
I get a message
    Only in dir1/: file1
with $? = 1, but the resulting patch is not complete (file1 is missing 
in it). Shouldn't the exitcode also be 2 in this case?

If you change this, add the following to the reaons for exitcode 2:
  - a file exists only in one directory when comparing recursively and
    -N was *not* given
  - or shorter: the displayed patch is incomplete [1]


Yours,

Christian Boltz

[1] concerns the -q and the -N option
-- 
Fontlinge developer
Fontlinge - font management for Linux / Schriftenverwaltung for Linux
Infos and Download: http://www.gesindel.de





reply via email to

[Prev in Thread] Current Thread [Next in Thread]