This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: open() giving ENOENT when trying to create files with control chars


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]