[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [1003.1(2016/18)/Issue7+TC2 0001558]: require [^...] in addition to
From: |
Eric Blake |
Subject: |
Re: [1003.1(2016/18)/Issue7+TC2 0001558]: require [^...] in addition to [!...] for bracket expression negation |
Date: |
Fri, 18 Feb 2022 08:38:40 -0600 |
User-agent: |
NeoMutt/20211029-332-f3b9af |
Reporting a bug on behalf of mirabilos:
On Thu, Feb 17, 2022 at 11:46:52PM +0000, Austin Group Bug Tracker via
austin-group-l at The Open Group wrote:
> https://www.austingroupbugs.net/view.php?id=1558
...
> Summary: require [^...] in addition to [!...] for bracket
> expression negation
> ======================================================================
>
> ----------------------------------------------------------------------
> (0005677) mirabilos (reporter) - 2022-02-17 23:46
> https://www.austingroupbugs.net/view.php?id=1558#c5677
> ----------------------------------------------------------------------
> It gets worse.
>
> Expecting my objection here to be ignored, I’ve added debugging code to
> mksh (and, indeed, adding the caret needs changes in more than one
> codepath, and it’s very much something I’d like to not need to do
> because more checks make the code slower), and it triggers a warning on:
>
> […]
> # Sed expression to map a string onto a valid CPP name.
> as_tr_cpp="eval sed
> 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
> […]
> echo moo | $as_tr_cpp
>
> This is what GNU autoconf does by default.
>
> W: configure[557]: unescaped [^...] in shellglob; this may change the
> meaning in the future!
>
> So, well, why? Because the variable contains…
>
> typeset as_tr_cpp='eval sed
> '\''y%*abcdefghijklmnopqrstuvwxyz%PABCDEFGHIJKLMNOPQRSTUVWXYZ%;s%[^_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]%_%g'\'
>
> (via “typeset -p”), and without -o noglob, using it as simply
> $as_tr_cpp does, in fact, glob on it.
>
> Yes, clearly a bug in GNU autoconf… which I’m not personally going to
> even try and report. The …[^… is passed to sed. But it is also
> processed by the shell first, by accident. (This is from
> OpenSSH-portable’s configure.)
So we need to patch autoconf to properly shell-quote the sed script
stored in as_tr_cpp.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
- Re: [1003.1(2016/18)/Issue7+TC2 0001558]: require [^...] in addition to [!...] for bracket expression negation,
Eric Blake <=