FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 09-03-2010, 09:04 PM
Etaoin Shrdlu
 
Default gawk and filefuncs

On Fri, 3 Sep 2010 22:31:01 +0200 Al <oss.elmar@googlemail.com> 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.
 
Old 09-03-2010, 10:25 PM
Al
 
Default gawk and filefuncs

>
> 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.
>
>

Thank you very much. That is the best explanation a read to this. It
should be deliverd with the sources.

Still the procedure is unusual. They could apply a patch to
extensions/ filefuncs.c and exclude it for vanilla.

I have a second issue. When compiling gawk on Cygwin, where is no
windows kernel, the Gentoo version of filefuncs breaks. I have to
disable it in the ebuild to get gawk compiled.

filefuncs.o:filefuncs.c.text+0x1e): undefined reference to `_make_builtin'
[... lots of this ... ]
filefuncs.o:filefuncs.c.text+0x10f1): undefined reference to `_update_ERRNO'
collect2: ld returned 1 exit status
make: *** [filefuncs.so.0.0.1] Error 1

You say it is mandatory on a Gentoo system, because there are awk
scripts that rely on. Do this functions break because of the missing
kernel? What would be the workaround?

Thanks

Al
 
Old 09-03-2010, 10:26 PM
Al
 
Default gawk and filefuncs

> I have a second issue. When compiling gawk on Cygwin, where is no
> windows kernel, the Gentoo version of filefuncs breaks. I have to

Sure there is a windows kernel. The linux kernel is missing.

Al
 
Old 09-04-2010, 09:58 AM
Etaoin Shrdlu
 
Default gawk and filefuncs

On Sat, 4 Sep 2010 00:25:32 +0200 Al <oss.elmar@googlemail.com> wrote:

> Thank you very much. That is the best explanation a read to this. It
> should be deliverd with the sources.
>
> Still the procedure is unusual. They could apply a patch to
> extensions/ filefuncs.c and exclude it for vanilla.

Since it's critical for Gentoo gawk, perhaps they didn't want to depend on
gawk's source distribution suddenly removing that file or otherwise
changing (and patches need to be maintained up-to-date against the
original, while a standalone file does not need maintenance).
But this is all just my guessing.

> I have a second issue. When compiling gawk on Cygwin, where is no
> windows kernel, the Gentoo version of filefuncs breaks. I have to
> disable it in the ebuild to get gawk compiled.
>
> filefuncs.o:filefuncs.c.text+0x1e): undefined reference to
> `_make_builtin' [... lots of this ... ]
> filefuncs.o:filefuncs.c.text+0x10f1): undefined reference to
> `_update_ERRNO' collect2: ld returned 1 exit status
> make: *** [filefuncs.so.0.0.1] Error 1
>
> You say it is mandatory on a Gentoo system, because there are awk
> scripts that rely on. Do this functions break because of the missing
> kernel? What would be the workaround?

How are you building it? It needs special commands because it needs to
become a shared object, not an executable.

Note that building that file is by no means necessary for a working gawk.

And, even if you built it, it wouldn't do anything unless you specifically
used the extension() gawk command to reference the object file and import
the extra definitions (see the link I posted in the first email for all
the gory details. Also the Makefile that comes with Gentoo's own
filefuncs.c may help).
 
Old 09-04-2010, 10:51 AM
Al
 
Default gawk and filefuncs

>> You say it is mandatory on a Gentoo system, because there are awk
>> scripts that rely on. Do this functions break because of the missing
>> kernel? What would be the workaround?
>
> How are you building it? It needs special commands because it needs to
> become a shared object, not an executable.
>

Here is how I am building it and the whole context:

http://en.gentoo-wiki.com/wiki/Prefix/Cygwin#gawk-3.1.7:_.5Bfilefuncs.so.0.0.1.5D_Error_1

emerge --oneshot gawk


> Note that building that file is by no means necessary for a working gawk.
>
> And, even if you built it, it wouldn't do anything unless you specifically
> used the extension() gawk command to reference the object file and import
> the extra definitions (see the link I posted in the first email for all
> the gory details. Also the Makefile that comes with Gentoo's own
> filefuncs.c may help).

I did understand, that it is an extension, which provides additional
commands for awk scripts and that the gentoo system makes use of them
especially of it's own additions.

Options:

1.) It would compile on Cygwin. I just made a mistake.
2.) It depends on the missing kernel. I have to rewrite Gentoos
filefuncs.c to work without a linux kernel.
3.) I can go with the original extension. Portage does not really
depend on Gentoos additions.
4.) I have to adapt all awk scripts that make use of it.

Al
 

Thread Tools




All times are GMT. The time now is 09:49 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org