Project

General

Profile

Actions

Feature #12482

closed

Have /usr/bin/awk point to /usr/bin/nawk

Added by Dan McDonald over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

Today, /usr/bin/awk points to a very old version of awk, also instantiated as "oawk":

omniosce(~)[0]% ls -lti /usr/bin/*awk
    120141 -r-xr-xr-x   1 root     bin       130908 Nov 13 00:12 /usr/bin/nawk*
    120121 -r-xr-xr-x   2 root     bin        94924 Nov 13 00:12 /usr/bin/awk*
    120121 -r-xr-xr-x   2 root     bin        94924 Nov 13 00:12 /usr/bin/oawk*
    112828 -rwxr-xr-x   2 root     bin       764576 Nov 13 00:12 /usr/bin/gawk*
omniosce(~)[0]% 

In SmartOS, that has pointed to the more modern "nawk" for some time, AND oawk has been discontinued:

smartos(~)[0]% ls -lti /usr/bin/*awk
      2737 -r-xr-xr-x   2 root     bin       130996 Feb 28 10:44 /usr/bin/awk*
      2737 -r-xr-xr-x   2 root     bin       130996 Feb 28 10:44 /usr/bin/nawk*
smartos(~)[0]% 

Some software (e.g. https://dehydrated.io/) assume awk has nawk-level functionalilty. (That they may assume gawk-like features is another problem not addressed here.)

This issue proposes merely making "awk" hardlink to "nawk" instead of "oawk", keeping oawk and /usr/xpg4/bin/nawk around until distinct issues address their fates.


Files

new.txt (10.7 KB) new.txt Dan McDonald, 2020-04-21 10:46 PM
stock.txt (10.7 KB) stock.txt Dan McDonald, 2020-04-21 10:46 PM
Actions #1

Updated by Joshua M. Clulow over 1 year ago

This seems pretty reasonable, assuming we've pulled in all the awk cleanup and test suite work Cody did in illumos-joyent. We'll want to make sure distributions that aren't already doing this on their own get a heads up for their release notes because there are certainly one or two very incorrect scripts that the old awk nonetheless used to allow which will now be correctly rejected.

Actions #2

Updated by Dan McDonald over 1 year ago

It appears the awk cleanup done in illumos-joyent has made its way upstream as of #11552

nowhere(~/ws)[0]% diff -ru illumos-{gate,joyent}/usr/src/cmd/awk
nowhere(~/ws)[0]% diff -ru illumos-{gate,joyent}/usr/src/cmd/oawk
nowhere(~/ws)[0]% 

Given the lack differences in oawk, it does appear that illumos-joyent uses `manifest` to effect the change specified in this bug. For upstreaming we'll have to modify Makefiles in both of the above directories (and system-extended-system-utilities.mf).

There ARE some usr/src/test subtle differences thanks to Joyent's OS-8022 (illumos-joyent:0a695497aef591f5c00620a61dffd4a0e4a5d47c), but they're only in three files and are small changes. They may go upstream as part of this fix.

Actions #3

Updated by Dan McDonald over 1 year ago

Test differences between old and new are all about tmpfile names and awk now being nawk:

bloody(~)[0]% diff stock.txt new.txt 
1c1
< Running AWK tests ($AWK="/usr/bin/nawk")
---
> Running AWK tests ($AWK="/usr/bin/awk")
177c177
< examples/awk/t.ofs... Warning: missing newline at end of file /tmp/dViaq_4
---
> examples/awk/t.ofs... Warning: missing newline at end of file /tmp/dmSaawd
180c180
< examples/awk/t.ors... Warning: missing newline at end of file /tmp/dZiaG_4
---
> examples/awk/t.ors... Warning: missing newline at end of file /tmp/drSaqwd
243,244c243,244
< numeric-output-seps.awk... Warning: missing newline at end of file /tmp/nawktest.1j0ikk/test.temp.out
< Warning: missing newline at end of file /tmp/desaaq5
---
> numeric-output-seps.awk... Warning: missing newline at end of file /tmp/nawktest.0r9uvl/test.temp.out
> Warning: missing newline at end of file /tmp/dX1aWMd
bloody(~)[1]% ls -lti /usr/bin/*awk
     54204 -r-xr-xr-x   2 root     bin       130896 Apr 15 16:10 /usr/bin/awk*
     54204 -r-xr-xr-x   2 root     bin       130896 Apr 15 16:10 /usr/bin/nawk*
     54143 -r-xr-xr-x   1 root     bin        94908 Apr 15 16:10 /usr/bin/oawk*
    116879 -rwxr-xr-x   2 root     bin       776840 Mar 24 13:34 /usr/bin/gawk*
bloody(~)[0]% 

Actions #4

Updated by Dan McDonald over 1 year ago

Also, the man page for awk now points to a modified version of the nawk page, and oawk is its own man page now.

Actions #5

Updated by Dan McDonald over 1 year ago

Forgot to add awk test suite raw outputs. Doing so now.

Actions #6

Updated by Electric Monk over 1 year ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit e98dc02a871a9cd0498c8862434b16aa85e772d3

commit  e98dc02a871a9cd0498c8862434b16aa85e772d3
Author: Dan McDonald <danmcd@joyent.com>
Date:   2020-04-22T00:56:20.000Z

    12482 Have /usr/bin/awk point to /usr/bin/nawk
    Reviewed by: Peter Tribble <peter.tribble@gmail.com>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Robert Mustacchi <rm@fingolfin.org>

Actions

Also available in: Atom PDF