[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Redirecting to a stream number held in a variable
From: |
Mark Hobley |
Subject: |
Re: Redirecting to a stream number held in a variable |
Date: |
Wed, 30 Dec 2009 21:56:53 +0000 (GMT) |
--- On Tue, 29/12/09, Eric Blake <address@hidden> wrote:
> From: Eric Blake <address@hidden>
> Subject: Re: Redirecting to a stream number held in a variable
> You'll have to demonstrate an instance of the bug in
> context, first.
Here is what I have so far:
In an empty directory create a configure.ac file as follows:
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.64])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
# Checks for programs.
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_OUTPUT
Now run:
autoconf
Using an editor examine the file configure and search for &$
The problematic line appears in the function as_fn_error as follows:
as_fn_error ()
{
as_status=$?; test $as_status -eq 0 && as_status=1
if test "$3"; then
as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
$as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
fi
$as_echo "$as_me: error: $1" >&2
as_fn_exit $as_status
} # as_fn_error
Modify the script to populate $3 with a value of 5 and call as_fn_error()
An error will occur as a result of the >&$3 syntax being used.
This error may occur in real circumstances because $3 is being set to a value
of 5 as part of the LOG_FD
I found this snipped of code elsewhere in the configure file:
# Handling of arguments.
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
done
Note the number 5. I reckon this may trip the error when the handler runs.
I think that the shells are tripping up on the >&$3 syntax **before** the
substitution to a value is being made.
Mark.