Subject: bug#7833: automake uses two different values for DejaGNU srcdir

From: Ian Lance Taylor <[email-masked]>
Date: Thu, 13 Jan 2011 12:49:12 -0800

Stefano Lattarini <[email-masked]> writes:

> Relative (as I expected):
>
>   $ cat dejagnu-srcdir-is-absolute.dir/site.exp 
>   ## these variables are automatically generated by make ##
>   # Do not edit here.  If you wish to override these values
>   # edit the last section
>   set srcdir .
>   set objdir /home/stefano/src/automake/tests/dejagnu-srcdir-is-absolute.dir
>   ## All variables above are generated by configure. Do Not Edit ##
>
> But then, why the testcase suceeds?  I would expect it to fail!

1) Does it matter?  It seems clear to me that if automake is going to
specify the srcdir in two different ways, that the two ways should use
the same value.

2) DejaGNU is a horrible program and the problem is subtle, even more
subtle than I thought.  DejaGNU loads site.exp, then uses the current
value of $srcdir to find and run the tool init script.  That is where it
was going wrong for me.  After that, it reprocesses the command line
options, setting srcdir back to what it was before.  If you create a
file "lib/tcl.exp" and add a line
    send_user "tcl.exp: $srcdir\n"
you will see that while executing tcl.exp, srcdir is ".".

Ian