Bug 214783 - [patch] awk(1) POSIX character classes never match backslash
Summary: [patch] awk(1) POSIX character classes never match backslash
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.1-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: Warner Losh
Keywords: patch
Depends on:
Reported: 2016-11-23 14:00 UTC by martin
Modified: 2018-08-28 20:15 UTC (History)
2 users (show)

See Also:

Patch to escape chars in POSIX character classes (673 bytes, patch)
2016-11-23 14:00 UTC, martin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description martin 2016-11-23 14:00:33 UTC
Created attachment 177332 [details]
Patch to escape chars in POSIX character classes

The commands below should print "yes" but on FreeBSD they print nothing:

echo '\' | awk '/[[:print:]]/ { print "yes" }'

The attached patch fixes this (and also a theoretical problem with matching hyphen).
Comment 1 Pedro F. Giffuni freebsd_committer 2017-10-08 17:41:35 UTC
Warner is collecting awk patches.
Comment 2 Stefan Hagen 2018-08-28 20:07:18 UTC

Is there an Update to this? We've just spend a good day with 3 people to figure out why FreeBSD awk is behaving different than all other BSD awks, just to find an unapplied patch from years ago that would solve the problem.

Can we have this one applied, please?

Best Regards,
Comment 3 Warner Losh freebsd_committer 2018-08-28 20:15:11 UTC
I didn't apply this patch to the tree because it was one of several patches I staged up, only to find that one of them was causing problems... Not sure it was this one or not, and got pulled away on other things.