This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: contrib/test_summary: Syntax error: Unterminated quoted string


* H.J. Lu wrote on Tue, Aug 25, 2009 at 05:20:30PM CEST:
> On Tue, Aug 25, 2009 at 7:01 AM, H.J. Lu wrote:
> > On Tue, Aug 25, 2009 at 6:06 AM, Gerald Pfeifer wrote:
> >> ? ? ? ?PR testsuite/40704
> >> ? ? ? ?* test_summary: Filter out "\r".

BTW, getting a carriage return past shell and awk portably can be a
pain.  This is how Autoconf currently does it in all configure scripts
(and it has seen at least 3-4 fixes since its first version, and is not
EBCDIC safe):

ac_cr=`echo X | tr X '\015'`
# On cygwin, bash can eat \r inside `` if the user requested igncr.
# But we know of no other shell where ac_cr would be empty at this
# point, so we can use a bashism as a fallback.
if test "x$ac_cr" = x; then
  eval ac_cr=\$\'\\r\'
fi
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
  ac_cs_awk_cr='\r'
else
  ac_cs_awk_cr=$ac_cr
fi

# use $ac_cs_awk_cr as carriage return in an awk script ...


> >> even though I failed to find an obvious bug with that change. ?This
> >> is on i386-unknown-freebsd7.2. ?Anyone else seeing this?

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41166

Here is a (completely untested) patch.  It doesn't address the issues
that Joseph stated in the PR log about not relying on config.status at
all for installed-compiler tests, but it should avoid the syntax error.

Feedback welcome.

Thanks,
Ralf

contrib/ChangeLog:
2009-08-25  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* test_summary: Invoke config.status, rather than trying to
	parse it.  Adjust awk script.

diff --git a/contrib/test_summary b/contrib/test_summary
index f7cddf4..c4b3c2c 100755
--- a/contrib/test_summary
+++ b/contrib/test_summary
@@ -91,7 +91,7 @@ if $forcemail || $anychange; then :; else mailto=nobody; fi &&
 # We use cat instead of listing the files as arguments to AWK because
 # GNU awk 3.0.0 would break if any of the filenames contained `=' and
 # was preceded by an invalid ``variable'' name.
-cat ./config.status $files |
+( echo @TOPLEVEL_CONFIGURE_ARGUMENTS@ | ./config.status --file=-; cat $files ) |
 $AWK '
 BEGIN {
   lang=""; configflags = "";
@@ -100,11 +100,8 @@ BEGIN {
   print "cat <<'"'"'EOF'"'"' |";
 '${prepend_logs+"  system(\"cat $prepend_logs\"); "}'
 }
-($0 ~ /^[^ ]*\/configure / || $0 ~ /^# [^ ]*\/configure /) &&
-configflags == "" {
+NR == 1 {
     configflags = $0 " ";
-    sub(/^# /, "", configflags);
-    sub(/^s,@TOPLEVEL_CONFIGURE_ARGUMENTS@,/, "", configflags);
     srcdir = configflags;
     sub(/\/configure .*/, "", srcdir);
     if ( system("test -f " srcdir "/LAST_UPDATED") == 0 ) {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]