Skip to main content.
home | support | download

Back to List Archive

Re: configuring and debugging swish.cgi with IIS

From: Nathan Vonnahme <nathan.vonnahme(at)not-real.bannerhealth.com>
Date: Thu Jun 12 2003 - 23:45:31 GMT
> >>> Bill Moseley <moseley@hank.org> 06/11/03 06:35PM >>>

> Now, I wish I had added a better comment.  But I think why that map is
> in there is to escape the quotes used in phrase searches.  That would
> indicate to me that the call is going through the shell.  Let me try...
> 
> Ok, it took four reboots but I got my old windows machine to boot and 
> look at this:
> 
> 
> C:\WINDOWS\Desktop>cat test.pl
> use IPC::Open2;
> $pid = open2( $rdrfh, $wtrfh,
>       'e:\Program Files\SWISH-E2.2\swish-e.exe',
>       '-H9', '-w', 'foo "bar baz"' );
> print while <$rdrfh>;
> 
> 
> C:\WINDOWS\Desktop>perl test.pl
> # SWISH format: 2.2.1
> # Search words: foo bar baz
>                    ^^^^^^^^ 
> Hey! were are the quotes?!?  Looks like the shell (or something) ate 
> them.
> 
> # Search Words: foo bar baz
> # Parsed Words: foo bar baz
> 
> Yep, something ate the quotes.  If you backslash them then they make it 
> through to swish-e.

Ack!  You're right!  And look at this, if we include -foobar in the search field

C:\Program Files\SWISH-E>type shelltest.pl
use IPC::Open2;
$pid = open2( $rdrfh, $wtrfh,
      'C:\Program Files\SWISH-E\swish-e.exe',
      '-w', 'foo "bar baz" -foobar',  '-H9');
print while <$rdrfh>;

C:\Program Files\SWISH-E>perl shelltest.pl
err: Index file error: Could not open the index file 'oobar': No such file or di
rectory
.

But if in DOS you were to type those commands/args joined with spaces, it would barf on the space in "Program Files", so it must not be using it for that....

It's also weird that backslashing the quotes worked for you, because DOS doesn't usually work that way--backslashes are for paths, not escaping.  Could it be the argument-parsing code in swish-e.exe that is eating the spaces?  If you're using a standard library for it, maybe there's a difference in the DOS/Unix implementations in this regard.

However, using cygwin's echo.exe instead of swish-e.exe behaves the same way, argggg....
C:\Program Files\SWISH-E>type shelltest.pl
use IPC::Open2;
$pid = open2( $rdrfh, $wtrfh,
      'C:\cygwin\bin\echo.exe',
      'foo "bar baz"',  '-w');
print while <$rdrfh>;

C:\Program Files\SWISH-E>perl shelltest.pl
foo bar baz -w


So, I guess then for now the backticks sub would need something like:
@_ = map {s/"/\\"/g; qq["$_"]}, @_ if $^O =~ /Win32/i;  # grr, Windows sucks
Received on Thu Jun 12 23:45:55 2003