GNU bug report logs - #7833
automake uses two different values for DejaGNU srcdir

Previous Next

Package: automake;

Reported by: Ian Lance Taylor <iant <at> google.com>

Date: Wed, 12 Jan 2011 22:05:01 UTC

Severity: normal

Tags: patch

Done: Stefano Lattarini <stefano.lattarini <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 7833 in the body.
You can then email your comments to 7833 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Wed, 12 Jan 2011 22:05:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ian Lance Taylor <iant <at> google.com>:
New bug report received and forwarded. Copy sent to bug-automake <at> gnu.org. (Wed, 12 Jan 2011 22:05:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ian Lance Taylor <iant <at> google.com>
To: bug-automake <at> gnu.org
Subject: automake uses two different values for DejaGNU srcdir
Date: Wed, 12 Jan 2011 13:52:09 -0800
When automake is configured to use DejaGNU, it uses two different values
for srcdir.  There are two different cases in lib/am/dejagnu.am:

The first is in check-DEJAGNU:

check-DEJAGNU: site.exp
## Life is easiest with an absolute srcdir, so do that.
	srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \

This value is passed to runtest with a --srcdir option.

The second is in site.exp:

site.exp: Makefile
	@echo 'Making a new site.exp file...'
	@echo '## these variables are automatically generated by make ##' >site.tmp
	@echo '# Do not edit here.  If you wish to override these values' >>site.tmp
	@echo '# edit the last section' >>site.tmp
	@echo 'set srcdir $(srcdir)' >>site.tmp

This value is read by DejaGNU after option processing is complete,
effectively overwriting the value passed with the --srcdir option.

The value of srcdir stored in site.exp should be an absolute path, just
like the value passed to runtest via --srcdir.

Ian




Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Thu, 13 Jan 2011 07:08:02 GMT) Full text and rfc822 format available.

Message #8 received at 7833 <at> debbugs.gnu.org (full text, mbox):

From: Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>
To: Ian Lance Taylor <iant <at> google.com>
Cc: 7833 <at> debbugs.gnu.org
Subject: Re: bug#7833: automake uses two different values for DejaGNU srcdir
Date: Thu, 13 Jan 2011 08:15:19 +0100
Hello Ian,

thanks for the bug report.

* Ian Lance Taylor wrote on Wed, Jan 12, 2011 at 10:52:09PM CET:
> When automake is configured to use DejaGNU, it uses two different values
> for srcdir.  There are two different cases in lib/am/dejagnu.am:

> check-DEJAGNU: site.exp
> ## Life is easiest with an absolute srcdir, so do that.
> 	srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \

> site.exp: Makefile
[...]
> 	@echo 'set srcdir $(srcdir)' >>site.tmp
> 
> This value is read by DejaGNU after option processing is complete,
> effectively overwriting the value passed with the --srcdir option.
> 
> The value of srcdir stored in site.exp should be an absolute path, just
> like the value passed to runtest via --srcdir.

I see that passing different values is probably not a good idea.
Passing absolute values will probably break builds in a directory
tree where some higher-up name component contains spaces, not uncommon
on w32 systems.  ATM Automake should produce makefiles that work in such
environments, as long as $(srcdir) is relative and does not contain
spaces.  IIUC then using an absolute directory name would break this.
Can we avoid it with suitable quoting?

Also, this would break moving both source and build trees (in a way that
would let relative $(srcdir) remain valid).  I'm not quite sure how good
we are elsewhere on this front, and it is not such an important feature,
but any chance we can retain it?

Am I correct in assuming that it is hopeless to assume GCC will work
when either values are relative?

Cheers,
Ralf




Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Thu, 13 Jan 2011 12:46:02 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: bug-automake <at> gnu.org
Cc: 7833 <at> debbugs.gnu.org, Ian Lance Taylor <iant <at> google.com>
Subject: Re: bug#7833: automake uses two different values for DejaGNU srcdir
Date: Thu, 13 Jan 2011 13:52:32 +0100
[Message part 1 (text/plain, inline)]
Hello Ian.

On Wednesday 12 January 2011, Ian Lance wrote:
> When automake is configured to use DejaGNU, it uses two different values
> for srcdir.  There are two different cases in lib/am/dejagnu.am:
> 
> The first is in check-DEJAGNU:
> 
> check-DEJAGNU: site.exp
> ## Life is easiest with an absolute srcdir, so do that.
> 	srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
> 
> This value is passed to runtest with a --srcdir option.
> 
> The second is in site.exp:
> 
> site.exp: Makefile
> 	@echo 'Making a new site.exp file...'
> 	@echo '## these variables are automatically generated by make ##' >site.tmp
> 	@echo '# Do not edit here.  If you wish to override these values' >>site.tmp
> 	@echo '# edit the last section' >>site.tmp
> 	@echo 'set srcdir $(srcdir)' >>site.tmp
> 
> This value is read by DejaGNU after option processing is complete,
> effectively overwriting the value passed with the --srcdir option.
> 
> The value of srcdir stored in site.exp should be an absolute path, just
> like the value passed to runtest via --srcdir.
>
Are you sure about this?  Why then is the attached testcase working
(for me at least)?

Please note that I'm a total Tcl/DejaGnu noob, so it might likely be
that I'm missing something obvious here.  In that case, just point out
my mistake, and sorry in advance!

Regards,
   Stefano
[dejagnu-srcdir-is-absolute.test (application/x-shellscript, inline)]

Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Thu, 13 Jan 2011 12:46:02 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Thu, 13 Jan 2011 17:23:02 GMT) Full text and rfc822 format available.

Message #17 received at 7833 <at> debbugs.gnu.org (full text, mbox):

From: Ian Lance Taylor <iant <at> google.com>
To: Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>
Cc: 7833 <at> debbugs.gnu.org
Subject: Re: bug#7833: automake uses two different values for DejaGNU srcdir
Date: Thu, 13 Jan 2011 09:29:39 -0800
Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de> writes:

> Am I correct in assuming that it is hopeless to assume GCC will work
> when either values are relative?

Actually, as far as I know, GCC is likely to work with a relative
srcdir.  The problem arises with DejaGNU .exp files which themselves
change directories.  As far as I know, the GCC DejaGNU files do not do
that.

