Skip to contentSkip to conversation

Alsa-driver gawk/POSIX bug (again)

DISCUSSION Shawn Smout 1 participant 1 message Nov 16, 2003

lore
Share & tools
lore
#0 lore raw

There is a bug in the alsa-driver file "utils/convert_isapnp_ids" that causes compilation of alsa-driver to fail if gawk runs in POSIX mode (which is the case if the environment variable POSIXLY_CORRECT is set).

Line 84 of convert_isapnp_ids currently says:

    if (match($0, "\{.*\}")) {

The slashes to escape the braces were intended as a fix to this bug (which I previously posted), but it turns out they don't work. I believe this is because awk evaluates the expression in the double quotes before passing it to the match function, so the regex matcher sees {.*}, not \{.*\}. This can be fixed in one of two ways:

    if (match($0, "\\{.*\\}")) {
or
    if (match($0, /\{.*\}/) {

The former escapes the slash, so the regex itself sees the braces as escaped. The latter merely causes gawk not to evaluate the argument before passing it to match. Both have the same effect of sending the regex \{.*\} to match. The code then works as intended regardless of whether POSIXLY_CORRECT is set.

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl