[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: Kevin Pilch-Bisson <kevin_at_pilch-bisson.net>
Date: 2002-05-15 23:31:49 CEST

On Wed, May 15, 2002 at 10:31:44PM +0100, Philip Martin wrote:
> 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

Actually, before making the fix I just mentioned I decided to investigate the
matter a little more.

ftp.gnu.org has three versions of diffutils available: 2.7, 2.8, and 2.8.1.

2.7 behaves as you describe, 2.8 and 2.8.1 do as I describe, but have a
--diff-program=/path/to/diff argument which we could use. However, this means
we need to check the version of diff3 in configure. Yuck :(
>
> 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;
> (gdb)
> 1153 if (always_text)
> (gdb)
> 1155 sprintf (horizon_arg, "--horizon-lines=%d", horizon_lines);
> (gdb)
> 1156 *ap++ = horizon_arg;
> (gdb)
> 1157 *ap++ = "--";
> (gdb)
> 1158 *ap++ = filea;
> (gdb)
> 1159 *ap++ = fileb;
> (gdb)
> 1160 *ap = 0;
> (gdb)
> 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
>
> DEFAULT_EDITOR_PROGRAM = ed
> 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
> $(COMPILE) -DDEFAULT_EDITOR_PROGRAM=\"$(DEFAULT_EDITOR_PROGRAM)\" \
> -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.
>
> --
> Philip
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kevin Pilch-Bisson                    http://www.pilch-bisson.net
     "Historically speaking, the presences of wheels in Unix
     has never precluded their reinvention." - Larry Wall
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  • application/pgp-signature attachment: stored
Received on Wed May 15 23:36:39 2002

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