[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: diff3 problems

From: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2002-03-14 22:24:14 CET

Ben Collins-Sussman <sussman@collab.net> writes:

> My fear is that this is another Linux/BSD discrepancy.

Oh, lordy. Here we go again. Karl and I came up with a script that
produces *different* behavior on FreeBSD vs. Linux. Everyone take a
look at this script, or try it out. On Linux, there's no extra
newline added. On FreeBSD, there is.

(Note that my FreeBSD's 'diff3' binary still claims to be version 2.7,
from GNU diffutils. I wonder if it's hacked, though...)

-----------------------
#!/bin/sh

### Invoke with no arguments to see if your diff3 adds an extra
### newline to its output when the input lacks a final newline.
###
### Note: You need 'echo -n' for this script to work right.

## Set up older.txt
echo "This is line 1." > older.txt
echo "This is line 2." >> older.txt
echo "This is line 3." >> older.txt
echo "This is line 4." >> older.txt
echo "This is line 5." >> older.txt
echo "This is line 6." >> older.txt
echo "This is line 7." >> older.txt
echo "This is line 8." >> older.txt
echo "This is line 9." >> older.txt
echo -n "This is line 10." >> older.txt

## Set up mine.txt
echo "This is a non-conflicting change to line 1." > mine.txt
echo "This is line 2." >> mine.txt
echo "This is line 3." >> mine.txt
echo "This is line 4." >> mine.txt
echo "This is line 5." >> mine.txt
echo "This is line 6." >> mine.txt
echo "This is line 7." >> mine.txt
echo "This is line 8." >> mine.txt
echo "This is line 9." >> mine.txt
echo -n "This is line 10." >> mine.txt

## Set up yours.txt
echo "This is line 1." > yours.txt
echo "This is line 2." >> yours.txt
echo "This is line 3." >> yours.txt
echo "This is line 4." >> yours.txt
echo "This is line 5." >> yours.txt
echo "This is line 6." >> yours.txt
echo "This is line 7." >> yours.txt
echo "This is line 8." >> yours.txt
echo "This is line 9." >> yours.txt
echo -n "This is line 10 plus some, but still no trailing newline." >> yours.txt

## Demonstrate the behavior.
diff3 -A -m mine.txt older.txt yours.txt
echo "XXX"

echo ""
echo "(If the XXX appears at the end of line 10, then your diff3 does not"
echo "add a spurious newline. But if the XXX appears on its own line, then"
echo "diff3 added a newline not present in any of the original data; in"
echo "which case, please mail dev@subversion.tigris.org stating your"
echo "operating system and the output of 'diff3 --version'.)"
echo ""

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Mar 14 22:25:21 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.