You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by si...@apache.org on 2007/12/28 14:05:04 UTC

svn commit: r607229 - /spamassassin/trunk/sa-compile.raw

Author: sidney
Date: Fri Dec 28 05:05:04 2007
New Revision: 607229

URL: http://svn.apache.org/viewvc?rev=607229&view=rev
Log:
bug 5748: use built-in sort in sa-compile to avoid locale issues we had with external sort

Modified:
    spamassassin/trunk/sa-compile.raw

Modified: spamassassin/trunk/sa-compile.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sa-compile.raw?rev=607229&r1=607228&r2=607229&view=diff
==============================================================================
--- spamassassin/trunk/sa-compile.raw (original)
+++ spamassassin/trunk/sa-compile.raw Fri Dec 28 05:05:04 2007
@@ -327,14 +327,15 @@
   my $force = 1;
   my $FILE = shift;
   my $fh;
+  my @sfh;
 
-  {
-      local $ENV{LC_ALL} = "C";
-      open($fh, "sort $FILE |") || die "open($FILE): $!";
-  }
+  open($fh, $FILE) || die "open($FILE): $!";
+  @sfh = <$fh>;
+  close $fh;
+  @sfh = sort(@sfh);
 # read ruleset name from the first line in the file
   my $ruleset_name;
-  $_ = <$fh>;
+  $_ = shift(@sfh);
   local ($1);
   if (/^name\s+(\S+)/) {
     $ruleset_name = untaint_var($1);
@@ -362,7 +363,7 @@
   my $numscans = 0;
   my $has_rules = '';
 
-  while (!eof($fh)) {
+  while (@sfh) {
     $numscans++;
 
     open(my $re, ">scanner${numscans}.re") || die "open(>scanner{$numscans}.re): $!";
@@ -388,7 +389,7 @@
 
     my $line = 0;
     my $rulecount = 0;
-    while (<$fh>) {
+    while ($_ = shift(@sfh)) {
       next if /^#/;
 
       local ($1,$2);