Ian




Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Thu, 13 Jan 2011 17:24:01 GMT) Full text and rfc822 format available.

Message #20 received at 7833 <at> debbugs.gnu.org (full text, mbox):

From: Ian Lance Taylor <iant <at> google.com>
To: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Cc: 7833 <at> debbugs.gnu.org
Subject: Re: bug#7833: automake uses two different values for DejaGNU srcdir
Date: Thu, 13 Jan 2011 09:31:23 -0800
Stefano Lattarini <stefano.lattarini <at> gmail.com> writes:

> Are you sure about this?  Why then is the attached testcase working
> (for me at least)?

I guess I'm not sure what point you are trying to make with your
example.  A relative srcdir will sometimes work and sometimes fail.  It
seemed to me an absolute srcdir should always work, but Ralf has pointed
out a somewhat obscure case where it too can fail.  Either way, it makes
no sense for automake to use two different values for srcdir.  It should
pick one and stick to it.

Ian




Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Thu, 13 Jan 2011 19:20:03 GMT) Full text and rfc822 format available.

Message #23 received at 7833 <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: Ian Lance Taylor <iant <at> google.com>
Cc: 7833 <at> debbugs.gnu.org
Subject: Re: bug#7833: automake uses two different values for DejaGNU srcdir
Date: Thu, 13 Jan 2011 20:26:26 +0100
On Thursday 13 January 2011, Ian Lance wrote:
> Stefano Lattarini <stefano.lattarini <at> gmail.com> writes:
> 
> > Are you sure about this?  Why then is the attached testcase working
> > (for me at least)?
> 
> I guess I'm not sure what point you are trying to make with your
> example.  A relative srcdir will sometimes work and sometimes fail.  It
> seemed to me an absolute srcdir should always work, but Ralf has pointed
> out a somewhat obscure case where it too can fail.  Either way, it makes
> no sense for automake to use two different values for srcdir.  It should
> pick one and stick to it.
> 
Yes, but my testcase *should* show (at least in my understanding)
that in the dejagnu tests both the TCL-level '$srcdir' variable and
the environment variable 'srcdir' contain an absolute path, even
when the Makefile variable $(srcdir) contains a relative path (in
this case, `.').

Regards,
  Stefano




Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Thu, 13 Jan 2011 20:06:01 GMT) Full text and rfc822 format available.

Message #26 received at 7833 <at> debbugs.gnu.org (full text, mbox):

From: Ian Lance Taylor <iant <at> google.com>
To: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Cc: 7833 <at> debbugs.gnu.org
Subject: Re: bug#7833: automake uses two different values for DejaGNU srcdir
Date: Thu, 13 Jan 2011 12:12:45 -0800
Stefano Lattarini <stefano.lattarini <at> gmail.com> writes:

> On Thursday 13 January 2011, Ian Lance wrote:
>> Stefano Lattarini <stefano.lattarini <at> gmail.com> writes:
>> 
>> > Are you sure about this?  Why then is the attached testcase working
>> > (for me at least)?
>> 
>> I guess I'm not sure what point you are trying to make with your
>> example.  A relative srcdir will sometimes work and sometimes fail.  It
>> seemed to me an absolute srcdir should always work, but Ralf has pointed
>> out a somewhat obscure case where it too can fail.  Either way, it makes
>> no sense for automake to use two different values for srcdir.  It should
>> pick one and stick to it.
>> 
> Yes, but my testcase *should* show (at least in my understanding)
> that in the dejagnu tests both the TCL-level '$srcdir' variable and
> the environment variable 'srcdir' contain an absolute path, even
> when the Makefile variable $(srcdir) contains a relative path (in
> this case, `.').

Take a look at the site.exp file and see what value is in there for
srcdir: relative or absolute?

Ian




Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Thu, 13 Jan 2011 20:14:01 GMT) Full text and rfc822 format available.

