Bug 143367 - [patch] awk(1) treats -Ft as -F <tab>
Summary: [patch] awk(1) treats -Ft as -F <tab>
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.2-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Warner Losh
Depends on:
Reported: 2010-01-30 10:30 UTC by Mikolaj Golub
Modified: 2021-07-31 05:17 UTC (History)
0 users

See Also:

file.diff (1.17 KB, patch)
2010-01-30 10:30 UTC, Mikolaj Golub
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikolaj Golub 2010-01-30 10:30:02 UTC
This problem with awk(1) regexp working incorrectly was reported to NetBSD by Aleksey Cheusov and it was fixed there.


FreeBSD version still has this bug:

zhuzha:~% echo supertable | awk  -Ft '{print $1, $2}'
zhuzha:~% echo -e "super\ttable" | awk  -Ft '{print $1, $2}'
super table

Fix: See the attached patch adopted from NetBSD (PR/39133: cheusov at tut dot by: Don't treat -Ft as -F <tab>).

Patch attached with submission follows:
How-To-Repeat: echo supertable | awk  -Ft '{print $1, $2}'
Comment 1 Alexander Best freebsd_committer 2010-11-15 20:40:43 UTC
it seems the netbsd folks however didn't report this isse upstream. i'll
contact Brian Kernighan and see if he wants to fix this bug in the upstream
awk version.

if that works out i might try getting the other awk-related patches the netbsd
folks came up with committed upstream.


Comment 2 Alexander Best freebsd_committer 2010-11-15 20:40:53 UTC
Responsible Changed
From-To: freebsd-bugs->arundel

Over to me. I'll try to get this one committed upstream. Stay tuned. ;)
Comment 3 Alexander Best freebsd_committer 2010-11-17 01:53:56 UTC
unfortunately i wasn't able to find Brian Kernighan's current email address.
the old atlabs one bounces. can somebody help me out here?


Comment 4 Alexander Best freebsd_committer 2010-12-11 19:56:39 UTC
Responsible Changed
From-To: arundel->freebsd-bugs

Back into the pool, since i was not able to contact Brian Kernighan.
Comment 5 Alexander Best freebsd_committer 2011-02-15 00:47:51 UTC
for the record:

i talked to Brian Kernighan (his current mail address is bwk at CS dot
Princeton dot EDU btw). he seems like a nice guy, but quite obviously is more
of a thinker and not that much of a do'er. ;)

chances this will get fixed upstream are very slim imo.

this is what he had to say:

Hi --
That behavior is a feature, not a bug, though it's kind of embarrassing
in hindsight.  It was meant to make it really easy to do the most common
exceptional case, but it sure is kludgy.  I'm torn.


Comment 6 Pedro F. Giffuni freebsd_committer 2017-10-08 17:45:54 UTC
Warner is checking out some awk changes from NetBSD.
Comment 7 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:43:20 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
- Untouched since 2018-01-01.
- Affects Base System OR Documentation


Reset to open status.

I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Comment 8 Warner Losh freebsd_committer 2021-07-08 01:18:48 UTC
The 20210221 version still behaves this way.
Comment 9 Warner Losh freebsd_committer 2021-07-08 05:19:26 UTC
I'll see if I can get upstream interested in this. gawk does as you suggest.
Comment 10 Warner Losh freebsd_committer 2021-07-10 20:24:20 UTC
I've created a pull request upstream
for this issue.
Comment 11 Warner Losh freebsd_committer 2021-07-10 21:15:01 UTC
(In reply to Warner Losh from comment #10)
The deltas are tiny enough, though, we could carry them as a local mod.
Comment 12 Warner Losh freebsd_committer 2021-07-10 21:20:54 UTC
I just checked NetBSD and they have reverted this change as well and
maintain the historic t->\t wart now.

I'll wait to see what upstream has to say about my pull request..
Comment 13 Warner Losh freebsd_committer 2021-07-11 16:03:28 UTC
https://github.com/onetrueawk/awk/pull/124 is the new pull request: I had to redo it to base it on staging rather than master branch.
Comment 14 Warner Losh freebsd_committer 2021-07-31 05:16:37 UTC
Upstream seems poised to accept this change.

I believe 12.x and 13.x should accept the wart and warn, while 14 should not accept the wart at all, since that's the direction upstream seems to be headed if I'm reading the tea leaves correctly.