RFC: Virtual for awk implementation
Am 30.05.2012 02:11, schrieb Christoph Junghans:
> Hi,
>
> recently I stumbled across a problem with mawk, which is apprearly
> Ubuntu's default awk interpreter.
> This brought the idea to my mind of adding a virtual for awk. Beside
> the fact that we already have 3 awk interpreters in gx86 (gawk, mawk
> and busybox awk), there are other ones like nawk and awka.
>
> I had some discussions with spanKY on that topic in bug #415689, which
> summarizes in the following:
>
> Advantages:
> - mawk is faster - useful for scientific purposes
> - busybox awk could replace gawk on minimal systems
> - more POSIX conform systems
>
> Disadvantages:
> - some awk code in the tree and portage is probably using GNU
> extensions without executing gawk explicitly
> - gray zone of Posix 1003.2 (e.g. substr() function and an index of 0)
>
[...]
>
> I have tested mawk as default interpreter for a while on my x86 boxes
> and didn't observed any problems so far.
>
> Cheers,
>
> Christoph
>
An easy easy way to crash mawk is opening many different files.
mkdir -p mkdir /tmp/foo; find "$HOME" -type f -printf '%f %s
' |
gawk '{ print $2 > "/tmp/foo/" $1 }'
--> Fills /tmp/foo with small files
mkdir -p mkdir /tmp/foo; find "$HOME" -type f -printf '%f %s
' |
mawk '{ print $2 > "/tmp/foo/" $1 }'
--> Crashes with error 'mawk: cannot open "/tmp/foo/7B090d01" for output
(Too many open files)'
Probably not the cleverest approach to this but just a reminder that
there are still subtle differences.
That being said, +1 for giving the choice.
Regards,
Florian Philipp
|