bad awk output on vkernel
YONETANI Tomokazu
qhwt+dfly at les.ath.cx
Thu Oct 1 16:22:48 PDT 2009
I'd like to add this as a bug so as it's not forgotten, or attract
someone else's attention. It also seems to affect pkgsrc packages
using awk in its configure script, for instance.
On Tue, Aug 18, 2009 at 09:17:51PM +0900, YONETANI Tomokazu wrote:
> On Thu, Aug 13, 2009 at 11:48:18PM -0700, Matthew Dillon wrote:
> > Is this with the latest master ? I did fix some pipe bugs last week
> > which could very well cause this sort of behavior (where the data gets
> > corrupted through the pipe). I'm pretty sure I got all the bugs, there
> > shouldn't be any left.
> >
> > If it isn't that I'll have to try to reproduce it on a test bed and
> > then track the issue down.
>
> I'd say it's not a pipe issue, but specific to running awk on vkernel,
> because this perl version never produces bad output on vkernel:
>
> my $SUBSEP = "\034";
> my $flag = 0;
> my @record;
> while (<>) {
> chomp;
> if (/^[ \t]*(;|$)/) {
> $flag = 0;
> next;
> }
> if (/^[^ \t]/) {
> if ($flag == 0) {
> push(@record, $_);
> $flag = 1;
> }
> else {
> my $l = @record - 1;
> $record[$l] .= $SUBSEP;
> $record[$l] .= $_;
> }
> }
> }
>
> foreach (sort @record) {
> print $_, "\n";
> }
>
> My guess is that awk on vkernel has problem handling an array of long
> strings, especially its elements are assigned to in a non-sequential way;
> if I commented the line calling sort() function and it greatly reduced
> the probability of inconsistent output :)
>
> I also tried gawk from pkgsrc, but it seems to have similar issue.
> Probably I need to take a closer look at the source code.
More information about the Bugs
mailing list