delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/08/28/10:23:26

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:cc:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=dXR2BXc1Li4RfBbqyFAyTjCNvxbBNt6GwmfkfdA0XAWZQXfsC6Vz1
ossQigF+ikgmPspk+NuiGcyLauNFvK/jn6Jf40HoSugGhNE2oUY8pPIstD1e1Vzv
PuvjFwYZN2yuG0rj+p1thGud75VYfajL1AjIelc0AEJ3a2N3zhr1F4=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:cc:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=kD+Kp96hXUzrVHRG+IsSZ4IO3G8=; b=lcf4h8xLh/moTUNd6+ZmMn2eImSZ
hnxhCfqZsKUxiHKjSuwiQSNkKSXlilixkQ1JZkZgmv87yJ1uVWQ3J8drSwBOblgj
DKly5JigCMioSgc/QHVpPbhWjM4dSMPgF5SIgKWJrQF5ildA3qOZi/qCXjtM0wgu
7w7SMsI+C73/EOw=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-115.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,GOOD_FROM_CORINNA_CYGWIN,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=
X-HELO: mout.kundenserver.de
Date: Wed, 28 Aug 2019 16:22:20 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: Eric Blake <eblake AT redhat DOT com>
Cc: cygwin AT cygwin DOT com
Subject: Re: Odd, is it not? mkdir 'e:\' cannot be undone by rmdir 'e:\' ...
Message-ID: <20190828142220.GN11632@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: Eric Blake <eblake AT redhat DOT com>, cygwin AT cygwin DOT com
References: <bc3df101ab93c20b86c3ab7fa7d3ea4f AT xs4all DOT nl> <20190827152549 DOT GY11632 AT calimero DOT vinschen DOT de> <a47cc167b725c08e6f1c914166fabcaf AT smtp-cloud8 DOT xs4all DOT net> <3E262D05-F393-453A-9E43-B248DDE50812 AT solidrocksystems DOT com> <b97e4dbe952154efc68412540514ae81 AT smtp-cloud8 DOT xs4all DOT net> <20190828125939 DOT GL11632 AT calimero DOT vinschen DOT de> <421ac447-b249-da21-1ca5-228041cfc884 AT redhat DOT com> <20190828141556 DOT GM11632 AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <20190828141556.GM11632@calimero.vinschen.de>
User-Agent: Mutt/1.11.3 (2019-02-01)

--yg7TPtisfxkNZi9r
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Aug 28 16:15, Corinna Vinschen wrote:
> On Aug 28 08:36, Eric Blake wrote:
> > On 8/28/19 7:59 AM, Corinna Vinschen wrote:
> >=20
> > >>>>> 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).
> >=20
> > 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).
> >=20
> >=20
> > >=20
> > > Eric, any insight?  As usual our comments from way back when are lack=
ing
> > > in terms of what exact problem this code is trying to fix/workaround.
> >=20
> > 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.
> >=20
> > It may be as simple as changing the isdirsep() from the identified
> > commit to instead check only for '/' (and ignore '\').
>=20
> As simple as that?
>=20
> diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc
> index b757851d5c7f..747b1582af50 100644
> --- a/winsup/cygwin/dir.cc
> +++ b/winsup/cygwin/dir.cc
> @@ -314,13 +314,13 @@ mkdir (const char *dir, mode_t mode)
>  	  set_errno (ENOENT);
>  	  __leave;
>  	}
> -      if (isdirsep (dir[strlen (dir) - 1]))
> +      if (dir[strlen (dir) - 1] =3D=3D '/')
>  	{
>  	  /* This converts // to /, but since both give EEXIST, we're okay.  */
>  	  char *buf;
>  	  char *p =3D stpcpy (buf =3D tp.c_get (), dir) - 1;
>  	  dir =3D buf;
> -	  while (p > dir && isdirsep (*p))
> +	  while (p > dir && *p =3D=3D '/')
>  	    *p-- =3D '\0';
>  	}
>        if (!(fh =3D build_fh_name (dir, PC_SYM_NOFOLLOW)))

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.


Corinna

--=20
Corinna Vinschen
Cygwin Maintainer

--yg7TPtisfxkNZi9r
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl1mjhwACgkQ9TYGna5E
T6BlBhAAhDCBBnEb5WwjgW340PBQICEpT9zN4ZxeIkbjxXz4n8gfkEMHCyMp8+iq
IZ6eNYNCjx4F39kAbdeeEK3uSSZB6msPidWcZGd7ZdilaOtGCbpYSB+kcxSYJcGc
rKg1sgUyaNhaeKTVTeZaVYgZ4/xVLj8O2+MDr1ZVPR+sxPUK/bAlVr1+T2EnDdom
LmAhmWCKTWBSeGijp1ryUT8kOB0oG3/81TQnJrEGBYnbi090tAy+u+lnjTr4llYT
yOnzqFrCdrxrMVIRKy4vbgAMZxEbTTF0fuRpUVrbxmzAIKI+huN74I7BEUvRBdA0
PHHa36uYa9ndnHEW8cyyfSEDqafdpSRuvy6/a3ojMkbFvwmm0ivp2MJBpj61RRn2
qUnDI1cY9dbZJHG0zhsgTVPEcPg5r8VTpO4UPkCl9Po3ZgcR1szvzjFsdofneTBq
CuKhlaWftwyGzxE3bVpIEgU/Yo3wpXaBKd+9ZKhh1/aHUSswtTHsVcYDrLVDfedB
0zLfiOVVtqgcIkGAdkmsGRwU+anyLGud9ghG4NdvldO5u+kmlYPhk1lREq7mOjwQ
LIyxJYX64cWYQr0PwoaHK5SEtH4rYjfTNKZjiejF8JBVdY4+JpJcv8Tog+Hva9nr
Cn2ncAx6O+liHlV5Pj08KmoV3DEcKIFhINaNpryA96pzBpJHZC4=
=7cA5
-----END PGP SIGNATURE-----

--yg7TPtisfxkNZi9r--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019