Message #29 received at 7833 <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: Ian Lance Taylor <iant <at> google.com>
Cc: 7833 <at> debbugs.gnu.org
Subject: Re: bug#7833: automake uses two different values for DejaGNU srcdir
Date: Thu, 13 Jan 2011 21:21:06 +0100
On Thursday 13 January 2011, Ian Lance wrote:
> Stefano Lattarini <stefano.lattarini <at> gmail.com> writes:
> 
> > On Thursday 13 January 2011, Ian Lance wrote:
> >> Stefano Lattarini <stefano.lattarini <at> gmail.com> writes:
> >> 
> >> > Are you sure about this?  Why then is the attached testcase working
> >> > (for me at least)?
> >> 
> >> I guess I'm not sure what point you are trying to make with your
> >> example.  A relative srcdir will sometimes work and sometimes fail.  It
> >> seemed to me an absolute srcdir should always work, but Ralf has pointed
> >> out a somewhat obscure case where it too can fail.  Either way, it makes
> >> no sense for automake to use two different values for srcdir.  It should
> >> pick one and stick to it.
> >> 
> > Yes, but my testcase *should* show (at least in my understanding)
> > that in the dejagnu tests both the TCL-level '$srcdir' variable and
> > the environment variable 'srcdir' contain an absolute path, even
> > when the Makefile variable $(srcdir) contains a relative path (in
> > this case, `.').
> 
> Take a look at the site.exp file and see what value is in there for
> srcdir: relative or absolute?
>
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!

Thanks,
  Stefano




Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Thu, 13 Jan 2011 20:43:02 GMT) Full text and rfc822 format available.

Message #32 received at 7833 <at> debbugs.gnu.org (full text, mbox):

From: Ian Lance Taylor <iant <at> google.com>
To: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Cc: 7833 <at> debbugs.gnu.org
Subject: Re: bug#7833: automake uses two different values for DejaGNU srcdir
Date: Thu, 13 Jan 2011 12:49:12 -0800
Stefano Lattarini <stefano.lattarini <at> gmail.com> 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




Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Thu, 13 Jan 2011 21:01:01 GMT) Full text and rfc822 format available.

Message #35 received at 7833 <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: Ian Lance Taylor <iant <at> google.com>
Cc: 7833 <at> debbugs.gnu.org
Subject: Re: bug#7833: automake uses two different values for DejaGNU srcdir
Date: Thu, 13 Jan 2011 22:04:27 +0100
On Thursday 13 January 2011, Ian Lance wrote:
> Stefano Lattarini <stefano.lattarini <at> gmail.com> 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?
>
IMHO yes (a little).  Today I set out to fix this simple bug, but first
I wanted to write a testcase to expose it.  Well, I haven't been able to
do so!

> 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.
>
I agree with this.

> 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 ".".
>
Thanks for this explanation!  I will use it to fix my testcase.

Regards,
  Stefano




Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Fri, 14 Jan 2011 21:59:02 GMT) Full text and rfc822 format available.

Message #38 received at 7833 <at> debbugs.gnu.org (full text, mbox):

From: Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>
To: Ian Lance Taylor <iant <at> google.com>, automake-patches <at> gnu.org
Cc: 7833 <at> debbugs.gnu.org
Subject: Re: bug#7833: automake uses two different values for DejaGNU srcdir
Date: Fri, 14 Jan 2011 23:05:58 +0100
* Ian Lance Taylor wrote on Thu, Jan 13, 2011 at 06:29:39PM CET:
> Ralf Wildenhues writes:
> 
> > Am I correct in assuming that it is hopeless to assume GCC will work
> > when either values are relative?
> 
> Actually, as far as I know, GCC is likely to work with a relative
> srcdir.  The problem arises with DejaGNU .exp files which themselves
> change directories.  As far as I know, the GCC DejaGNU files do not do
> that.

Thanks for the feedback.

Through testing I found out again that DejaGNU does not cope with white
space in absolute directory names anyway, regardless of srcdir being
relative or absolute.  That obviates my first point.  Remains only the
fairly minor src+build-tree relocatability point.

I have these two alternative patches which I would both be happy with.
I should note that the "Life is easiest" comment dates back to the very
first addition of dejagnu support in Automake, from way before recorded
history where we could learn from a related bug.

Tried both in a multilib target directory in the GCC tree, both seem to
work.  Any preferences, from a DejaGNU standpoint?

Thanks,
Ralf

   * lib/am/dejagnu.am (check-DEJAGNU): Set srcdir to be relative,
   consistent with the --srcdir argument and the srcdir setting in
   site.exp.
   Report by Ian Lance Taylor in automake bug#7833.

--- am/dejagnu.am.orig	2011-01-14 20:27:32.000000000 +0100
+++ am/dejagnu.am.1	2011-01-14 20:27:38.000000000 +0100
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2006
+## Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2006, 2011
 ## Free Software Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
@@ -43,8 +43,7 @@
 
 .PHONY: check-DEJAGNU
 check-DEJAGNU: site.exp
-## Life is easiest with an absolute srcdir, so do that.
-	srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+	srcdir='$(srcdir)'; export srcdir; \
 	EXPECT=$(EXPECT); export EXPECT; \
 ## Allow this to work when expect and DejaGnu are in tree.
 ## Only required when --cygnus in force.




   * lib/am/dejagnu.am (RUNTESTDEFAULTFLAGS): Quote argument
   to --srcdir.
   (site.exp): Set srcdir to "$(abs_srcdir)".
   Report by Ian Lance Taylor in automake bug#7833.

--- am/dejagnu.am.orig	2011-01-14 20:27:32.000000000 +0100
+++ am/dejagnu.am.2	2011-01-14 20:20:22.000000000 +0100
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2006
+## Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2006, 2011
 ## Free Software Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
@@ -19,7 +19,7 @@
 DEJATOOL = $(PACKAGE)
 
 ## Default flags to pass to dejagnu.  The user can override this.
-RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
+RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir "$$srcdir"
 
 ## In Cygnus mode, these are found in the build tree.
 ## Otherwise they are looked for in $PATH.
@@ -77,7 +77,7 @@
 	@echo '## these variables are automatically generated by make ##' >site.tmp
 	@echo '# Do not edit here.  If you wish to override these values' >>site.tmp
 	@echo '# edit the last section' >>site.tmp
-	@echo 'set srcdir $(srcdir)' >>site.tmp
+	@echo 'set srcdir "$(abs_srcdir)"' >>site.tmp
 	@echo "set objdir `pwd`" >>site.tmp
 ## Quote the *_alias variables because they might be empty.
 ?BUILD?	@echo 'set build_alias "$(build_alias)"' >>site.tmp




Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Sat, 15 Jan 2011 15:26:02 GMT) Full text and rfc822 format available.

Message #41 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Peter Breitenlohner <peb <at> mppmu.mpg.de>
To: Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>
Cc: 7833 <at> debbugs.gnu.org, owner <at> debbugs.gnu.org,
	Ian Lance Taylor <iant <at> google.com>, bug-automake <at> gnu.org,
	automake-patches <at> gnu.org
Subject: Re: bug#7833: automake uses two different values for DejaGNU
 srcdir
Date: Sat, 15 Jan 2011 16:22:32 +0100 (CET)
On Fri, 14 Jan 2011, Ralf Wildenhues wrote:

> Through testing I found out again that DejaGNU does not cope with white
> space in absolute directory names anyway, regardless of srcdir being
> relative or absolute.  That obviates my first point.  Remains only the
> fairly minor src+build-tree relocatability point.

Hi Ralf,

I remember a problem with gcc's 'make check' that could be related.  Some
tests failed when `pwd -L` was different from `pwd -P`, presumably due to
the two different srcdir's.

I could avoid this problem by first doing 'cd `pwd -P`'.

Regards
Peter Breitenlohner <peb <at> mppmu.mpg.de>




Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Sat, 15 Jan 2011 15:26:03 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Sun, 16 Jan 2011 14:03:02 GMT) Full text and rfc822 format available.

Message #47 received at 7833 <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: automake-patches <at> gnu.org
Cc: 7833 <at> debbugs.gnu.org, Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>,
	Ian Lance Taylor <iant <at> google.com>
Subject: Re: bug#7833: automake uses two different values for DejaGNU srcdir
Date: Sun, 16 Jan 2011 15:09:15 +0100
[Message part 1 (text/plain, inline)]
Hello Ralf, and sorry for the late reply.

On Friday 14 January 2011, Ralf Wildenhues wrote:
> * Ian Lance Taylor wrote on Thu, Jan 13, 2011 at 06:29:39PM CET:
> > Ralf Wildenhues writes:
> > 
> > > Am I correct in assuming that it is hopeless to assume GCC will work
> > > when either values are relative?
> > 
> > Actually, as far as I know, GCC is likely to work with a relative
> > srcdir.  The problem arises with DejaGNU .exp files which themselves
> > change directories.  As far as I know, the GCC DejaGNU files do not do
> > that.
> 
> Thanks for the feedback.
> 
> Through testing I found out again that DejaGNU does not cope with white
> space in absolute directory names anyway, regardless of srcdir being
> relative or absolute.
>
While trying to cook up some test cases, I experienced this too, but I
thought it was due to my lack of experience and knowledge of DejaGnu.
Thanks for saving me some other useless efforts!

> That obviates my first point.  Remains only the
> fairly minor src+build-tree relocatability point.
> 
> I have these two alternative patches which I would both be happy with.
>
FWIW, I had preperad a patch also, which is basically your second patch
with a testcase added (kudos to Ian Taylor for his suggestion of how to
expose the bug).  It's attached for reference.

BTW, even if you decide to go with your first patch at last, it should
be possible to easily modify the testcase to have it do checks opposite
to the ones it currently does, and thus reuse it.

> I should note that the "Life is easiest" comment dates back to the very
> first addition of dejagnu support in Automake, from way before recorded
> history where we could learn from a related bug.
> 
> Tried both in a multilib target directory in the GCC tree, both seem to
> work.  Any preferences, from a DejaGNU standpoint?
>
> Thanks,
> Ralf
> 
>    * lib/am/dejagnu.am (check-DEJAGNU): Set srcdir to be relative,
>    consistent with the --srcdir argument and the srcdir setting in
>    site.exp.
>    Report by Ian Lance Taylor in automake bug#7833.
> 
> --- am/dejagnu.am.orig	2011-01-14 20:27:32.000000000 +0100
> +++ am/dejagnu.am.1	2011-01-14 20:27:38.000000000 +0100
> @@ -1,5 +1,5 @@
>  ## automake - create Makefile.in from Makefile.am
> -## Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2006
> +## Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2006, 2011
>  ## Free Software Foundation, Inc.
>  
>  ## This program is free software; you can redistribute it and/or modify
> @@ -43,8 +43,7 @@
>  
>  .PHONY: check-DEJAGNU
>  check-DEJAGNU: site.exp
> -## Life is easiest with an absolute srcdir, so do that.
> -	srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
> +	srcdir='$(srcdir)'; export srcdir; \
>  	EXPECT=$(EXPECT); export EXPECT; \
>  ## Allow this to work when expect and DejaGnu are in tree.
>  ## Only required when --cygnus in force.
> 
> 
> 
> 
>    * lib/am/dejagnu.am (RUNTESTDEFAULTFLAGS): Quote argument
>    to --srcdir.
>    (site.exp): Set srcdir to "$(abs_srcdir)".
>    Report by Ian Lance Taylor in automake bug#7833.
> 
> --- am/dejagnu.am.orig	2011-01-14 20:27:32.000000000 +0100
> +++ am/dejagnu.am.2	2011-01-14 20:20:22.000000000 +0100
> @@ -1,5 +1,5 @@
>  ## automake - create Makefile.in from Makefile.am
> -## Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2006
> +## Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2006, 2011
>  ## Free Software Foundation, Inc.
>  
>  ## This program is free software; you can redistribute it and/or modify
> @@ -19,7 +19,7 @@
>  DEJATOOL = $(PACKAGE)
>  
>  ## Default flags to pass to dejagnu.  The user can override this.
> -RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
> +RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir "$$srcdir"
>  
>  ## In Cygnus mode, these are found in the build tree.
>  ## Otherwise they are looked for in $PATH.
> @@ -77,7 +77,7 @@
>  	@echo '## these variables are automatically generated by make ##' >site.tmp
>  	@echo '# Do not edit here.  If you wish to override these values' >>site.tmp
>  	@echo '# edit the last section' >>site.tmp
> -	@echo 'set srcdir $(srcdir)' >>site.tmp
> +	@echo 'set srcdir "$(abs_srcdir)"' >>site.tmp
>  	@echo "set objdir `pwd`" >>site.tmp
>  ## Quote the *_alias variables because they might be empty.
>  ?BUILD?	@echo 'set build_alias "$(build_alias)"' >>site.tmp
> 
> 

Regards,
  Stefano
[0001-dejagnu-ensure-srcdir-is-defined-as-an-absolute-dire.patch (text/x-patch, inline)]
From 19e0ff24229cdb8560d555300e39977ac12bfffa Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Date: Thu, 13 Jan 2011 20:33:26 +0100
Subject: [PATCH] dejagnu: ensure 'srcdir' is defined as an absolute directory

This change fixes automake bug#7833.

* lib/am/dejagnu.am (check-DEJAGNU): Prefer using $(abs_srcdir)
over getting the absolute path of $(srcdir) dynamically.
(site.exp): Use $(abs_srcdir) instead of $(srcdir) when defining
TCL variable 'srcdir'.
* tests/dejagnu-absolute-dirs.test: New test.
* tests/Makefile.am (TESTS): Update.

Report and suggestions by Ian Lance Taylor.
---
 ChangeLog                        |   12 +++++
 lib/am/dejagnu.am                |    4 +-
 tests/Makefile.am                |    1 +
 tests/Makefile.in                |    1 +
 tests/dejagnu-absolute-dirs.test |   92 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 108 insertions(+), 2 deletions(-)
 create mode 100755 tests/dejagnu-absolute-dirs.test

diff --git a/ChangeLog b/ChangeLog
index be35937..6f00b10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-01-15  Stefano Lattarini  <stefano.lattarini <at> gmail.com>
+
+	dejagnu: ensure 'srcdir' is defined as an absolute directory
+	This change fixes automake bug#7833.
+	* lib/am/dejagnu.am (check-DEJAGNU): Prefer using $(abs_srcdir)
+	over getting the absolute path of $(srcdir) dynamically.
+	(site.exp): Use $(abs_srcdir) instead of $(srcdir) when defining
+	TCL variable 'srcdir'.
+	* tests/dejagnu-absolute-dirs.test: New test.
+	* tests/Makefile.am (TESTS): Update.
+	Report and suggestions by Ian Lance Taylor.
+
 2011-01-15  Ralf Wildenhues  <Ralf.Wildenhues <at> gmx.de>
 
 	docs: ensure example are separated with empty lines in the input
diff --git a/lib/am/dejagnu.am b/lib/am/dejagnu.am
index 08de45c..4e9a3f3 100644
--- a/lib/am/dejagnu.am
+++ b/lib/am/dejagnu.am
@@ -44,7 +44,7 @@ endif ! %?CYGNUS%
 .PHONY: check-DEJAGNU
 check-DEJAGNU: site.exp
 ## Life is easiest with an absolute srcdir, so do that.
-	srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+	srcdir='$(abs_srcdir)'; export srcdir; \
 	EXPECT=$(EXPECT); export EXPECT; \
 ## Allow this to work when expect and DejaGnu are in tree.
 ## Only required when --cygnus in force.
@@ -77,7 +77,7 @@ site.exp: Makefile
 	@echo '## these variables are automatically generated by make ##' >site.tmp
 	@echo '# Do not edit here.  If you wish to override these values' >>site.tmp
 	@echo '# edit the last section' >>site.tmp
-	@echo 'set srcdir $(srcdir)' >>site.tmp
+	@echo 'set srcdir "$(abs_srcdir)"' >>site.tmp
 	@echo "set objdir `pwd`" >>site.tmp
 ## Quote the *_alias variables because they might be empty.
 ?BUILD?	@echo 'set build_alias "$(build_alias)"' >>site.tmp
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 890e69b..8145a13 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -263,6 +263,7 @@ dejagnu4.test \
 dejagnu5.test \
 dejagnu6.test \
 dejagnu7.test \
+dejagnu-absolute-dirs.test \
 depacl2.test \
 depcomp.test \
 depcomp2.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 7600c14..53cfbb8 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -530,6 +530,7 @@ dejagnu4.test \
 dejagnu5.test \
 dejagnu6.test \
 dejagnu7.test \
+dejagnu-absolute-dirs.test \
 depacl2.test \
 depcomp.test \
 depcomp2.test \
diff --git a/tests/dejagnu-absolute-dirs.test b/tests/dejagnu-absolute-dirs.test
new file mode 100755
index 0000000..895e201
--- /dev/null
+++ b/tests/dejagnu-absolute-dirs.test
@@ -0,0 +1,92 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that DejaGnu testsuites have 'srcdir' defined to an absolute path
+# (both as TCL variable and as environment variable), and 'objdir' defined
+# (as a TCL variable) to an absolute path.
+
+required=runtest
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = tcl env
+EXTRA_DIST = env.test/env.exp tcl.test/tcl.exp lib/tcl.exp
+END
+
+mkdir env.test tcl.test lib
+
+# DejaGnu can change $srcdir behind our backs, so we have to
+# save its original value.
+cat > lib/tcl.exp << 'END'
+send_user "tcl_lib_srcdir: $srcdir\n"
+set orig_srcdir $srcdir
+END
+
+cat > env.test/env.exp << 'END'
+set env_srcdir $env(srcdir)
+send_user "env_srcdir: $env_srcdir\n"
+if { [ regexp "^/" $env_srcdir ] } {
+    pass "test_env_src"
+} else {
+    fail "test_env_src"
+}
+END
+
+cat > tcl.test/tcl.exp << 'END'
+send_user "tcl_srcdir: $srcdir\n"
+if { [ regexp "^/" $srcdir ] } {
+    pass "test_tcl_src"
+} else {
+    fail "test_tcl_src"
+}
+send_user "tcl_orig_srcdir: $orig_srcdir\n"
+if { [ regexp "^/" $orig_srcdir ] } {
+    pass "test_tcl_orig_src"
+} else {
+    fail "test_tcl_orig_src"
+}
+send_user "tcl_objdir: $objdir\n"
+if { [ regexp "^/" $objdir ] } {
+    pass "test_tcl_objdir"
+} else {
+    fail "test_tcl_objdir"
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure --srcdir=.
+
+$MAKE check
+
+# Sanity check: all tests have run.
+test -f env.log
+test -f env.sum
+test -f tcl.log
+test -f tcl.sum
+
+$MAKE distcheck
+
+:
-- 
1.7.2.3


Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Fri, 04 Mar 2011 17:12:01 GMT) Full text and rfc822 format available.

Message #50 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>
To: Peter Breitenlohner <peb <at> mppmu.mpg.de>
Cc: 7833 <at> debbugs.gnu.org, Ian Lance Taylor <iant <at> google.com>,
	bug-automake <at> gnu.org, automake-patches <at> gnu.org
Subject: Re: bug#7833: automake uses two different values for DejaGNU srcdir
Date: Fri, 4 Mar 2011 18:10:27 +0100
Hello Peter, all, and sorry for the delay,

* Peter Breitenlohner wrote on Sat, Jan 15, 2011 at 04:22:32PM CET:
> On Fri, 14 Jan 2011, Ralf Wildenhues wrote:
> 
> >Through testing I found out again that DejaGNU does not cope with white
> >space in absolute directory names anyway, regardless of srcdir being
> >relative or absolute.  That obviates my first point.  Remains only the
> >fairly minor src+build-tree relocatability point.

> I remember a problem with gcc's 'make check' that could be related.  Some
> tests failed when `pwd -L` was different from `pwd -P`, presumably due to
> the two different srcdir's.
> 
> I could avoid this problem by first doing 'cd `pwd -P`'.

Thanks for mentioning this.  I asked on the bug-dejagnu list back then,
and have an answer now:
http://thread.gmane.org/gmane.comp.sysutils.dejagnu.bugs/345/focus=348

I think we should change Automake semantics here and provide a relative
srcdir only.  That would mean, the first patch I suggested in
http://thread.gmane.org/gmane.comp.sysutils.automake.bugs/5230/focus=5464

Stefano, would you like to rewrite your testsuite addition for this?

Thanks,
Ralf




Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Fri, 04 Mar 2011 17:12:02 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Sat, 05 Mar 2011 01:26:02 GMT) Full text and rfc822 format available.

Message #56 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: automake-patches <at> gnu.org
Cc: Peter Breitenlohner <peb <at> mppmu.mpg.de>,
	Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>,
	Ian Lance Taylor <iant <at> google.com>, bug-automake <at> gnu.org,
	7833 <at> debbugs.gnu.org
Subject: Re: bug#7833: automake uses two different values for DejaGNU srcdir
Date: Sat, 5 Mar 2011 02:24:50 +0100
[Message part 1 (text/plain, inline)]
On Friday 04 March 2011, Ralf Wildenhues wrote:
> Hello Peter, all, and sorry for the delay,
> 
> * Peter Breitenlohner wrote on Sat, Jan 15, 2011 at 04:22:32PM CET:
> > On Fri, 14 Jan 2011, Ralf Wildenhues wrote:
> > 
> > >Through testing I found out again that DejaGNU does not cope with white
> > >space in absolute directory names anyway, regardless of srcdir being
> > >relative or absolute.  That obviates my first point.  Remains only the
> > >fairly minor src+build-tree relocatability point.
> 
> > I remember a problem with gcc's 'make check' that could be related.  Some
> > tests failed when `pwd -L` was different from `pwd -P`, presumably due to
> > the two different srcdir's.
> > 
> > I could avoid this problem by first doing 'cd `pwd -P`'.
> 
> Thanks for mentioning this.  I asked on the bug-dejagnu list back then,
> and have an answer now:
> http://thread.gmane.org/gmane.comp.sysutils.dejagnu.bugs/345/focus=348
> 
> I think we should change Automake semantics here and provide a relative
> srcdir only.  That would mean, the first patch I suggested in
> http://thread.gmane.org/gmane.comp.sysutils.automake.bugs/5230/focus=5464
> 
> Stefano, would you like to rewrite your testsuite addition for this?
>
I've adjusted my patch accordingly.  Please find the new attempt attached.
Is that ok for master?

Thanks,
  Stefano
[0001-dejagnu-ensure-srcdir-is-defined-as-a-relative-direc.patch (text/x-patch, inline)]
From 20b42d43279aef4cf8a35d86b0ae28cf6b7eee0f Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Date: Thu, 13 Jan 2011 20:33:26 +0100
Subject: [PATCH] dejagnu: ensure 'srcdir' is defined as a relative directory

This change fixes automake bug#7833.

* lib/am/dejagnu.am (check-DEJAGNU): Prefer using plain $(srcdir)
over calculating and using the absolute path of $(srcdir).
* tests/dejagnu-relative-srcdir.test: New test.
* tests/dejagnu-absolute-builddir.test: Likewise.
* tests/Makefile.am (TESTS): Update.

Report by Ian Lance Taylor.  Suggestions by Ralf Wildenhues.
---
 ChangeLog                            |   11 ++++
 lib/am/dejagnu.am                    |    4 +-
 tests/Makefile.am                    |    2 +
 tests/Makefile.in                    |    1 +
 tests/dejagnu-absolute-builddir.test |   62 ++++++++++++++++++++++++
 tests/dejagnu-relative-srcdir.test   |   85 ++++++++++++++++++++++++++++++++++
 6 files changed, 163 insertions(+), 2 deletions(-)
 create mode 100755 tests/dejagnu-absolute-builddir.test
 create mode 100755 tests/dejagnu-relative-srcdir.test

diff --git a/ChangeLog b/ChangeLog
index 991ed0b..c774f7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-03-05  Stefano Lattarini  <stefano.lattarini <at> gmail.com>
+
+	dejagnu: ensure 'srcdir' is defined as a relative directory
+	This change fixes automake bug#7833.
+	* lib/am/dejagnu.am (check-DEJAGNU): Prefer using plain $(srcdir)
+	over calculating and using the absolute path of $(srcdir).
+	* tests/dejagnu-relative-srcdir.test: New test.
+	* tests/dejagnu-absolute-builddir.test: Likewise.
+	* tests/Makefile.am (TESTS): Update.
+	Report by Ian Lance Taylor.  Suggestions by Ralf Wildenhues.
+
 2011-03-04  Stefano Lattarini  <stefano.lattarini <at> gmail.com>
 
 	tests: fix bug (comments-in-var-defn.test + autoconf 2.62)
diff --git a/lib/am/dejagnu.am b/lib/am/dejagnu.am
index 08de45c..5c5da50 100644
--- a/lib/am/dejagnu.am
+++ b/lib/am/dejagnu.am
@@ -44,7 +44,7 @@ endif ! %?CYGNUS%
 .PHONY: check-DEJAGNU
 check-DEJAGNU: site.exp
 ## Life is easiest with an absolute srcdir, so do that.
-	srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+	srcdir='$(srcdir)'; export srcdir; \
 	EXPECT=$(EXPECT); export EXPECT; \
 ## Allow this to work when expect and DejaGnu are in tree.
 ## Only required when --cygnus in force.
@@ -77,7 +77,7 @@ site.exp: Makefile
 	@echo '## these variables are automatically generated by make ##' >site.tmp
 	@echo '# Do not edit here.  If you wish to override these values' >>site.tmp
 	@echo '# edit the last section' >>site.tmp
-	@echo 'set srcdir $(srcdir)' >>site.tmp
+	@echo 'set srcdir "$(srcdir)"' >>site.tmp
 	@echo "set objdir `pwd`" >>site.tmp
 ## Quote the *_alias variables because they might be empty.
 ?BUILD?	@echo 'set build_alias "$(build_alias)"' >>site.tmp
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3fdb90a..b51b52d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -266,6 +266,8 @@ dejagnu4.test \
 dejagnu5.test \
 dejagnu6.test \
 dejagnu7.test \
+dejagnu-absolute-builddir.test \
+dejagnu-relative-srcdir.test \
 depacl2.test \
 depcomp.test \
 depcomp2.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index cd00833..3b327ca 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -536,6 +536,7 @@ dejagnu4.test \
 dejagnu5.test \
 dejagnu6.test \
 dejagnu7.test \
+dejagnu-absolute-dirs.test \
 depacl2.test \
 depcomp.test \
 depcomp2.test \
diff --git a/tests/dejagnu-absolute-builddir.test b/tests/dejagnu-absolute-builddir.test
new file mode 100755
index 0000000..ad9578f
--- /dev/null
+++ b/tests/dejagnu-absolute-builddir.test
@@ -0,0 +1,62 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that DejaGnu testsuites have 'objdir' defined (as a TCL variable)
+# to an absolute path.
+
+required=runtest
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = tcl env
+EXTRA_DIST = tcl.test/tcl.exp
+END
+
+mkdir tcl.test
+
+cat > tcl.test/tcl.exp << 'END'
+send_user "tcl_objdir: $objdir\n"
+if { [ regexp "^/" $objdir ] } {
+    pass "test_tcl_objdir"
+} else {
+    fail "test_tcl_objdir"
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+
+$MAKE check
+
+# Sanity check: all tests have run.
+test -f env.log
+test -f env.sum
+test -f tcl.log
+test -f tcl.sum
+
+$MAKE distcheck
+
+:
diff --git a/tests/dejagnu-relative-srcdir.test b/tests/dejagnu-relative-srcdir.test
new file mode 100755
index 0000000..14ddbc6
--- /dev/null
+++ b/tests/dejagnu-relative-srcdir.test
@@ -0,0 +1,85 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that DejaGnu testsuites have 'srcdir' defined to a relative path
+# (both as TCL variable and as environment variable).
+
+required=runtest
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = tcl env
+EXTRA_DIST = env.test/env.exp tcl.test/tcl.exp lib/tcl.exp
+END
+
+mkdir env.test tcl.test lib
+
+# DejaGnu can change $srcdir behind our backs, so we have to
+# save its original value.
+cat > lib/tcl.exp << 'END'
+send_user "tcl_lib_srcdir: $srcdir\n"
+set orig_srcdir $srcdir
+END
+
+cat > env.test/env.exp << 'END'
+set env_srcdir $env(srcdir)
+send_user "env_srcdir: $env_srcdir\n"
+if { [ regexp "^\.\.?$" $env_srcdir ] } {
+    pass "test_env_src"
+} else {
+    fail "test_env_src"
+}
+END
+
+cat > tcl.test/tcl.exp << 'END'
+send_user "tcl_srcdir: $srcdir\n"
+if { [ regexp "^\.\.?$" $srcdir ] } {
+    pass "test_tcl_src"
+} else {
+    fail "test_tcl_src"
+}
+send_user "tcl_orig_srcdir: $orig_srcdir\n"
+if { [ regexp "^\.\.?$" $orig_srcdir ] } {
+    pass "test_tcl_orig_src"
+} else {
+    fail "test_tcl_orig_src"
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure --srcdir=.
+
+$MAKE check
+
+# Sanity check: all tests have run.
+test -f env.log
+test -f env.sum
+test -f tcl.log
+test -f tcl.sum
+
+$MAKE distcheck
+
+:
-- 
1.7.2.3


Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#7833; Package automake. (Sat, 05 Mar 2011 01:26:02 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from Stefano Lattarini <stefano.lattarini <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 14 Mar 2011 19:51:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-automake <at> gnu.org:
bug#7833; Package automake. (Wed, 19 Oct 2011 08:44:02 GMT) Full text and rfc822 format available.

Message #64 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: automake-patches <at> gnu.org
Cc: Peter Breitenlohner <peb <at> mppmu.mpg.de>,
	Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>,
	Ian Lance Taylor <iant <at> google.com>, bug-automake <at> gnu.org,
	7833 <at> debbugs.gnu.org
Subject: Re: bug#7833: automake uses two different values for DejaGNU srcdir
Date: Wed, 19 Oct 2011 10:41:45 +0200
[Message part 1 (text/plain, inline)]
Reference:
  <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7873>

I've rebased my patch on the "fixup" commit `v1.11-250-g0c0b402', and
I will merge it to maint (and push) in a couple of days if there is
no objection by then.  The updated patch is attached, for reference.

Regards,
  Stefano
[0001-dejagnu-ensure-srcdir-is-defined-as-a-relative-direc.patch (text/x-patch, inline)]
From ded01c88c9579656cc138ce7e0b55dcf025b1a5a Mon Sep 17 00:00:00 2001
Message-Id: <ded01c88c9579656cc138ce7e0b55dcf025b1a5a.1319013658.git.stefano.lattarini <at> gmail.com>
From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Date: Thu, 13 Jan 2011 20:33:26 +0100
Subject: [PATCH] dejagnu: ensure 'srcdir' is defined as a relative directory

This change fixes automake bug#7833.

* lib/am/dejagnu.am (check-DEJAGNU): Prefer using plain $(srcdir)
over calculating and using the absolute path of $(srcdir).
* tests/dejagnu-relative-srcdir.test: New test.
* tests/dejagnu-absolute-builddir.test: Likewise.
* tests/Makefile.am (TESTS): Update.

Report by Ian Lance Taylor.  Suggestions by Ralf Wildenhues.
---
 ChangeLog                            |   11 ++++
 lib/am/dejagnu.am                    |    4 +-
 tests/Makefile.am                    |    2 +
 tests/Makefile.in                    |    2 +
 tests/dejagnu-absolute-builddir.test |   62 ++++++++++++++++++++++++
 tests/dejagnu-relative-srcdir.test   |   86 ++++++++++++++++++++++++++++++++++
 6 files changed, 165 insertions(+), 2 deletions(-)
 create mode 100755 tests/dejagnu-absolute-builddir.test
 create mode 100755 tests/dejagnu-relative-srcdir.test

diff --git a/ChangeLog b/ChangeLog
index 8884b59..bcee2a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-10-19  Stefano Lattarini  <stefano.lattarini <at> gmail.com>
+
+	dejagnu: ensure 'srcdir' is defined as a relative directory
+	This change fixes automake bug#7833.
+	* lib/am/dejagnu.am (check-DEJAGNU): Prefer using plain $(srcdir)
+	over calculating and using the absolute path of $(srcdir).
+	* tests/dejagnu-relative-srcdir.test: New test.
+	* tests/dejagnu-absolute-builddir.test: Likewise.
+	* tests/Makefile.am (TESTS): Update.
+	Report by Ian Lance Taylor.  Suggestions by Ralf Wildenhues.
+
 2010-12-13  Ralf Wildenhues  <Ralf.Wildenhues <at> gmx.de>
 
 	Fix testsuite failure of check12.test without DejaGNU.
diff --git a/lib/am/dejagnu.am b/lib/am/dejagnu.am
index 08de45c..5c5da50 100644
--- a/lib/am/dejagnu.am
+++ b/lib/am/dejagnu.am
@@ -44,7 +44,7 @@ endif ! %?CYGNUS%
 .PHONY: check-DEJAGNU
 check-DEJAGNU: site.exp
 ## Life is easiest with an absolute srcdir, so do that.
-	srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+	srcdir='$(srcdir)'; export srcdir; \
 	EXPECT=$(EXPECT); export EXPECT; \
 ## Allow this to work when expect and DejaGnu are in tree.
 ## Only required when --cygnus in force.
@@ -77,7 +77,7 @@ site.exp: Makefile
 	@echo '## these variables are automatically generated by make ##' >site.tmp
 	@echo '# Do not edit here.  If you wish to override these values' >>site.tmp
 	@echo '# edit the last section' >>site.tmp
-	@echo 'set srcdir $(srcdir)' >>site.tmp
+	@echo 'set srcdir "$(srcdir)"' >>site.tmp
 	@echo "set objdir `pwd`" >>site.tmp
 ## Quote the *_alias variables because they might be empty.
 ?BUILD?	@echo 'set build_alias "$(build_alias)"' >>site.tmp
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3f40361..e83f06b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -255,6 +255,8 @@ dejagnu4.test \
 dejagnu5.test \
 dejagnu6.test \
 dejagnu7.test \
+dejagnu-absolute-builddir.test \
+dejagnu-relative-srcdir.test \
 depacl2.test \
 depcomp.test \
 depcomp2.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 40b4697..880bfbe 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -523,6 +523,8 @@ dejagnu4.test \
 dejagnu5.test \
 dejagnu6.test \
 dejagnu7.test \
+dejagnu-absolute-builddir.test \
+dejagnu-relative-srcdir.test \
 depacl2.test \
 depcomp.test \
 depcomp2.test \
diff --git a/tests/dejagnu-absolute-builddir.test b/tests/dejagnu-absolute-builddir.test
new file mode 100755
index 0000000..ad9578f
--- /dev/null
+++ b/tests/dejagnu-absolute-builddir.test
@@ -0,0 +1,62 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that DejaGnu testsuites have 'objdir' defined (as a TCL variable)
+# to an absolute path.
+
+required=runtest
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = tcl env
+EXTRA_DIST = tcl.test/tcl.exp
+END
+
+mkdir tcl.test
+
+cat > tcl.test/tcl.exp << 'END'
+send_user "tcl_objdir: $objdir\n"
+if { [ regexp "^/" $objdir ] } {
+    pass "test_tcl_objdir"
+} else {
+    fail "test_tcl_objdir"
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+
+$MAKE check
+
+# Sanity check: all tests have run.
+test -f env.log
+test -f env.sum
+test -f tcl.log
+test -f tcl.sum
+
+$MAKE distcheck
+
+:
diff --git a/tests/dejagnu-relative-srcdir.test b/tests/dejagnu-relative-srcdir.test
new file mode 100755
index 0000000..8a70d58
--- /dev/null
+++ b/tests/dejagnu-relative-srcdir.test
@@ -0,0 +1,86 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that DejaGnu testsuites have 'srcdir' defined to a relative path
+# (both as TCL variable and as environment variable).
+
+required=runtest
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = tcl env
+EXTRA_DIST = env.test/env.exp tcl.test/tcl.exp lib/tcl.exp
+END
+
+mkdir env.test tcl.test lib
+
+# DejaGnu can change $srcdir behind our backs, so we have to
+# save its original value.  Thanks to Ian Lance Taylor for the
+# suggestion.
+cat > lib/tcl.exp << 'END'
+send_user "tcl_lib_srcdir: $srcdir\n"
+set orig_srcdir $srcdir
+END
+
+cat > env.test/env.exp << 'END'
+set env_srcdir $env(srcdir)
+send_user "env_srcdir: $env_srcdir\n"
+if { [ regexp "^\.\.?$" $env_srcdir ] } {
+    pass "test_env_src"
+} else {
+    fail "test_env_src"
+}
+END
+
+cat > tcl.test/tcl.exp << 'END'
+send_user "tcl_srcdir: $srcdir\n"
+if { [ regexp "^\.\.?$" $srcdir ] } {
+    pass "test_tcl_src"
+} else {
+    fail "test_tcl_src"
+}
+send_user "tcl_orig_srcdir: $orig_srcdir\n"
+if { [ regexp "^\.\.?$" $orig_srcdir ] } {
+    pass "test_tcl_orig_src"
+} else {
+    fail "test_tcl_orig_src"
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure --srcdir=.
+
+$MAKE check
+
+# Sanity check: all tests have run.
+test -f env.log
+test -f env.sum
+test -f tcl.log
+test -f tcl.sum
+
+$MAKE distcheck
+
+:
-- 
1.7.2.3


Information forwarded to bug-automake <at> gnu.org:
bug#7833; Package automake. (Wed, 19 Oct 2011 08:44:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-automake <at> gnu.org:
bug#7833; Package automake. (Sat, 22 Oct 2011 18:55:01 GMT) Full text and rfc822 format available.

Message #70 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: automake-patches <at> gnu.org
Cc: Peter Breitenlohner <peb <at> mppmu.mpg.de>,
	Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>,
	7833-done <at> debbugs.gnu.org, bug-automake <at> gnu.org,
	Ian Lance Taylor <iant <at> google.com>
Subject: Re: bug#7833: automake uses two different values for DejaGNU srcdir
Date: Sat, 22 Oct 2011 20:53:10 +0200
On Wednesday 19 October 2011, Stefano Lattarini wrote:
> Reference:
>   <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7873>
> 
> I've rebased my patch on the "fixup" commit `v1.11-250-g0c0b402', and
> I will merge it to maint (and push) in a couple of days if there is
> no objection by then.  The updated patch is attached, for reference.
> 
Pushed now.  I'm closing this bug report.

Regards,
  Stefano




Reply sent to Stefano Lattarini <stefano.lattarini <at> gmail.com>:
You have taken responsibility. (Sat, 22 Oct 2011 18:55:01 GMT) Full text and rfc822 format available.

Notification sent to Ian Lance Taylor <iant <at> google.com>:
bug acknowledged by developer. (Sat, 22 Oct 2011 18:55:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 20 Nov 2011 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 268 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.