This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: cygwin and the rest of the Windows
- From: "Ling F. Zhang" <lingfengz at yahoo dot com>
- To: cygwin at cygwin dot com
- Date: Mon, 23 Jun 2003 13:25:25 -0700 (PDT)
- Subject: Re: cygwin and the rest of the Windows
- Reply-to: lingfengz at yahoo dot com
Just based on what I have learned so far...I figure
out a more geniune way of how this works:
in cygwin, I made a shell script quo that goes like:
#!/usr/bin/bash
# this program takes user input (STDIN) and put a
quote around it...
# why do I have to do this? well, I can't figure out a
way in dos batch that would do the same...since using
echo autometically adds a "\n" at the end...
printf "\"";
while read LINE
do
printf "$LINE";
done
printf "\"";
and I wrote something called "bashwin.bat" that goes
like:
@echo off
REM this program is used so that executable in cygwin
written in shell or perl or whatever, can be executed
in Windows command
REM just associate this file in explorer with whatever
you want to run (e.g. .pl, .sh)
cygpath -u %1 | bash -c "quo" > tmp
bash --loging < tmp
del tmp
so now, at command prompt, I can type printenv.pl or
test.sh and they will execute....as if they were in
cygwin, with POSIX path of course...
the problem is, they still won't work as cgi script...
I got a 500 error (or 500 somthing..) and apache
error.log (apache 2.x for win32) reads like:
[Mon Jun 23 03:41:45 2003] [error] [client 127.0.0.1]
(720003)The system cannot find the path specified. :
couldn't create child process: 720003: printenv.pl
[Mon Jun 23 03:41:45 2003] [error] [client 127.0.0.1]
(720003)The system cannot find the path specified. :
couldn't spawn child process: C:/Program Files/Apache
Group/Apache2/cgi-bin/printenv.pl
[Mon Jun 23 03:43:31 2003] [error] [client 127.0.0.1]
(720003)The system cannot find the path specified. :
couldn't create child process: 720003: test.sh
[Mon Jun 23 03:43:31 2003] [error] [client 127.0.0.1]
(720003)The system cannot find the path specified. :
couldn't spawn child process: C:/Program Files/Apache
Group/Apache2/cgi-bin/test.sh
now...that I think has to do with the mixed up of
windows path and cygwin path...anyone can figure out
how to do this?
--- Igor Pechtchanski <pechtcha@cs.nyu.edu> wrote:
> Matthew (Ling?),
>
> In your case 1, it looks like you ran that command
> from bash. It's pretty
> obvious why it didn't work - bash needs POSIX paths.
> You had unquoted
> spaces, which bash interpreted as argument
> separators, and it also
> interpreted backslashes as escapes. You should have
> run that command from
> a cmd prompt.
>
> I also warned you that the name of the script will
> be passed in Win32
> form, and you'd need to use cygpath to convert it to
> POSIX. The file that
> worked for me (I actually created one that works
> this time) was:
>
> @echo off
> c:\cygwin\bin\bash.exe --login -c "/usr/bin/perl
> `/bin/cygpath -u '%1'`"
>
> You can add similar conversions for %2..%9, but I
> don't think they're
> necessary in your particular case (i.e., a file
> handler for the .pl
> extension). You may not need the "--login" - try
> running without it, that
> will keep you in the same directory. Oh, and the
> '#!' line would be
> ignored in this case, and the dispatch will be done
> by Windows Explorer
> based solely on the .pl extension.
>
> As for case 2, you might have to play similar games,
> but in the
> association mechanism. Something like
>
> c:\cygwin\bin\bash.exe -c "`cygpath -u '%s'`"
>
> (I don't have the exact incantation, you may need to
> read up on the
> Windows Explorer mechanism for this).
>
> Case 3 is actually a subcase of 1 - simply associate
> the .pl file with
> perl.bat, and you should be able to run it (as long
> as perl.bat is
> correct). You might wish to keep the "@echo off"
> out of the .bat file
> while you're debugging it, to know exactly what
> parameters bash gets.
> Igor
>
> On Sun, 22 Jun 2003, Ling F. Zhang wrote:
>
> > okay, a summary of what I am doing:
> > case 1:
> > c:\cygwin\bin\perl.bat reads:
> >
> > @echo off
> > c:\cygwin\bin\bash --login -c "/usr/bin/perl %1 %2
> %3 %4 %5 %6 %7 %8 %9"
> >
> > associating the .pl file with
> > c:\cygwin\bin\perl.bat %1
> >
> > and the perl file begins with:
> > #!/usr/bin/perl
> >
> > one command line, I ran:
> > c:\program files\apache
> group\apache2\cgi-bin\printenv.pl
> > and get the error:
> > Files\Apache: line 1: C:Program: command not found
> > OKAY, this looks like caused by the different b/t
> > winFS and POSIX....since Igor said he was
> successful
> > in this mode, can you point out what's the
> problem?
> >
> > case 2:
> > associating .pl file with
> > c:\cygwin\bin\bash -c %1
> > and the file begins with
> > #!/usr/bin/perl
> > I get the same error as case 1...
> >
> > case 3:
> > the only way I can now run the .pl file from
> command
> > line is:
> > c:\path with space\\cygwin\bin\bash -c printenv.pl
> >
> > but what I really want is:
> > to run .pl file like normal in windows command
> prompt:
> > i.e. c:\path with space\printenv.pl
> > WITHOUT using a native windows perl interpretor
> (like
> > ActivePerl)
> > if this is not possible, at least I should be able
> to
> > run it as a cgi-script...
> >
> > thanx for all your help so far igor...I am just a
> > little slow on this right now...
> >
> > --Matthew Ling F. Zhang
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > SBC Yahoo! DSL - Now only $29.95 per month!
> > http://sbc.yahoo.com
> >
> > --
> > Unsubscribe info:
> http://cygwin.com/ml/#unsubscribe-simple
> > Problem reports:
> http://cygwin.com/problems.html
> > Documentation: http://cygwin.com/docs.html
> > FAQ: http://cygwin.com/faq/
> >
>
> --
> http://cs.nyu.edu/~pechtcha/
> |\ _,,,---,,_ pechtcha@cs.nyu.edu
> ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.com
> |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski,
> Ph.D.
> '---''(_/--' `-'\_) fL a.k.a
> JaguaR-R-R-r-r-r-.-.-. Meow!
>
> "I have since come to realize that being between
> your mentor and his route
> to the bathroom is a major career booster." --
> Patrick Naughton
>
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/