From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32608 invoked by alias); 27 Jun 2012 11:59:33 -0000 Received: (qmail 32599 invoked by uid 22791); 27 Jun 2012 11:59:30 -0000 X-SWARE-Spam-Status: No, hits=1.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-wg0-f45.google.com (HELO mail-wg0-f45.google.com) (74.125.82.45) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 27 Jun 2012 11:59:16 +0000 Received: by wgbdt14 with SMTP id dt14so784927wgb.2 for ; Wed, 27 Jun 2012 04:59:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.220.89 with SMTP id n67mr1407452wep.73.1340798354654; Wed, 27 Jun 2012 04:59:14 -0700 (PDT) Received: by 10.227.97.36 with HTTP; Wed, 27 Jun 2012 04:59:14 -0700 (PDT) Date: Wed, 27 Jun 2012 11:59:00 -0000 Message-ID: Subject: cygwin_conv_path strange behavior From: Jan Nijtmans To: cygwin@cygwin.com Content-Type: text/plain; charset=ISO-8859-1 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: 2012-06/txt/msg00505.txt.bz2 Dear cygwin developers. When trying the function cygwin_conv_path, I noted some strange effect, when the cygwin1.dll is in the same directory as the executable. This can be demonstrated with the example "mypath.c" below. Compiling this function, and putting it in some directory "C:\some\path\foo', from a cygwin shell, it prints: $ ./mypath win32 path: C:\some\path\foo\mypath.exe posix path: /cygdrive/c/some/path/foo/mypath.exe >From a win32 command shell: > .\mypath win32 path: C:\some\path\foo\mypath.exe posix path: /cygdrive/c/some/path/foo/mypath.exe This is as expected. Now, copy cygwin1.dll to the same directory as mypath.exe, and do the same from a cygwin shell, it prints: $ ./mypath win32 path: C:\some\path\foo\mypath.exe posix path: /cygdrive/c/some/path/foo/mypath.exe >From a win32 command shell: > .\mypath win32 path: C:\some\path\foo\mypath.exe posix path: /foo/mypath.exe In other words, the first part of the posix path is stripped, when running it from a win32 shell! My objective is to distribute "mypath.exe" separate from cygwin, simply by putting cygwin1.dll (the only one it needs) in the same directory as the executable, so it can run without the presence of the cygwin environment. But this results in wrong paths produced by the cygwin_conv_path() function. Is this a bug in cygwin_conv_path()? What can I do about that? Regards, Jan Nijtmans =============== mypath.c ================= extern __stdcall int GetModuleFileNameA(void *, const char *, int); #define PATH_MAX 512 int main () { char buf[PATH_MAX]; char name[PATH_MAX]; GetModuleFileNameA(0, buf, PATH_MAX); cygwin_conv_path(2, buf, name, PATH_MAX); printf("win32 path: %s\nposix path: %s\n", buf, name); } -- 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