From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1OrdfH-0003wd-CD for garchives@archives.gentoo.org; Fri, 03 Sep 2010 21:19:15 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DACF1E0818; Fri, 3 Sep 2010 21:18:42 +0000 (UTC) Received: from dcnode-02.unlimitedmail.net (smtp.unlimitedmail.net [94.127.184.242]) by pigeon.gentoo.org (Postfix) with ESMTP id 79AF7E0818 for ; Fri, 3 Sep 2010 21:18:41 +0000 (UTC) Received: from scooter.muppet.show (hex.aaisp.net.uk [90.155.53.9] (may be forged)) (authenticated bits=0) by dcnode-02.unlimitedmail.net (8.14.3/8.14.3) with ESMTP id o83LIY6v029398 for ; Fri, 3 Sep 2010 23:18:35 +0200 Date: Fri, 3 Sep 2010 22:04:29 +0100 From: Etaoin Shrdlu To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] gawk and filefuncs Message-ID: <20100903220429.4c949e46@scooter.muppet.show> In-Reply-To: References: X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; x86_64-pc-linux-gnu) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SOLTECSIS-MailScanner-ID: o83LIY6v029398 X-SOLTECSIS-MailScanner-From: shrdlu@unlimitedmail.org X-Spam-Status: No X-Archives-Salt: abb40a60-a038-46f4-9f24-d1828a63c165 X-Archives-Hash: 163e1626f98d323823693eb63fb0a506 On Fri, 3 Sep 2010 22:31:01 +0200 Al 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.