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

Re: Problem invoking diff3.

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2002-05-15 23:31:44 CEST

Kevin Pilch-Bisson <kevin@pilch-bisson.net> writes:

> After much frustration, I discovered something strange about the way diff3
> works. It doesn't automatically invoke the diff from the same diffutils
> package. Instead it runs the first diff it finds in PATH if PATH is set,
> otherwise, it checks a some hardcoded locations. The first two are
> /usr/ccs/bin/diff and /usr/bin/diff. This is all I know about, since
> /usr/bin/diff exists and is Solaris diff, which doesn't understand the
> arguments that diff3 tries to pass it.

This sounds like a broken diff3 installation. The code for GNU diff3
calls execve() with an absolute path to diff. When I build it locally
this is what I see

Breakpoint 1, read_diff (filea=0xbffffcd8 "b", fileb=0xbffffcda "c",
    output_placement=0xbffffa68) at ./diff3.c:1151
1151 ap = argv;
(gdb) n
1152 *ap++ = diff_program;
1153 if (always_text)
1155 sprintf (horizon_arg, "--horizon-lines=%d", horizon_lines);
1156 *ap++ = horizon_arg;
1157 *ap++ = "--";
1158 *ap++ = filea;
1159 *ap++ = fileb;
1160 *ap = 0;
1162 if (pipe (fds) != 0)
(gdb) p argv[0]
$1 = 0x804bc80 "/usr/local/bin/diff"
(gdb) p argv[1]
$2 = 0xbffff974 "--horizon-lines=10"
(gdb) p argv[2]
$3 = 0x804c4c4 "--"
(gdb) p argv[3]
$4 = 0xbffffcd8 "b"
(gdb) p argv[4]
$5 = 0xbffffcda "c"

The path is a -D define in the Makefile:

$ grep -u3 DIFF_PROGRAM Makefile
infodir = $(prefix)/info

DIFF_PROGRAM = $(bindir)/`echo diff | $(edit_program_name)`
NULL_DEVICE = /dev/null
PR_PROGRAM = /usr/bin/pr

        $(COMPILE) -DNULL_DEVICE=\"$(NULL_DEVICE)\" $(srcdir)/cmp.c
diff3.o: diff3.c
        $(COMPILE) -DDIFF_PROGRAM=\"$(DIFF_PROGRAM)\" $(srcdir)/diff3.c
sdiff.o: sdiff.c
                -DDIFF_PROGRAM=\"$(DIFF_PROGRAM)\" $(srcdir)/sdiff.c
util.o: util.c
        $(COMPILE) -DPR_PROGRAM=\"$(PR_PROGRAM)\" $(srcdir)/util.c
which gives me the compile command:
gcc -c  -DHAVE_CONFIG_H -I. -I. -g -DDIFF_PROGRAM=\"/usr/local/bin/`echo diff | sed 's,x,x,'`\" ./diff3.c 
> I fixed this for that particular machine by changing the inherit_environment
> flag in svn_io_run_diff3's call to svn_io_run_cmd to TRUE, but I don't think
> this is the best solution.
> Note that this could also bite FreeBSD users who will end up with diff3
> running the hacked BSD version of diff instead of the gdiff found by
> configure.
> Anyone have an idea as to what a good solution is?
Fix your diff3 installation.
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed May 15 23:32:39 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.