Mailing List Archive

svn commit: r422279 - /spamassassin/branches/3.1/sa-update.raw
Author: jm
Date: Sat Jul 15 12:29:21 2006
New Revision: 422279

URL: http://svn.apache.org/viewvc?rev=422279&view=rev
Log:
bug 4958: sa-update does not recognise gpg.exe on windows; fixed

Modified:
spamassassin/branches/3.1/sa-update.raw

Modified: spamassassin/branches/3.1/sa-update.raw
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.1/sa-update.raw?rev=422279&r1=422278&r2=422279&view=diff
==============================================================================
--- spamassassin/branches/3.1/sa-update.raw (original)
+++ spamassassin/branches/3.1/sa-update.raw Sat Jul 15 12:29:21 2006
@@ -43,6 +43,7 @@
use File::Copy;
use Getopt::Long;
use Pod::Usage;
+use Config;
use strict;
use warnings;

@@ -979,16 +980,14 @@
}

sub find_gpg_path {
- dbg("gpg: Searching for 'gpg' in ".$ENV{'PATH'});
- my $path;
- foreach my $dir (split(/:/, $ENV{'PATH'})) {
- $dir = File::Spec->catfile($dir, 'gpg');
- if (-x $dir) {
- $path = $dir;
- last;
- }
- }
- die "fatal: couldn't find GPG in \$PATH\n" unless ($path);
+ # bug 4958: for *NIX it's "gpg", in Windows it's "gpg.exe"
+ my $gpg = 'gpg' . $Config{_exe};
+
+ dbg("gpg: Searching for '$gpg'");
+
+ my $path = Mail::SpamAssassin::Util::find_executable_in_env_path($gpg) ||
+ die "fatal: couldn't find GPG\n";
+
dbg("gpg: found $path");
return $path;
}
@@ -997,8 +996,14 @@
my $gpghome = '';
if ($opt{'gpghomedir'}) {
$gpghome = $opt{'gpghomedir'};
- $gpghome =~ s/\'/\\\'/gs;
- $gpghome = "--homedir='$gpghome'";
+ if (Mail::SpamAssassin::Util::am_running_on_windows()) {
+ # windows is single-quote-phobic; bug 4958 cmt 7
+ $gpghome =~ s/\"/\\\"/gs;
+ $gpghome = "--homedir=\"$gpghome\"";
+ } else {
+ $gpghome =~ s/\'/\\\'/gs;
+ $gpghome = "--homedir='$gpghome'";
+ }
}
return $gpghome;
}