X-Spam-Check-By: sourceware.org Message-ID: <43DE9658.FBF4BF05@dessent.net> Date: Mon, 30 Jan 2006 14:42:32 -0800 From: Brian Dessent MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: MSYS path behavior in Cygwin References: <01a101c625bb$56eef210$a501a8c0 AT CAM DOT ARTIMI DOT COM> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com tom wrote: > I guess the two will be mutually exclusive, unless you Cygwin devs see some > reason to merge some of Earnie's work. I'm have to believe there's some reason > why it hasn't been done though. I'm sure it's non-trivial to say the least. > > Thanks for the help anyways! Cygwin and msys make life in Win32land bearable. To do that would go against the grain of what Cygwin is trying to accomplish: provide a full posix environment. So to have argument-translation code sort of defeats that purpose since all Cygwin programs are supposed to recognise posix paths. Now in reality, everyone has to run a non-Cygwin program from time to time, so of course there will be times where you run up against this. But the question becomes, when should the library translate paths, and when should it leave them alone? Because you can't just unconditionally do it. The way MSYS handles this is by assuming that everything in the MSYS bin directory is a MSYS binary that can handle posix paths, and that everything else is a win32/mingw app that needs win32 paths. Now that's a rather stark and arbitrary distinction. It works for MSYS since it's intended to be a rather minimal system, just enough to build packages using auto{conf,make},libtool. But I think for Cygwin this would be way too restrictive. The workaround that I think most people use is a wrapper script that essentially just runs "cygpath -w" on each argument and then execs $1. So you can type "wrapper win32program /posix/path/to/file" and it ends up running "win32program c:/win32/path/to/file". If you do it right, you can make this quite generic, so that you just prepend "wrapper" (or whatever you want to call it.) Below is one that I use in my .bashrc that calls perl. It's probably got bugs, and it's not perfect -- for example if you pass something like -I/usr/local/bin it will not know how to translate that. But it gets the job done for most win32 programs, so that you can type "dodos notepad /tmp/foobar" for example. It should work with filenames/paths with spaces in them. dodos () { perl - "$@" <<'_EOF_' my @args = shift (@ARGV); foreach (@ARGV) { chomp(my $arg = `cygpath -w "$_" 2>/dev/null`); $arg = $_ if (length($arg) == 0); push @args, $arg; } exec @args; _EOF_ } Brian -- 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/