Page MenuHomeFreeBSD

awk: revert to upstream behavior for ranges for gawk compatibility
ClosedPublic

Authored by imp on Jul 9 2021, 8:21 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 9 2024, 9:47 AM
Unknown Object (File)
Dec 22 2023, 9:54 PM
Unknown Object (File)
Dec 14 2023, 10:32 PM
Unknown Object (File)
Dec 8 2023, 11:06 AM
Unknown Object (File)
Oct 13 2023, 3:06 PM
Unknown Object (File)
Oct 11 2023, 10:57 AM
Unknown Object (File)
Oct 11 2023, 4:13 AM
Unknown Object (File)
Aug 21 2023, 12:05 AM
Subscribers

Details

Summary

In 2005, FreeBSD changed one-true-awk to honor the locale's collating
order. This was billed as a temporary patch. It was also compatible with
the then-current behavior of gawk. That temporary patch has lasted 16
years now.

However, IEEE Std 1003.1-2008 changed the behaivor of ranges in regular
expressions outside of the "C" and "POSIX" locales to be undefined.

Starting in 2011, gawk 4.0 stopped using the locale for the range
regular expressions and used the traditional behavior only. The
maintainer had grown weary of answering why '[A-Z]' would sometimes
match lower-case expressions. The details about are explained here:
https://www.gnu.org/software/gawk/manual/html_node/Ranges-and-Locales.html

To restore compatibility with other implementaitons of awk, revert this
patch. FreeBSD is the odd-system out. It also has the nice side effect
of eliminating the last of our differences with upstream one-true-awk.

MFC After: 2 weeks
Sponsored by: Netflix

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

imp requested review of this revision.Jul 9 2021, 8:21 AM
imp created this revision.
rgrimes added a subscriber: rgrimes.
rgrimes added inline comments.
contrib/one-true-awk/main.c
120

Are there any possible side effects from this no-longer being cleared to NULL? Ie, what if LC_COLLATE is set, prior to this change that wouldn't matter, but after this change can that cause things like ports to break ? NVM, I think I answered that myself, after this change there are no more calls to strcoll, so this value would not matter anyway.

This revision is now accepted and ready to land.Jul 9 2021, 1:19 PM
cy added a subscriber: cy.

Reverting to standard is a good idea.

I plan on committing this w/o an exp run in the next few days.
https://marc.info/?l=freebsd-arch&m=162592710615072&w=2
has the context for why... The exp run is done in a context where
these changes wouldn't change anything, so it wouldn't be able to
detect any problems and would thus be a waste of time.