Bug 192793 - Autoconf-2.59-7 / 2.59-8 has wierd interaction with bash-3.1-6.2 / 3.1-12
Autoconf-2.59-7 / 2.59-8 has wierd interaction with bash-3.1-6.2 / 3.1-12
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: autoconf (Show other bugs)
5
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Karsten Hopp
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-05-22 23:41 EDT by TC
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-07-01 16:39:01 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
SRPM for otcl package with configure issue (315.89 KB, application/octet-stream)
2006-06-26 21:43 EDT, TC
no flags Details

  None (edit)
Description TC 2006-05-22 23:41:55 EDT
Description of problem:

I'm trying to build otcl package (part of ns2 network simulator).
When running autoconf generated configure script, it'll fail with:

./configure: line 6027: syntax error near unexpected token `('
./configure: line 6027: `    case `(ac_space=' '; set | grep ac_space) 2>&1`
in'error: Bad exit status from /var/tmp/rpm-tmp.70778 (%build)

Version-Release number of selected component (if applicable):

The 'ac_space' string occurs in general.m4 for the _AC_CACHE_DUMP check.
The following is extracted from the configure script which fails:

# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, don't put newlines in cache variables' values.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
{
  (set) 2>&1 |
    case `(ac_space=' '; set | grep ac_space) 2>&1` in
    *ac_space=\ *)
      # `set' does not quote correctly, so add quotes (double-quote
      # substitution turns \\\\ into \\, and sed turns \\ into \).
      sed -n \
	"s/'/'\\\\''/g;
	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
      ;;
    *)
      # `set' quotes correctly as required by POSIX, so do not add quotes.
      sed -n \
	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
      ;;
    esac;
} |
  sed '
     t clear
     : clear
     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
     t end
     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
     : end' >>confcache
if diff $cache_file confcache >/dev/null 2>&1; then :; else
  if test -w $cache_file; then
    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
    cat confcache >$cache_file
  else
    echo "not updating unwritable cache $cache_file"
  fi
fi
rm -f confcache


How reproducible:

Always.

Steps to Reproduce:
1. Run autoconf on package which loads the _AC_CACHE_DUMP check.
2. execute the configure script
3. configure fails with syntax error
  
Actual results:

syntax error encountered in configure script.

Expected results:

_AC_CACHE_DUMP check will proceed successfully.

Additional info:

If I edit configure script and change the shell in line 1 to /bin/ksh, the
script will run to completion. This indicates that there is some interaction
between bash 3.1 and autoconf which was not present in earlier releases (AFAIK).

I've tried this with the FC5/testing versions of bash and autoconf with the same
results.
Comment 1 Stepan Kasal 2006-06-26 15:03:53 EDT
I tried to reproduce the problem, but did not succeed.

I logged in to an x86_64 FC5 machine which has bash-3.1-6.2 and autoconf-2.59-7,
unpacked a tarball, run
autoconf -f && ./configure && ./configure -C && ./configure -C
and observed no problem.

The configure script contains the code cited above, of course.

"file /bin/bash" says that it is a 64-bit executable.

I'm afraid we need more details to be able to reproduce the bug.
Comment 2 TC 2006-06-26 21:43:04 EDT
Created attachment 131577 [details]
SRPM for otcl package with configure issue

I'm enclosing the SRPM for the otcl package for you. The relevant patch is
patch1 (found after the %build directive). The SPEC file was modified from the
PLD version.
Comment 3 Stepan Kasal 2006-07-01 16:39:01 EDT
Thank you for providing the src rpm.
The following code in configure.in is causing the problem:

    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
        system=MP-RAS-`awk '{print $3}' /etc/.relid'`
    fi

The second parameter of awk has an unmatched single quote, which confuses the
parser.  Fix that, and bash will work.

The problem is that the two shells parse the errorneous code in different ways.
Ksh matches the two backticks, as intended, and beacuse the if condition is not
true (/etc/.relid does not exist), the bug is covered.

Bash, OTOH, thinks that the second parameter to awk spans several lines.  The
command embedded in backticks is found far below, and the parser is completely
out of sync.

That means that bash skipped lot of code as it it were in that `if', and then
surprised you with an unrelated error message.

That happens often with shell scripts; the trick is to start investigation at
the command which was executed last, and because configure produces a relatively
verbose output, you cah start from the last "checking ..." message.

Note You need to log in before you can comment on or make changes to this bug.