bug-textutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in sort!?


From: Tim Behrendsen
Subject: Bug in sort!?
Date: Sun, 21 Jul 2002 20:41:35 -0700 (PDT)

Hello,

I can't believe it, but the sort command appears to have a sorting bug!

I'm running version 2.0.14 on RedHat 7.3.

If I put these 3 lines in a file 'foo'...

packages/YCC Form.pm
packages/YCC/Form HistoryForm.pm
packages/YCC/Form PropertyForm.pm

and then type 'sort foo', I get...

packages/YCC/Form HistoryForm.pm
packages/YCC Form.pm
packages/YCC/Form PropertyForm.pm

How can this be under any circumstances? No matter how you sort it, the
middle line should come out at the end or the beginning! Just to make
sure I wasn't crazy, I wrote a perl program to make sure I wasn't just
missing a funny character or something...

my @list;
my $ln;
while ($ln = <>) {
    push(@list, $ln);
}
print join('', sort @list);

The Perl program on the exact file I'm using for this test is...

packages/YCC Form.pm
packages/YCC/Form HistoryForm.pm
packages/YCC/Form PropertyForm.pm

... which is what I would expect. I'm cutting and pasting all this, so
this is the exact input and output.

I'd love to hear a logical explanation for this! :)

Thanks,

Tim Behrendsen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]