public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Allow genmultilib to be reentrant
@ 2002-12-16 21:22 Geoffrey Keating
  2002-12-17 13:10 ` Jason Merrill
  2002-12-17 13:22 ` Alexandre Oliva
  0 siblings, 2 replies; 3+ messages in thread
From: Geoffrey Keating @ 2002-12-16 21:22 UTC (permalink / raw)
  To: gcc-patches


I hit an interesting problem when genmultilib was run twice, the
second starting before the first had finished.  I couldn't reproduce
the problem, and this isn't a total solution anyway (it would need a
Makefile change), but it will help if this happens in future.

Tested on powerpc-eabisim.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/gcc-genmulticoncur.patch==================
2002-12-16  Geoffrey Keating  <geoffk@apple.com>

	* genmultilib: Create temporary files in unique subdirectory.

Index: genmultilib
===================================================================
RCS file: /cvs/gcc/gcc/gcc/genmultilib,v
retrieving revision 1.10
diff -u -p -u -p -r1.10 genmultilib
--- genmultilib	5 Oct 2002 18:55:54 -0000	1.10
+++ genmultilib	17 Dec 2002 05:19:14 -0000
@@ -1,6 +1,6 @@
 #!/bin/sh 
 # Generates multilib.h.
-#   Copyright (C) 1994, 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+#   Copyright (C) 1994, 1995, 1996, 1997, 1999, 2002 Free Software Foundation, Inc.
 
 #This file is part of GCC.
 
@@ -120,6 +120,9 @@ enable_multilib=$8
 
 echo "static const char *const multilib_raw[] = {"
 
+mkdir tmpmultilib.$$ || exit 1
+cd tmpmultilib.$$ || exit 1
+
 # What we want to do is select all combinations of the sets in
 # options.  Each combination which includes a set of mutually
 # exclusive options must then be output multiple times, once for each
@@ -161,11 +164,8 @@ chmod +x tmpmultilib
 
 combinations=`initial=/ ./tmpmultilib ${options}`
 
-rm -f tmpmultilib
-
 # If there exceptions, weed them out now
 if [ -n "${exceptions}" ]; then
-  rm -f tmpmultilib2
   cat >tmpmultilib2 <<\EOF
 #!/bin/sh
 # This recursive script weeds out any combination of multilib
@@ -187,7 +187,6 @@ cat >>tmpmultilib2 <<\EOF
 EOF
   chmod +x tmpmultilib2
   combinations=`./tmpmultilib2 ${combinations}`
-  rm -f ./tmpmultilib2
 fi
 
 # Construct a sed pattern which will convert option names to directory
@@ -371,6 +370,7 @@ moptions=`echo ${options} | sed -e 's,[ 
 echo ""
 echo "static const char *multilib_options = \"${moptions}\";"
 
-rm -f tmpmultilib2
+cd ..
+rm -r tmpmultilib.$$
 
 exit 0
============================================================

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

* Re: Allow genmultilib to be reentrant
  2002-12-16 21:22 Allow genmultilib to be reentrant Geoffrey Keating
@ 2002-12-17 13:10 ` Jason Merrill
  2002-12-17 13:22 ` Alexandre Oliva
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Merrill @ 2002-12-17 13:10 UTC (permalink / raw)
  To: Geoffrey Keating; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 462 bytes --]

On Mon, 16 Dec 2002 21:22:29 -0800 (PST), Geoffrey Keating <gkeating@apple.com> wrote:

> 2002-12-16  Geoffrey Keating  <geoffk@apple.com>
>
> 	* genmultilib: Create temporary files in unique subdirectory.

This breaks for me; I have CDPATH set, so "cd tmpmultilib.$$" prints out
the expanded path.  Perhaps this is a bash bug, but this patch fixes the
problem.  Applied to trunk.

2002-12-17  Jason Merrill  <jason@redhat.com>

	* genmultilib: Use 'cd ./foo'.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 700 bytes --]

*** genmultilib.~1~	Tue Dec 17 01:23:19 2002
--- genmultilib	Tue Dec 17 02:04:07 2002
*************** enable_multilib=$8
*** 121,127 ****
  echo "static const char *const multilib_raw[] = {"
  
  mkdir tmpmultilib.$$ || exit 1
! cd tmpmultilib.$$ || exit 1
  
  # What we want to do is select all combinations of the sets in
  # options.  Each combination which includes a set of mutually
--- 121,128 ----
  echo "static const char *const multilib_raw[] = {"
  
  mkdir tmpmultilib.$$ || exit 1
! # Use cd ./foo to avoid CDPATH output.
! cd ./tmpmultilib.$$ || exit 1
  
  # What we want to do is select all combinations of the sets in
  # options.  Each combination which includes a set of mutually

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

* Re: Allow genmultilib to be reentrant
  2002-12-16 21:22 Allow genmultilib to be reentrant Geoffrey Keating
  2002-12-17 13:10 ` Jason Merrill
@ 2002-12-17 13:22 ` Alexandre Oliva
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2002-12-17 13:22 UTC (permalink / raw)
  To: Geoffrey Keating; +Cc: gcc-patches

On Dec 17, 2002, Geoffrey Keating <gkeating@apple.com> wrote:

> +mkdir tmpmultilib.$$ || exit 1

Make sure `make clean´ will clean it up.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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

end of thread, other threads:[~2002-12-17 21:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-16 21:22 Allow genmultilib to be reentrant Geoffrey Keating
2002-12-17 13:10 ` Jason Merrill
2002-12-17 13:22 ` Alexandre Oliva

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).