awk strftime undocumented - one-true-awk/awk.1 vs awk(1)

Based on my answer here with:
$ pkg query %t-%n | sort | awk -F"-" '{ OFS="-"; $1=strftime("%Y-%m-%d %H:%M:%S", $1); print $0 }'

strftime in awk(1) is not documented in awk - 14.1R man page

On 14.1-RELEASE-p6 (I've cleared every "*awk" from installed packages) I have:
Code:
[1] ~ # cat /usr/share/man/man1/awk.1.gz /usr/share/man/man1/nawk.1.gz  | grep 'strftime'
[2] ~ # ls -i1 /usr/share/man/man1/awk.1.gz /usr/share/man/man1/nawk.1.gz
32665730 /usr/share/man/man1/awk.1.gz
32665730 /usr/share/man/man1/nawk.1.gz
[3] ~ # cat /usr/src/contrib/one-true-awk/awk.1 | grep 'strftime'
.BI strftime( fmt ", " timestamp\^ )
.IR strftime (3).
[4] ~ # pkg info | grep -i awk
[5] ~ #

Can you replicate this?
Any idea why isn't /usr/src/contrib/one-true-awk/awk.1 == awk(1) ?
 
Hi!
I have repeated your steps on 13.3-RELEASE-p2 - same result.
I only noticed that there are 2 awk folders in src

root@initr0 /usr/src> find . -name '*awk*' -type d
./contrib/netbsd-tests/usr.bin/awk
./contrib/one-true-awk
./usr.bin/awk


As I understand last one is in base system and installed automatically.
 
Hi!
I have repeated your steps on 13.3-RELEASE-p2 - same result.
I only noticed that there are 2 awk folders in src

root@initr0 /usr/src> find . -name '*awk*' -type d
./contrib/netbsd-tests/usr.bin/awk
./contrib/one-true-awk
./usr.bin/awk


As I understand last one is in base system and installed automatically.

The last directory just pulls in one-true-awk from contrib. There is no duplication of code.

However, for some reason the latter comes with its own manpage, which does not mention strftime. The manpage in the contrib directory does. File a bug.
 
However, for some reason the latter comes with its own manpage, which does not mention strftime.
My hunch is that awk's makefile#L50-L51:
Code:
SHIP = README LICENSE FIXES $(SOURCE) awkgram.tab.[ch].bak makefile  \
	 awk.1
has to be adapted to FreeBSD's base make system for base; akin to using PLIST_FILES as for example in beep's Makefile#L16 for ports:
Code:
PLIST_FILES=	bin/beep share/man/man1/beep.1.gz
 
Nope. Those files are simply not used at all. FreeBSD uses it's own build system - /usr/src/contrib/one-true-awk is simply the directory holding the one-true-awk source distribution.

The build is done under /usr/src/usr.bin/awk

You'll see that there is an awk.1 file in that directory, and the scripts are configured to use it.

The reason is historical - as you noted in your PR, the referenced PR's have dealt with the separate maintenance of the manual page, due to various local awk differences over the years. - The original source wasn't being developed, and various patches and modifications appeared along the years.

But a few years ago, I told Warner Losh about the official "one-true-awk" distribution now being active, and he spent some time syncing FreeBSD awk to use that. I think there were one or two "gotchas" that needed to be ironed out, but now the FreeBSD awk is indeed the "pure" one-true-awk version.

But no-one changed the part to stop using the locally produced man page. This was either an oversight, or Warner felt that the locally produced man page was better.

Obviously, you've highlighted problems with the local version, and I guess that now we are running pure "one-true-awk" without local patch differences, maybe it's time to switch to their man page rather than continually modifying our own? But Warner will be the person who can answer that.
 
Those files specified in makefile#L50-L51 are not being used indeed. In FreeBSD's build usr.bin/awk/Makefile I see:
Code:
AWKSRC=	${SRCTOP}/contrib/one-true-awk
.PATH: ${AWKSRC}
   [...]
LINKS=	${BINDIR}/awk ${BINDIR}/nawk
MLINKS=	awk.1 nawk.1
where in its first part, it seems to refer to contrib for its program code sources and only for its current man page it refers to an adapted local awk.1 file.

There are important functional differences between:
  • /usr/src/contrib/one-true-awk/awk.1
  • /usr/share/man/man1/awk.1.gz.
In its FreeBSD 14.1-RELEASE Release Notes FreeBSD advertises its featured commit:
One True Awk (awk(1)) has been updated to 2nd Edition, with new -csv support and UTF-8 support. src: daf917daba9c
referring to the command line option --csv, however, --csv and its UTF-8 support are not documented in awk(1).

Various "Other built-in functions" like systime, strftime etc. mentioned in /usr/src/contrib/one-true-awk/awk.1 are undocumented in awk(1) as well. From earlier imports of one-true-awk: src: 666abb0888d277e82c6468851e015798e9a7629f dating from 2021-07-07, already included systime and strftime.

Looking at the FreeBSD AWK man page, users of currently supported versions may well be missing out on undocumented new features as they are 'awkward' to find elsewhere.
 
Back
Top