Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Feb 2002 21:29:07 -0500
From:      Garance A Drosihn <drosih@rpi.edu>
To:        "M. Warner Losh" <imp@village.org>, standards@FreeBSD.ORG
Subject:   Re: diff problem
Message-ID:  <p0510141eb88a32aabb18@[128.113.24.47]>
In-Reply-To: <20020208.183640.89249665.imp@village.org>
References:  <20020208.183640.89249665.imp@village.org>

next in thread | previous in thread | raw e-mail | index | archive | help
At 6:36 PM -0700 2/8/02, M. Warner Losh wrote:
>We have a problem with out diff.  Given file foo1 and foo2.  foo1 has
>a newline at the end, while foo2 doesn't.  Diff produces:
>
>% diff -c ~/foo[12]
>*** /dell/imp/foo1      Fri Feb  8 18:05:26 2002
>--- /dell/imp/foo2      Fri Feb  8 18:05:31 2002
>***************
>*** 1 ****
>! this is a test
>--- 1 ----
>! this is a test
>%
>
>It should produce a warning about no newline at the end of the file,
>but doesn't.  At least that's my take.  What do standards have to say?

Well, I wouldn't call it a warning so much as a information/marker line
(since it's part of the diff output, and not going to stderr). The
SingleUnixSpec v3 does not mention this issue, but I know the gnu
version of diff would treat this as:

(20) diff gadtest1 gadtest2
1c1
< This is a test
---
>  This is a test
\ No newline at end of file

I also know that the fact that our diff does not do *something* useful
in this situation is rather irritating to developers of source-code
management programs, such as the 'subversion' folks.

Now you might say "But isn't that our diff?".  Well, yes, but if you
check the change log at
    http://www.FreeBSD.org/cgi/cvsweb.cgi/src/contrib/diff/util.c
you'll see that the freebsd project (in 1997) explicitly removed the
code which printed out that helpful marker line.  You can imagine
that this *really* annoys the people who are looking for that
informational marker-line to exist...

http://cvsweb.netbsd.org/bsdweb.cgi/gnusrc/gnu/dist/diffutils/util.c
implies that netbsd's diff does include the marker line.

http://www.openbsd.org/cgi-bin/cvsweb/src/gnu/usr.bin/diff/util.c
implies that openbsd's diff also includes the marker line.

Offhand, I'd say we're the weird one out, and that I don't see any
benefit in having a less informative output from diff...

-- 
Garance Alistair Drosehn            =   gad@eclipse.acs.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-standards" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p0510141eb88a32aabb18>