This is the mail archive of the cygwin-developers@cygwin.com 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: [stefan.schuerger: Path problems with trailing dot]


On Mon, May 16, 2005 at 12:58:01PM +0200, Corinna Vinschen wrote:
>On May 15 23:52, Christopher Faylor wrote:
>> As the above email illustrates, we are specifically treating a foo.\bar
>> as invalid in path_conv.  I don't remember the rationale for doing this.
>> It seems inconsistent to do this given the above example.
>> 
>> The patch below reverts this behavior on non-NT systems but it is
>> obviously not the right behavior for NT due to the fact that NtCreateFile
>> doesn't consider "foo." == "foo".  Do either of you remember why
>> we (i.e., I) did things this way?
>
>Not exactly.  My guess is that this approach was just simpler.  It would be
>more correct to ignore trailing dots and spaces in every path component.
>
>However, I think we should change the whole approach.  We shouldn't remove
>any trailing dots and spaces in path_conv::check.  Instead, we should change
>fhandler_base::open and path_conv::get_nt_native_path to do just the
>"right thing"(tm).  Instead of taking the half-hearted approach to convert
>the path to NT speak ourselves (curtesy myself), Cygwin should call
>RtlDosPathNameToNtPathName_U to do the job and don't suffer anymore.
>
>RtlDosPathNameToNtPathName_U also takes the DOS device names (aux:, prn:)
>into account automagically, so there's no need anymore to check for dos
>devices at the beginning of fhandler_base::open and redirect to open_9x.
>
>Preliminary patch see below.

I like the idea but I also sort of like the MS-DOS path to be "clean",
too.  I think there could be problems converting back and forth between
cygwin paths and ms-dos paths if we don't strip dots.  Stripping the dots
is fairly easy.

My duelling patch is below.

cgf

Index: path.cc
===================================================================
RCS file: /cvs/uberbaum/winsup/cygwin/path.cc,v
retrieving revision 1.374
diff -u -p -r1.374 path.cc
--- path.cc	13 May 2005 21:05:46 -0000	1.374
+++ path.cc	16 May 2005 14:03:47 -0000
@@ -911,8 +911,8 @@ out:
 	      tail = NULL;
 	    else if (p[1] == '\\')
 	      {
-		error = ENOENT;
-		return;
+		memmove (p, p + 1, strlen (p));
+		tail = NULL;
 	      }
 	    else if (!tail)
 	      tail = p;


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