Odd, is it not? mkdir 'e:\' cannot be undone by rmdir 'e:\' ...
Houder
houder@xs4all.nl
Wed Aug 28 22:57:00 GMT 2019
On Wed, 28 Aug 2019 08:33:05, Eric Blake wrote:
> On 8/27/19 7:51 AM, Houder wrote:
>
>
> > 64-@@ mkdir 'e:\' # creates subdirectory e: !!!!!
>
> Had you typed:
>
> mkdir 'e:/'
>
> I would expect subdirectory ./e: to be created. But with 'e:\', that
> is a DOS style path, so I would lean towards requiring './e:\' if you
> want to create a literal directory named 'e:\', but without the leading
> ./ to merely treat 'e:\' as the drive letter and failing with EEXIST
> because /cygdrive/e already exists.
>
> So it sounds like mkdir() could be further improved when something ends
> in \ rather than in /. (The behavior when ending in / should not be
> changed, though).
>
> > 64-@@ rmdir 'e:\' # fails, because it refers to /drv/e
> > rmdir: failed to remove 'e:\': Directory not empty
>
> That matches what I would expect - because you did not pass a leading
> './', but used a backslash, you used a DOS style path and should be
> attempting to act on /cygdrive/e.
>
>
> > 64-@@ rmdir 'e:'
>
> This, however, is not a DOS path, so it should prefer to act on './e:'
> if that exists (and only if it does not exist, then we might consider
> ALSO seeing if /cygdrive/e exists before giving up completely).
>
>
> > Yes, I should NOT use "DOS paths" ...
>
> > https://cygwin.com/cygwin-ug-net/using.html#pathnames-win32
>
> > However, I wonder why e:\ is interpreted by mkdir as e:, and as
> > /drv/e (that is as e:\) by rmdir.
>
> mkdir 'e:/' is supposed to be identical to mkdir 'e:'. The problem is
> that because we interchange \ with / in a number of places, we have
> accidentally ended up with mkdir 'e:\' behaving like mkdir 'e:/' instead
> of acting on the DOS path.
# note: cygdrive has been remapped to /drv at my place
Good gracious! (btw, thank you for the explanation)
- 'e:\' is a DOS path
- e:/ is not a DOS path (removing the trailing /, yields e:)
However, ls -ld e:/ refers to /drv/e
(e:/ is interpreted as 'e:\' by ls!)
So do rmdir, stat, touch ... (and many other commands)
They are all wrong ... Correct?
How about e:/foo ????? A DOS path? Does it refer to /drv/e/foo?
According to
https://cygwin.com/cygwin-ug-net/using.html#pathnames-win32
it is a DOS path (and NOT foo in subdirectory e:)
Said differently, e: is a subdirectory, and e:/ is the same thing,
because a trailing forward slash is ignored (like Linux does).
Correct?
Henri
--
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
More information about the Cygwin
mailing list