Blame test/igncdym.awk

Packit 575503
#From Jeffrey.B.Woodward@Hitchcock.ORG  Mon Feb 21 09:33:32 2000
Packit 575503
#Message-id: <12901034@mailbox2.Hitchcock.ORG>
Packit 575503
#Date: 20 Feb 2000 18:14:11 EST
Packit 575503
#From: Jeffrey.B.Woodward@Hitchcock.ORG (Jeffrey B. Woodward)
Packit 575503
#Subject: gawk 3.0.4 bug
Packit 575503
#To: bug-gnu-utils@gnu.org
Packit 575503
#Cc: arnold@gnu.org
Packit 575503
#
Packit 575503
#O/S: Digital UNIX 4.0D
Packit 575503
#
Packit 575503
#C Compiler: DEC C
Packit 575503
#
Packit 575503
#gawk version: 3.0.4
Packit 575503
#
Packit 575503
#Sample Program:
Packit 575503
#gawk '
Packit 575503
  BEGIN {
Packit 575503
    pattern[1] = "bar" ; ignore[1] = 1
Packit 575503
    pattern[2] = "foo" ; ignore[2] = 0
Packit 575503
  }
Packit 575503
Packit 575503
  {
Packit 575503
    for (i = 1 ; i <= 2 ; i++) {
Packit 575503
      IGNORECASE = ignore[i]
Packit 575503
      print match($0, pattern[i]) " " pattern[i] ":" $0
Packit 575503
    }
Packit 575503
  }
Packit 575503
#' << -EOF-
Packit 575503
#This is foo
Packit 575503
#This is bar
Packit 575503
#-EOF-
Packit 575503
#
Packit 575503
#Program Output:
Packit 575503
#0 bar:This is foo
Packit 575503
#0 foo:This is foo
Packit 575503
#9 bar:This is bar
Packit 575503
#9 foo:This is bar
Packit 575503
#
Packit 575503
#
Packit 575503
#**Expected** Output:
Packit 575503
#0 bar:This is foo
Packit 575503
#9 foo:This is foo
Packit 575503
#9 bar:This is bar
Packit 575503
#0 foo:This is bar
Packit 575503
#
Packit 575503
#
Packit 575503
#This problem appears to be directly related to IGNORECASE. If
Packit 575503
#IGNORECASE remains constant, the program behaves as expected;
Packit 575503
#however, switching IGNORECASE seems to causes problems - it is
Packit 575503
#almost as though the pattern stored in the variable is treated
Packit 575503
#as a constant and the regexp() is not recompiled(?) - just a
Packit 575503
#guess...
Packit 575503
#
Packit 575503
#
Packit 575503
#Thanks,
Packit 575503
#-Jeff Woodward