public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH for dejagnu-980528
@ 1998-06-25 21:48 Carlo Wood
  1998-06-27 23:01 ` Jeffrey A Law
  0 siblings, 1 reply; 2+ messages in thread
From: Carlo Wood @ 1998-06-25 21:48 UTC (permalink / raw)
  To: bug-dejagnu; +Cc: egcs

While looking into the problem that egcs testsuites can't find
libstdc++, I ran into a bug of dejagnu.

Appended a patch that fixes this problem.

Carlo Wood
-- 
 carlo@runaway.xs4all.nl

===============================================================================

Problem description:

In dejagnu/lib/libgloss.exp in proc get_multilibs, dejagnu searches for
the top level multilib directory by using `lookfor_file' relative to
$comp_base_dir on respectively "$target_alias", "libraries" and "gcc/xgcc".

Under normal circumstances, the directory that should be found for the
egcs package is "libraries".  However, dejagnu will ONLY find it when
the first try (looking for "$target_alias") fails.

The procedure `lookfor_file' descends the directory tree down to ../../..
and inadvertently finds "/usr/$target_alias", where "/usr" is a parent
directory of "$comp_base_dir".

Example values are as follows:

Suppose ${comp_base_dir} == /usr/src/egcs/egcs-cvs-objdir
        ${target_alias}  == i686-pc-linux-gnu
Then dejagnu-980528 will find "/usr/i686-pc-linux-gnu" of a previous install,
while it SHOULD find "/usr/src/egcs/egcs-cvs-objdir/libraries".

In order to let "/usr/src/egcs/egcs-cvs-objdir/libraries" have precedence
over "/usr/src/egcs/egcs-cvs-objdir/../../../i686-pc-linux-gnu" I think
that the number of '..' should be minimized.

It appears to me that "libraries" is a special case that will always happen
in "$comp_base_dir" directly anyway, or else at least earlier then
"$target_alias".

The proposed patch makes get_multilibs looks for the top level directory in
this order:

$comp_base_dir/$target_alias
$comp_base_dir/libraries
$comp_base_dir/gcc/xgcc		--> if found, return "$comp_base_dir"
$comp_base_dir/../$target_alias
$comp_base_dir/../libraries
$comp_base_dir/../gcc/xgcc	--> if found, return "$comp_base_dir/.."
$comp_base_dir/../../$target_alias
$comp_base_dir/../../libraries
$comp_base_dir/../../gcc/xgcc	--> if found, return "$comp_base_dir/../.."
$comp_base_dir/../../../$target_alias
$comp_base_dir/../../../libraries

Please let me know if this is acceptable for addition in your next snapshot.
Any suggestions welcome :).  CC me at carlo@runaway.xs4all.nl
as I am not subbed to this list.

Patch is tested and functional.

==============================================================================

diff -rc dejagnu-980528/dejagnu/lib/libgloss.exp dejagnu-980528.multitop/dejagnu/lib/libgloss.exp
*** dejagnu-980528/dejagnu/lib/libgloss.exp	Tue Apr 28 23:14:44 1998
--- dejagnu-980528.multitop/dejagnu/lib/libgloss.exp	Fri Jun 26 02:56:03 1998
***************
*** 428,444 ****
  
  
      # search for the top level multilib directory
!     set multitop [lookfor_file "${comp_base_dir}" "${target_alias}"]
!     if { $multitop == "" } {
! 	set multitop [lookfor_file "${comp_base_dir}" "libraries"]
! 	if { $multitop == "" } {
! 	    set multitop "[lookfor_file ${comp_base_dir} gcc/xgcc]"
! 	    if { $multitop != "" } {
! 		set multitop [file dirname [file dirname $multitop]];
! 	    } else {
! 		return ""
! 	    }
  	}
      }
  
      # make a list of -m<foo> options from the various compiler config variables
--- 428,451 ----
  
  
      # search for the top level multilib directory
!     set dir $comp_base_dir
!     foreach i ".. ../.. ../../.. ../../../.." {
! 	if [file exists $dir/$target_alias] {
! 	    set multitop $dir/$target_alias
! 	    break;
  	}
+ 	if [file exists $dir/libraries] {
+ 	    set multitop $dir/libraries
+ 	    break;
+ 	}
+ 	if [file exists $dir/gcc/xgcc] {
+ 	    set multitop [file dirname [file dirname $dir/gcc/xgcc]];
+ 	    break;
+ 	}
+ 	if { $i == "../../../.." } {
+ 	    return ""
+ 	}
+ 	set dir [remote_file build dirname $dir];
      }
  
      # make a list of -m<foo> options from the various compiler config variables

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH for dejagnu-980528
  1998-06-25 21:48 PATCH for dejagnu-980528 Carlo Wood
@ 1998-06-27 23:01 ` Jeffrey A Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeffrey A Law @ 1998-06-27 23:01 UTC (permalink / raw)
  To: Carlo Wood; +Cc: bug-dejagnu, egcs

  In message < 199806260103.DAA14119@jolan.ppro >you write:

  > Problem description:
  > 
  > In dejagnu/lib/libgloss.exp in proc get_multilibs, dejagnu searches for
  > the top level multilib directory by using `lookfor_file' relative to
  > $comp_base_dir on respectively "$target_alias", "libraries" and "gcc/xgcc".
  > 
  > Under normal circumstances, the directory that should be found for the
  > egcs package is "libraries".  However, dejagnu will ONLY find it when
  > the first try (looking for "$target_alias") fails.
"libraries" is dead :-)  egcs uses $target_alias exclusively now.
"libraries" was a mistake that we're just now getting around to
correcting.

I believe your patch should be unnecessary now.

jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-06-27 23:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-06-25 21:48 PATCH for dejagnu-980528 Carlo Wood
1998-06-27 23:01 ` Jeffrey A Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).