From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23859 invoked by alias); 10 Nov 2011 14:20:23 -0000 Received: (qmail 23850 invoked by uid 22791); 10 Nov 2011 14:20:22 -0000 X-SWARE-Spam-Status: No, hits=3.5 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_THEBAT X-Spam-Check-By: sourceware.org Received: from mr0.ht-systems.ru (HELO mr0.ht-systems.ru) (78.110.50.55) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 10 Nov 2011 14:20:07 +0000 Received: from [91.76.238.102] (helo=darkdragon.lan) by mr0.ht-systems.ru with esmtpa (Exim 4.62) (envelope-from ) id 1ROVU0-0002er-6i; Thu, 10 Nov 2011 18:20:00 +0400 Received: from [192.168.1.10] (HELO daemon2.darkdragon.lan) by daemon2 (Office Mail Server 0.8.12 build 08053101) with SMTP; Thu, 10 Nov 2011 14:14:31 -0000 Date: Thu, 10 Nov 2011 14:20:00 -0000 From: Andrey Repin Reply-To: Andrey Repin Message-ID: <992045008.20111110181431@mtu-net.ru> To: Timothy Madden , cygwin@cygwin.com Subject: Re: Pass windows-style paths to the interpreter from the shebang line ? In-Reply-To: References: <454021696.20111110052723@mtu-net.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2011-11/txt/msg00183.txt.bz2 Greetings, Timothy Madden! > As Linda said, I would like to be able to execute my new script from a > cygwin prompt and from a sh script, with a command like > parseLog.php /logfile/ Fine. > For this to work, I think I need the shebang line. For cygwin, seems so. > So I tried "#! php" > too, the problem is that bash will then invoke the following command to > process my script: > php /home/adrian/usr/local/bin/parseLog.php Yep. I haven't run into this issue myself, due to executing scripts from current directory at all times... *shrugs* > Now remember that "php" here is the native Windows port that can not > read that cygwin filename argument, begining with /home/adrian/... The problem is not limited to php invocation, but also imposing restrictions to the script usage. If invocation issue could be solved by something like $ cat /usr/bin/php #! /bin/sh /c/usr/php-win32/php.exe `cygpath --mixed $1` $* You'd have to deal with PHP arguments as well. Simple solution to the latter I could think about is to write a PHP library converting Cygwin paths into native windows paths, where you know you need them. Not where some supposedly sophisticated utility thinks you have them. > The solutions I could think of include: > - compose a script named php, somewhere on PATH, written is sh, > perl, python, even php, Naaah, you'd run into loop with PHP. :) > - get a cygwin port of php, that understands cygwin-style paths > given on the command line. Although Cygwin setup.exe did not > install such a port, I am happy to find here that there still > is a cygwin port of php available. There's pros and cons to use Cygwin ports when there's native version of the same application is available. > - have the cygwin port of bash detect if the > interpreter binary from any shebang line is a cygwin > application or a native application and compose the command > line accordingly. Corinna Vinschen on this list says this is > not as easy as it sounds, though Yep, it's not. Especially not if there's a custom loader in executable. P.S. Mixed paths would be safer to use inside Cygwin scripts. Just avoid using your script with network share through UNC... :/ -- WBR, Andrey Repin (anrdaemon@freemail.ru) 10.11.2011, <16:15> Sorry for my terrible english... -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple