On Fri, 3 Sep 2010 22:31:01 +0200 Al <[email protected]> wrote:

> Can anybody explain the Gentoo handling of filefuncs in the gawk package?
> 
> Why isn't a simple patch used like in all other cases?

gawk provides dynamic extension modules. This is explained here:

http://www.gnu.org/manual/gawk/gawk.html#Dynamic-Extensions

The gawk source distribution comes with a number of such extensions in the
(doh) extensions/ directory. filefuncs.c is such one extension, which
demonstrate how to add stat() and chdir() capabilities to awk.
The file is compiled into a .so file, which is then referenced from within
gawk to make the extended commands available.

A vanilla build of gawk does not have any dynamic extension.


Now, the Gentoo devs at some point in the past (very early) took that file
(filefuncs.c) and extended it to implement new commands like "symlink",
"unlink", "mkdir", "rmdir" and "stat", so those are callable from within
awk, effectively extending the language. (you can see the Gentoo copyright
in the file, look
into /usr/portage/sys-apps/gawk/files/filefuncs/filefuncs.c)

There are a number of Gentoo system scripts that use those awk extensions
(look into /lib/rcscripts and /lib/rcscripts/awk), which means that
compiling the expanded filefuncs.c (not the vanilla one) is mandatory on a
Gentoo system, because there are awk scripts that rely on the extended
functionaltiy provided by it. Hence Gentoo maintains the filefuncs.c file
independently, and the gawk ebuild, besides building gawk itself, also takes
care of building filefuncs.c containing the extensions.

Reply via email to