Subject: Re: pkg/33410: pkgsrc problem with posix awk
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Roland Illig <rillig@NetBSD.org>
List: pkgsrc-bugs
Date: 05/11/2006 13:23:57
The following reply was made to PR pkg/33410; it has been noted by GNATS.

From: Roland Illig <rillig@NetBSD.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/33410: pkgsrc problem with posix awk
Date: Thu, 11 May 2006 10:03:29 +0200

 joerg@britannica.bec.de wrote:
 > The following reply was made to PR pkg/33410; it has been noted by GNATS.
 > 
 > From: joerg@britannica.bec.de
 > To: gnats-bugs@netbsd.org
 > Cc: 
 > Subject: Re: pkg/33410: pkgsrc problem with posix awk
 > Date: Sat, 6 May 2006 10:13:31 +0200
 > 
 >  On Tue, May 02, 2006 at 09:30:05PM +0000, Roland Illig wrote:
 >  >  And I prefer to do things right. Other implementations of awk may just 
 >  >  continue without warning (the OpenGroup's web site is badly formatted, 
 >  >  but I think it states undefined behavior for invalid programs), and can 
 >  >  you tell what they do?
 >  
 >  The behaviour of this programs is actually quite well defined. the
 >  backslash escaping is not *necessary* in this situations, but it doesn't
 >  really hurt either.
 >  
 >  >  In particular the second warning should alert you. Although the author 
 >  >  probably meant to escape the dot, it is not treated as such.
 >  
 >  No, it meant that it is not needed in this context.
 
 It is, as we discussed on pkgsrcCon 2006. In string literals, "\." is 
 not any of the common escape sequences, as opposed to Perl. On the other 
 hand, the string literal "\\." contains two characters, which are then 
 interpreted correctly by the regex operator.
 
 $ printf "foo\\n...\\n" | awk '$0 ~ "." { print }'
 $ printf "foo\\n...\\n" | awk '$0 ~ "\." { print }'
 $ printf "foo\\n...\\n" | awk '$0 ~ "\\." { print }'
 
 Roland