[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
autoconf doesn't escape sed metacharacters in paths
From: |
Quasi Computational |
Subject: |
autoconf doesn't escape sed metacharacters in paths |
Date: |
Mon, 18 Jun 2018 15:30:30 +0100 |
Reproduction:
```
$ mkdir '\9'
$ cd '\9'
$ git clone https://github.com/haskell/network
$ cd network
$ git checkout 7e3f16d57b8745ef12cec8c9164bb91eeac90b5b # known-to-fail commit
$ autoconf
$ ./configure
```
This fails for me with this line:
```
sed: -e expression #1, char 400: invalid reference \9 on `s' command's RHS
```
The offending `sed` invocation is in `config.status`, generated by
`configure` with these lines:
```
# Neutralize VPATH when `$srcdir' = `.'.
# Shell code in configure.ac might set extrasub.
# FIXME: do we really want to maintain this feature?
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_sed_extra="$ac_vpsub
$extrasub
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
s|@configure_input@|$ac_sed_conf_input|;t t
s&@top_builddir@&$ac_top_builddir_sub&;t t
s&@top_build_prefix@&$ac_top_build_prefix&;t t
s&@srcdir@&$ac_srcdir&;t t
s&@abs_srcdir@&$ac_abs_srcdir&;t t
s&@top_srcdir@&$ac_top_srcdir&;t t
s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
s&@builddir@&$ac_builddir&;t t
s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
$ac_datarootdir_hack
"
eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
>$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
```
`$ac_abs_srcdir` and friends contain the `\9` segment, which `sed` is
interpreting as a back-reference.
```
$ autoconf --version
autoconf (GNU Autoconf) 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by David J. MacKenzie and Akim Demaille.
```
This bug has been tracked at
https://github.com/haskell/cabal/issues/5386 and
https://github.com/commercialhaskell/stack/issues/3944.
- autoconf doesn't escape sed metacharacters in paths,
Quasi Computational <=