You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2006/06/15 23:41:59 UTC

[Bug 4958] New: sa-update doesn't recognize gpg on windows

http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958

           Summary: sa-update doesn't recognize gpg on windows
           Product: Spamassassin
           Version: 3.1.3
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P5
         Component: sa-update
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: bret.miller@wcg.org


The find_gpg_path sub needs some windows-specific code to properly find gpg in
the path. The modified sub is pasted below-- I realize that it'll need a check
for windows and a separate set of code to work in both *nix and windows. The two
lines that change are the split for the path which uses ; instead of : on
windows, and the catfile which needs the .exe on the end of gpg. Those were the
only changes. 

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.exe');
    if (-x $dir) {
      $path = $dir;
      last;
    }
  }
  die "fatal: couldn't find GPG in \$PATH\n" unless ($path);
  dbg("gpg: found $path");
  return $path;
}



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4958] [review] sa-update doesn't recognize gpg on windows

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958





------- Additional Comments From jm@jmason.org  2006-06-29 09:29 -------
ha!  good catch.  +1



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4958] [review] sa-update doesn't recognize gpg on windows

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958





------- Additional Comments From bret.miller@wcg.org  2006-07-17 15:52 -------
I downloaded the latest snapshot from cvs and it works perfectly here. Thanks.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4958] [review] sa-update doesn't recognize gpg on windows

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958


jm@jmason.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard|needs 2 votes               |Needs 1 vote






------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4958] [review] sa-update doesn't recognize gpg on windows

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958


spamassassin@dostech.ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard|needs 1 votes for 3.1 branch|can be committed




------- Additional Comments From spamassassin@dostech.ca  2006-07-14 21:02 -------
+1 on 3583



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4958] [review] sa-update doesn't recognize gpg on windows

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958


felicity@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard|needs 2 votes for 3.1 branch|needs 1 votes for 3.1 branch




------- Additional Comments From felicity@apache.org  2006-07-14 17:59 -------
Sure, +1 3583



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4958] [review] sa-update doesn't recognize gpg on windows

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958


felicity@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|sa-update doesn't recognize |[review] sa-update doesn't
                   |gpg on windows              |recognize gpg on windows
  Status Whiteboard|                            |needs 2 votes
   Target Milestone|Undefined                   |3.1.4




------- Additional Comments From felicity@apache.org  2006-06-27 17:23 -------
Thanks for the report!

It turns out that find_gpg_path() was largely a reimplementation of a function
in Util.pm which wasn't used for some reason.  I'll put in a patch shortly which
makes sa-update look for gpg.exe when running on Windows and also uses the Util
function (which properly handles PATH differences).



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4958] [review] sa-update doesn't recognize gpg on windows

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958





------- Additional Comments From felicity@apache.org  2006-06-27 17:24 -------
Created an attachment (id=3563)
 --> (http://issues.apache.org/SpamAssassin/attachment.cgi?id=3563&action=view)
suggested patch

as committed to 3.2:

Sending        sa-update.raw
Transmitting file data .
Committed revision 417532.




------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4958] [review] sa-update doesn't recognize gpg on windows

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958





------- Additional Comments From bret.miller@wcg.org  2006-07-10 14:35 -------
(In reply to comment #8)
> Does 3563+3566 fix the problem?  Comment #7 seems to say it doesn't.

Yes and no. 3563+3566 causes it to recognize and attempt to run GPG, but it does
so by single-quoting (') a file path which doesn't work on Windows. It requires
an additional patch to use double quotes (") instead when running on Windows.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4958] [review] sa-update doesn't recognize gpg on windows

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958





------- Additional Comments From felicity@apache.org  2006-06-30 17:57 -------
Created an attachment (id=3566)
 --> (http://issues.apache.org/SpamAssassin/attachment.cgi?id=3566&action=view)
additional patch




------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4958] [review] sa-update doesn't recognize gpg on windows

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958





------- Additional Comments From jm@jmason.org  2006-06-30 18:07 -------
+1



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4958] [review] sa-update doesn't recognize gpg on windows

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958





------- Additional Comments From bret.miller@wcg.org  2006-06-30 19:04 -------
Applied the patches and found one more issue that prevents this from working on
Windows. Windows doesn't allow single-quoting of file paths, so here's another
updated section (following right after the find_gpg_path). I'm not sure this is
the best way to do it, but it works here...


sub interpolate_gpghomedir {
  my $gpghome = '';
  if ($opt{'gpghomedir'}) {
    $gpghome = $opt{'gpghomedir'};
    if (Mail::SpamAssassin::Util::am_running_on_windows()) {
      $gpghome =~ s/\'/\\\"/gs;
      $gpghome = "--homedir=\"$gpghome\"";
    } else {
      $gpghome =~ s/\'/\\\'/gs;
      $gpghome = "--homedir='$gpghome'";
    }
  }
  return $gpghome;
}




------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4958] [review] sa-update doesn't recognize gpg on windows

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958


jm@jmason.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
Attachment #3563 is|0                           |1
           obsolete|                            |
Attachment #3566 is|0                           |1
           obsolete|                            |




------- Additional Comments From jm@jmason.org  2006-07-14 11:59 -------
Created an attachment (id=3583)
 --> (http://issues.apache.org/SpamAssassin/attachment.cgi?id=3583&action=view)
new combo patch

ok, here's a new patch that combines patches 3563 and 3566, then adds the
single-quote-phobia fix as well.  It's also checked into svn trunk.

Windows users, I'd appreciate if you can check this out and ensure it
works....



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4958] [review] sa-update doesn't recognize gpg on windows

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958


jm@jmason.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From jm@jmason.org  2006-07-15 19:27 -------
thanks; applied as r422279.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4958] [review] sa-update doesn't recognize gpg on windows

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958





------- Additional Comments From jm@jmason.org  2006-07-12 09:35 -------
hmm, that sounds pretty much like a "no" to me ;)



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4958] [review] sa-update doesn't recognize gpg on windows

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958





------- Additional Comments From spamassassin@dostech.ca  2006-07-09 22:28 -------
Does 3563+3566 fix the problem?  Comment #7 seems to say it doesn't.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4958] [review] sa-update doesn't recognize gpg on windows

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958


jm@jmason.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard|Needs 1 vote                |needs 2 votes for 3.1 branch






------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4958] [review] sa-update doesn't recognize gpg on windows

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4958





------- Additional Comments From felicity@apache.org  2006-06-30 17:56 -------
from the dev list:

Justin Mason:
>Radoslaw Zielinski writes:
>> > +  my $gpg = 'gpg';
>> > +  if (Mail::SpamAssassin::Util::am_running_on_windows()) {
>> > +    $gpg .= '.exe';
>> 
>> Cosmetic change (SA probably won't run on Stratus VOS anyway ;-) :
>> 
>>   require Config;
>>   my $gpg = "gpg$Config::Config{_exe}";
>> 
>> ...instead?
>
>yes, might as well use that ;)

Part of me doesn't like having to load in a whole module for this one tiny
thing, but ...  I put in a patch for 3.2, and will attach a small additional
patch for 3.1 shortly.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.