You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by "Malte S. Stretz" <ms...@gmx.net> on 2004/01/18 23:57:16 UTC

More on spamd/win (was: Own directory for spamc?)

On Sunday 18 January 2004 21:05 CET Sidney Markowitz wrote:
> Malte S. Stretz wrote:
> > spamd isn't started directly but an intermediate script SATest.pl
> > which does the redirection of STDOUT and STDERR
>
> Do you mean SATest.pm? That's where the call to system() is.
>
> Here is the problem: The only way to fork the background in the
> background is to use the 'start' command to launch it. If you try to use
> redirection with a 'start' command, the output of start is redirected
> but the stdin and stdout handles are not passed to the process it starts
> up. There is no workaround that I know. You cannot get both the running
> in the background and the redirection. Good old Windoze.

You can if you put Perl in between :) But I thought the wrong way round when 
I wrote the code. I just committed another change which should make the 
stuff work. You need to set the following variables:
  SPAMD_FORKER=start \cygwin\bin\perl
  SPAMD_SCRIPT=\cygwin\bin\perl -w -T /bin/spamd
I'm not sure about the latter. If the wrapper script was already called via 
the cygwin Perl, it should be enough (or necessary) to say
  SPAMD_SCRIPT=/bin/spamd
or
  SPAMD_SCRIPT=/bin/perl -w -T /bin/spamd

('-x' and '-s stderr' are no longer necessary, as they are the default now)

> > But what I really wanted to know, does spamc still compiles
> > successfully after the move?
>
> Yes, it works fine! :-)

That's good, I wasn't sure if VC would like the getopt.{c,h} files in the 
subdirectoy.

Cheers,
Malte

-- 
[SGT] Simon G. Tatham: "How to Report Bugs Effectively"
      <http://www.chiark.greenend.org.uk/~sgtatham/bugs.html>
[ESR] Eric S. Raymond: "How To Ask Questions The Smart Way"
      <http://www.catb.org/~esr/faqs/smart-questions.html>

Re: More on spamd/win

Posted by Sidney Markowitz <si...@sidney.com>.
Malte S. Stretz wrote:
> I checked in those changes, now everything should run smoothly.

It all tests out ok in both Cygwin and Windows.

Thanks!

  --sidney


Re: More on spamd/win

Posted by "Malte S. Stretz" <ms...@gmx.net>.
On Monday 19 January 2004 03:10 CET Sidney Markowitz wrote:
> At the end of this I got all tests working under Windows except
> spamd_unix.t which wasn't supposed to be run but tried because of a
> typo: It says RUNNING_IN_WINDOWS instead of RUNNING_ON_WINDOWS in two
> places near the beginning.

Whoops. Corrected.

> The makefile calls perl2bat on spamc.exe which is not correct. perl2bat
> is supposed to be called only on perl scripts. I this is something to
> fix in Makefile.PL. It doesn't really hurt anything, just creates a
> bogus bat file named spamc.exe.bat.

Yeah, I wondered about that, too. But that's done automagically by EU::MM, 
nothing I can change.

> Ok, now for the heart of this message:
> > You need to set the following variables:
> >   SPAMD_FORKER=start \cygwin\bin\perl
> >   SPAMD_SCRIPT=\cygwin\bin\perl -w -T /bin/spamd
>
> I don't like having to use all these environment variables, and I don't
> think both are necessary.
>
> Since the tests run under SATest.pm are always running in a native perl
> environment, you can always set $spamd_fork to "start $perl_path" when
> running under Windows and $perl_path otherwise.

Good point.

> The Windows perl is perfectly capable of running SATest.pl to invoke
> spamd after doing the redirection.
>
> I just tried it and it works. The only change I made was at line 280 in
> SATest.pm
>
>    my $spamd_forker = $perl_path;
>    $spamd_forker = "start " . $spamd_forker if ($^O =~ /^MS(DOS|Win)/i);
>
> And I had SPAMD_SCRIPT set to
>
> SPAMD_SCRIPT=\cygwin\bin\perl -w -T /bin/spamd --syslog-socket none

The --syslog-socket isn't necessary, too. It's set automagically to that 
value if --syslog stderr is used.

I checked in those changes, now everything should run smoothly.

Cheers (and Thanks for your help),
Malte

-- 
[SGT] Simon G. Tatham: "How to Report Bugs Effectively"
      <http://www.chiark.greenend.org.uk/~sgtatham/bugs.html>
[ESR] Eric S. Raymond: "How To Ask Questions The Smart Way"
      <http://www.catb.org/~esr/faqs/smart-questions.html>

Re: More on spamd/win

Posted by Sidney Markowitz <si...@sidney.com>.
Malte S. Stretz wrote:

I'm writing this backwards, short minor points first so they don't get 
lost in my large message:

At the end of this I got all tests working under Windows except 
spamd_unix.t which wasn't supposed to be run but tried because of a 
typo: It says RUNNING_IN_WINDOWS instead of RUNNING_ON_WINDOWS in two 
places near the beginning.

I can't test dns.t behind the firewall where I am now, but it did behave 
as expected in this environment.

The makefile calls perl2bat on spamc.exe which is not correct. perl2bat 
is supposed to be called only on perl scripts. I this is something to 
fix in Makefile.PL. It doesn't really hurt anything, just creates a 
bogus bat file named spamc.exe.bat.

Ok, now for the heart of this message:

> You need to set the following variables:
>   SPAMD_FORKER=start \cygwin\bin\perl
>   SPAMD_SCRIPT=\cygwin\bin\perl -w -T /bin/spamd

I don't like having to use all these environment variables, and I don't 
think both are necessary.

Since the tests run under SATest.pm are always running in a native perl 
environment, you can always set $spamd_fork to "start $perl_path" when 
running under Windows and $perl_path otherwise.

The Windows perl is perfectly capable of running SATest.pl to invoke 
spamd after doing the redirection.

I just tried it and it works. The only change I made was at line 280 in 
SATest.pm

   my $spamd_forker = $perl_path;
   $spamd_forker = "start " . $spamd_forker if ($^O =~ /^MS(DOS|Win)/i);

And I had SPAMD_SCRIPT set to

SPAMD_SCRIPT=\cygwin\bin\perl -w -T /bin/spamd --syslog-socket none

  -- sidney