autoconf
[Top][All Lists]
Advanced

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

Re: cmp in test scripts


From: Earnie Boyd
Subject: Re: cmp in test scripts
Date: Fri, 25 Jan 2002 08:47:50 -0500

Tim Van Holder wrote:
> 
> On Fri, 2002-01-25 at 02:09, Earnie Boyd wrote:
> > John Poltorak wrote:
> > >
> > > On Thu, Jan 24, 2002 at 06:00:36PM -0500, Earnie Boyd wrote:
> > > > John Poltorak wrote:
> > > > >
> > > > > Is there any way that autoconf can be used to handle cmp in test 
> > > > > scripts?
> > > > >
> > > > > Occasionally a test will fail because of the use of cmp to test
> > > > > differences between generated data and expected results due to line
> > > > > termination on DOS filesystems. If diff is used instead the test may
> > > > > succeed.
> > > > >
> > > > > What I'd like to see is some check to see if the use of cmp is valid 
> > > > > and
> > > > > if not then maybe set CMP=diff ...
> > > > >
> > > >
> > > > What shell are you using on the DOS filesystem?  A properly ported cmp
> > > > would be a better solution.
> > >
> > > What relevance does the shell have?
> > >
> >
> > Worlds of difference.  A properly ported shell might eliminate the
> > concern for a properly ported cmp.  Are you talking strictly MSDOS or
> > are you talking COMMAND.COM/CMD.EXE or are you talking UWIN or are you
> > talking CYGWIN or are you talking ...
> 
> A shell has absolutely NOTHING to do with how a program reads a file.
> 

Ok, I'll give you that one, I should have referenced the runtime.  I'm
guessing from other posts that the runtime is OS/2 but I'm assuming.

> > > "hello, world\n" is longer on a DOS filesystem than on Unix so cmp will
> > > distinguish between whereas diff won't.
> > >
> >
> > No it isn't.  "hello, world\n" is the same size in both worlds.  "hello,
> > world\r\n" is the same size in both worlds.  A properly ported cmp would
> > be a better method.
> 
> It IS properly ported.  cmp is supposed to compare file DATA (on a
> per-byte basis).  As such it HAS to distinguish between DOS text, Mac
> text and Unix text (and whatever other forms are there), because the
> FILES differ.
> 'diff' on the other hand, is supposed to show differences in a file's
> CONTENTS, which is a higher-level concept.  For it, text is text, and
> line endings don't necessarily have to count as different.  As such,
> diff (or diff -a, if that's a portable option) is better at determining
> difference between text files than cmp.

I agree with everything you've said except for suggesting diff as a
better solution than cmp and that the problem resides with autoconf. 
The problem as you pointed out isn't cmp.  The problem is the files of
reference.  It is often customary to need to convert from unix line
endings to dos line endings and vice versa before operating on files
from the differing platforms so the burden is still yours.  You may want
to consider modifying the program that's creating the files you're
comparing to open files in what is known as `binary mode' so that the \r
isn't prepended to the \n when writing the file.

I speak from experience.  I know that the problem can be rectified from
the user side.  I use autoconf and friends on a DOSISH platform daily. 
You need to find where the real problem resides.  You need to stop the
\r\n garbage from being generated.  It can be done.

Earnie.

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




reply via email to

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