delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/12/08/18:22:56

X-Spam-Check-By: sourceware.org
Date: Thu, 8 Dec 2005 15:22:59 -0800
From: Yitzchak Scott-Thoennes <sthoenna AT efn DOT org>
To: cygwin AT cygwin DOT com
Subject: Re: open() giving ENOENT when trying to create files with control chars
Message-ID: <20051208232259.GA1812@efn.org>
References: <120220052038 DOT 3878 DOT 4390B0AC000B476600000F2622007601800A050E040D0C079D0A AT comcast DOT net> <20051202220905 DOT GA2999 AT calimero DOT vinschen DOT de>
Mime-Version: 1.0
In-Reply-To: <20051202220905.GA2999@calimero.vinschen.de>
User-Agent: Mutt/1.4.2.1i
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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

On Fri, Dec 02, 2005 at 11:09:05PM +0100, Corinna Vinschen wrote:
> On Dec  2 20:38, Eric Blake wrote:
> > > I'm trying to create a file (on NTFS) with a CR in the name and getting
> > > ENOENT; is it possible for this to work (without a managed mount)?
> > 
> > Welcome to Windows.  None of these non-portable characters are
> > supported in filenames except in managed mounts.
> 
> Just to push the point a bit, note the words "non-portable".

Moving on to another "non-portable" problem, I want to create a file
with a space at the end of the name, but cygwin is stripping spaces.
Despite the comment in the code, this does seem to be allowed (though
I suspect it may be via NtCreateFile only, since windows commands
don't seem to handle filenames with spaces at the end well).  I tried
this:

--- path.cc.orig        2005-10-24 03:33:48.532065000 -0700
+++ path.cc     2005-12-08 11:39:23.237267200 -0800
@@ -482,7 +482,7 @@ path_conv::set_normalized_path (const ch
 
   if (strip_tail)
     {
-      while (*--p == '.' || *p == ' ')
+      while (*--p == '.') // || *p == ' ')
        continue;
       *++p = '\0';
     }
@@ -957,7 +957,7 @@ out:
          /* Windows ignores trailing dots and spaces */
          char *tail = NULL;
          for (char *p = path; *p; p++)
-           if (*p != '.' && *p != ' ')
+           if (*p != '.') // && *p != ' ')
              tail = NULL;
            else if (p[1] == '\\')
              {
__END__

and with limited testing on XP Pro SP1 didn't find any problems.  Is
it possible this space-stripping predates use of NtCreateFile?  Are
there problems likely to arise with this (e.g. cygwin calling other
winapi functions that are passed filenames not correctly handling
spaces at the end)?

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019