[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: diff: suboptimal behaviour with errors
From: |
Thomas Schwinge |
Subject: |
Re: diff: suboptimal behaviour with errors |
Date: |
Fri, 26 Mar 2004 23:37:59 +0100 |
User-agent: |
Mutt/1.3.28i |
On Thu, Mar 18, 2004 at 11:26:11AM -0800, Paul Eggert wrote:
> Thomas Schwinge <address@hidden> writes:
>
> > IMHO all these three should have different return values.
>
> Something like that might be reasonable, but what sort of return
> values do you think would be appropriate, exactly?
I would suggest something like that:
#v+
no errors, no differences: 0
no errors, differences: 1
no errors, differences, could not display all differences (i.e. binary
differences): 2
hard errors, invalid invocation (i.e. invalid command line arguments): 100
soft errors (i.e. not enough memory, inable to open files etc.): 111
#v-
This behaviour (of soft and hard errors) is used by many programs I use.
But quoting glibc's libc.info:
#v+
Exit Status
[...]
Certain programs use different nonzero status values to
indicate particular kinds of "non-success". For example, `diff'
uses status value to mean that the files are different, and
`2' or more to mean that there was difficulty in opening the files.
#v-
> I worry a bit that adding to much detail here will just confuse the
> user, and that it might be simpler to just stick with 2.
One could add a command line option to say 'also return 1 if there are
differences that are not displayable'.
But changing the return values would surely be the cleaner solution, so
I'd suggest changing them. I could work out a patch.
Regards,
Thomas