X-Spam-Check-By: sourceware.org Date: Tue, 12 Dec 2006 15:02:55 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: cygstart getting The specified file was not found Message-ID: <20061212140255.GB9829@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <457E0CB8 DOT 5070002 AT mscha DOT nl> <20061212082036 DOT GY9829 AT calimero DOT vinschen DOT de> <457EAD4F DOT 1000605 AT mscha DOT nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <457EAD4F.1000605@mscha.nl> User-Agent: Mutt/1.4.2.2i Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 On Dec 12 14:23, Michael Schaap wrote: > Corinna Vinschen wrote: > >Does cygstart use CreateProcess and/or GetCurrentDirectory instead of > >fork/exec/getcwd? > > > >If so, cygstart will have to call cygwin_internal(CW_SYNC_WINENV) before > >using the native Windows functions. > > No, it uses ShellExecute (see "cygstart --reference"). It does indeed > need to sync the environment, but it does this using its own code. > (Predates cygwin_internal(CW_SYNC_WINENV); I still need to change > cygstart some day to use it.) ShellExecute is the same problem. With 1.7.0 you must use cygwin_internal(CW_SYNC_WINENV), when calling native Windows functions which have even vaguely to do with the current directory. > However, this is unrelated to this problem, things go wrong long before > that. It appears that cygwin_conv_to_win32_path incorrectly determines > the current working directory. > > It is called as follows: > > cygwin_conv_to_win32_path(aPath, winPath); > > where aPath == "hello.txt". > > The current directory is "/cygdrive/c/user" =~ "c:\user", but > cygwin_conv_to_win32_path thinks that: > > normalize_posix_path: /cygdrive/c/WINDOWS/system32/hello.txt = > normalize_posix_path (hello.txt) Hang on. cygwin_conv_to_win32_path does not translate the path into an absolute path, cygwin_conv_to_full_win32_path does that. I'm running the following simple testcase(tm): #include #include int main (int argc, char **argv) { char buf[260]; cygwin_conv_to_win32_path (argv[1], buf); puts (buf); cygwin_conv_to_full_win32_path (argv[1], buf); puts (buf); GetCurrentDirectory (260, buf); puts (buf); cygwin_internal (CW_SYNC_WINENV); GetCurrentDirectory (260, buf); puts (buf); return 0; } $ pwd /home/corinna/tests $ ./cyg_conv_to_w32 hello.txt hello.txt C:\home\corinna\tests\hello.txt C:\WINDOWS\system32 C:\home\corinna\tests This shows you what happens. This is not a bug, but deliberately chosen. Use cygwin_internal(CW_SYNC_WINENV), please. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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/