DragonFly kernel List (threaded) for 2009-08
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
Re: bad awk output on vkernel
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.
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]