www.delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
X-Injected-Via-Gmane: | http://gmane.org/ |
To: | cygwin AT cygwin DOT com |
From: | "BB" <canofspam AT att DOT net> |
Subject: | Re: cygpath bug? |
Date: | Fri, 13 Jun 2003 14:20:12 -0500 |
Lines: | 40 |
Message-ID: | <bcd80o$noq$1@main.gmane.org> |
References: | <bcan6d$67i$1 AT main DOT gmane DOT org> <bcct45$4ob$1 AT main DOT gmane DOT org> |
Reply-To: | "BB" <canofspam AT att DOT net> |
X-Complaints-To: | usenet AT main DOT gmane DOT org |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 6.00.2800.1158 |
x-mimeole: | Produced By Microsoft MimeOLE V6.00.2800.1165 |
"Shankar Unni" <shankar AT cotagesoft DOT com> wrote in message news:bcct45$4ob$1 AT main DOT gmane DOT org... > BB wrote: > > > Shouldn't GetShortPathName() == 0 always cause the get_short_name() > > function to fail? > > I would sincerely hope not. I see no reason why cygpath conversion has > to be tied to the existence of files. We often need to use cygpath to > convert between formats for files which we are about to create. I think it should fail if GetShortPathName() returns 0. A 0 return value means GetShortPathName() failed. If it returns a 0, it did not modify the destination buffer passed to it. cygpath allocates 1 byte and does a strcpy of the uninitialized buffer to that byte. If that's not a bug, I don't know what is. > e.g. > > notepad `cygpath -d "/cygdrive/c/some nonexistent file.txt"` > > will make notepad create that file for me. > Try your example, I don't think it will work. Maybe you meant to use the '-w' option. It will work. Your example does not work on my machine (XP). Using the cygpath -d option causes GetShortPathName() to be called. It returns 0 and sets the error to ERROR_PATH_NOT_FOUND. Using the -w option is a different story. It will simply replace the "/cygdrive/c/" with "c:\". I don't think it calls a windows api to do this. So in effect, the -d option causes a validation of the path and filename. It cannot be used to convert an invalid directory name to a short filename. -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |