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: Odd, is it not? mkdir 'e:\' cannot be undone by rmdir 'e:\' ...


On Thu, 29 Aug 2019 17:05:41, Houder  wrote:
> On Wed, 28 Aug 2019 16:22:20, Corinna Vinschen  wrote:
[snip]

> > One problem here is, what to do about border cases like
> > 
> >   $ mkdir a\/\/\/
> > 
> > In theory slashes and backslashes should both be treated as dir
> > separators.  Handling a case like this so that all expectations
> > are satisfied is next to impossible, I guess.
> 
> How about dropping Eric's code snippet in winsup/cygwin/dir.cc ?????
> 
> Subdirectory 'a' is created. No problem there. Perhaps the patch has
> become superfluous/ redundant over time?
> 
> I have tried different "values" for the path-argument to mkdir, and
> have not found a problem while the code snippet is being skipped.
> 
> What am I missing?

A trailing forward slash in "pathname" is stripped in path_conv::check,

(look for: *--tail = '\0' )

after "pathname" has been normalized in

normalized_posix_path or normalized_win32_path (or both),

before it is fed into conv_to_win32_path.

Tests have shown that Eric's code snippet can be deleted w/o harm.

Counter arguments?

Henri

> -----
> Breakpoint 1 at 0x1800548b9: file /usr/src/debug/cygwin-3.1.0-0.2/winsup/cygwin/dir.cc, line 317.
> Breakpoint 2 at 0x1800548e3: file /usr/src/debug/cygwin-3.1.0-0.2/winsup/cygwin/dir.cc, line 326.
> (gdb) r
> Starting program: /usr/bin/mkdir 'a\/\/\/'
> [New Thread 1064.0x1a8c]
> [New Thread 1064.0x59c]
> 
> Thread 1 "mkdir" hit Breakpoint 1, mkdir (dir=0x800041320 "a\\/\\/\\/", mode=511)
>     at /usr/src/debug/cygwin-3.1.0-0.2/winsup/cygwin/dir.cc:317
> 317           if (isdirsep (dir[strlen (dir) - 1]))
> (gdb) j dir.cc:326
> Continuing at 0x1800548e3.
> 
> Thread 1 "mkdir" hit Breakpoint 2, mkdir (dir=0x800041320 "a\\/\\/\\/", mode=511)
>     at /usr/src/debug/cygwin-3.1.0-0.2/winsup/cygwin/dir.cc:326
> 326           if (!(fh = build_fh_name (dir, PC_SYM_NOFOLLOW)))
> (gdb) c
> Continuing.
> [Inferior 1 (process 1064) exited normally]
> (gdb) quit
> 
> 64-@@ ls -ld a*
> drwxr-xr-x+ 1 Henri None 0 Aug 29 16:47 a
> 
> =====


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


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