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 8/28/19 7:59 AM, Corinna Vinschen wrote:

>>>>> mkdir(2) has some special code from 2009 which drops trailing
>>>>> {back}slashes to perform a bordercase in mkdir Linux-compatible.
>>>>> This code snippet doesn't exist in rmdir(2).

Dropping trailing slashes to be Linux-compatible is okay.  Dropping
trailing backslashes is risky, though, if it makes us forget that the
user was asking for a DOS path (even though DOS paths are not always
going to work as expected).


> 
> Eric, any insight?  As usual our comments from way back when are lacking
> in terms of what exact problem this code is trying to fix/workaround.

If I recall, we had cases where 'mkdir a/' and 'mkdir a' did not behave
identically, even though POSIX says they should; compounded by the fact
that Windows treats trailing slash differently when performing native
mkdir on a drive than it does on a subdirectory of a drive.

It may be as simple as changing the isdirsep() from the identified
commit to instead check only for '/' (and ignore '\').

> 
> Given this case, I wonder if we really need this code or if we can't
> just drop it.  Of course, it would be great to learn what bordercase
> this code was trying to handle and if there isn't another way to do that.
> 
> 
> Corinna
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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