[Top][All Lists]

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

Re: configure scripts rely on "diff"; could use "cmp" instead if availab

From: Bob Friesenhahn
Subject: Re: configure scripts rely on "diff"; could use "cmp" instead if available
Date: Fri, 27 May 2011 12:39:10 -0500 (CDT)
User-agent: Alpine 2.01 (GSO 1266 2009-07-14)

On Fri, 27 May 2011, Paul Eggert wrote:

On 05/27/11 07:18, Bob Friesenhahn wrote:
It seems wise to always use the most simple and most common utility to perform 
the necessary task.

For the tasks of comparing text files and reporting a problem when there
is a difference, it's typically better to use 'diff' than 'cmp',
because the output is a more useful diagnostic.  Let's not change
Autoconf to use 'cmp' by default.

I can agree with that. If 'diff' is not available, it reasonable to fall-back to 'cmp' if 'cmp' is available?

Busybox could trivially support 'diff' by using a terrible diff
algorithm.  This would conform to POSIX and would make the
autoconf-generated scripts work (albeit not much better than
'cmp' would).

My experience with Busybox to date is that its utilities are not nearly as advanced or friendly as GNU versions, but that they still do something useful. My Busybox does have diff enabled and this is its help output:

~ # diff --help
BusyBox v1.17.2 (2011-05-17 10:34:28 CDT) multi-call binary.

Usage: diff [-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2

Compare files line by line and output the differences between them.
This implementation supports unified diffs only.

        -a      Treat all files as text
        -b      Ignore changes in the amount of whitespace
        -B      Ignore changes whose lines are all blank
        -d      Try hard to find a smaller set of changes
        -i      Ignore case differences
        -L      Use LABEL instead of the filename in the unified header
        -N      Treat absent files as empty
        -q      Output only whether files differ
        -r      Recurse
        -S      Start with FILE when comparing directories
        -T      Make tabs line up by prefixing a tab when necessary
        -s      Report when two files are the same
        -t      Expand tabs to spaces in output
        -U      Output LINES lines of context
        -w      Ignore all whitespace

While BusyBox normally appears on embedded systems, which are rarely used for software development, it may also appear on Live CD (or USB-stick) distributions for which the ability to build software might be useful.

Bob Friesenhahn
GraphicsMagick Maintainer,

reply via email to

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