delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/12/06/05:56:00

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AB6A13858408
Authentication-Results: sourceware.org;
dmarc=fail (p=none dis=none) header.from=nifty.ne.jp
Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=nifty.ne.jp
DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com 1B6AtPsE024034
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp;
s=dec2015msa; t=1638788126;
bh=EgTtsTr6+GrUqeSZfqUT3kLIIP3b5sg8qfbc5XW2+iY=;
h=Date:From:To:Subject:In-Reply-To:References:From;
b=Br2IMfQ1ILMQfut+ipE/1pwL13ZdgtrIjsWuICBrn1xmknItDguDcu3P9F8PNzVbG
IHvy8Q46Bh1kO9Gv31Jt6ufuuhw6etSb+RU33RUf+HKBgCjwJNoYthtFcmxBqivc2F
Q2fbi3o+UWbohNdkKMNvC32HWWN5OS9WSwYP7gcfPiViSxYpHmp7kFlcg/VZP1wV98
7QL0ffsMDZrP1G/0wUINWUwINpjoEReezzj517OU9hq9vn9mvAXnwCm2sMhnC3sk4N
qKvDR+PG5WtDm0Pl8uJHGgVLf5FVv11s0yRgiM0TwYMNT98VuCR2SLwY784fBTV3o6
NmgofEg69bjTg==
X-Nifty-SrcIP: [110.4.221.123]
Date: Mon, 6 Dec 2021 19:55:27 +0900
From: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
To: cygwin AT cygwin DOT com
Subject: Re: vboxsharedfs - Too many levels of symbolic links
Message-Id: <20211206195527.9b9c09b549fa8fcc2512949e@nifty.ne.jp>
In-Reply-To: <Ya3i/sfWB2avaJ9F@calimero.vinschen.de>
References: <d6470ffe-8e49-3eb7-4d21-3212e0ad4f31 AT oskog97 DOT com>
<20211205115411 DOT 1619911cb3e2d23f671912ce AT nifty DOT ne DOT jp>
<Ya3i/sfWB2avaJ9F AT calimero DOT vinschen DOT de>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A,
RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS,
TXREP autolearn=ham autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On Mon, 6 Dec 2021 11:16:30 +0100
Corinna Vinschen wrote:
> > For example, RtlEqualUnicodeString() compares \??\UNC\VBoxSrv\tmp and
> > \??\UNC\VBoxSrv\tmp\, then it fails.
> > [...]
> > +	      if (wcsstr (fpbuf, L"\\\\?\\UNC\\") == fpbuf)
> > +		goto file_not_symlink;
> > +
> 
> Isn't that a bit intrusive?  Wouldn't it also fix the issue if we
> just overwrite a trailing '\\' with '\0', like this?
> 
> diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
> index baf04ce89a08..b76e5b0466cf 100644
> --- a/winsup/cygwin/path.cc
> +++ b/winsup/cygwin/path.cc
> @@ -3492,8 +3492,14 @@ restart:
>  	    {
>  	      UNICODE_STRING fpath;
>  
> -	      RtlInitCountedUnicodeString (&fpath, fpbuf, ret * sizeof (WCHAR));
> +	      /* If incoming path has no trailing backslash, but final path
> +	         has one, drop trailing backslash from final path so the
> +		 below string comparison has a chance to succeed. */
> +	      if (upath.Buffer[(upath.Length - 1) / sizeof (WCHAR)] != L'\\'
> +		  && fpbuf[ret - 1] == L'\\')
> +		fpbuf[--ret] = L'\0';
>  	      fpbuf[1] = L'?';	/* \\?\ --> \??\ */
> +	      RtlInitCountedUnicodeString (&fpath, fpbuf, ret * sizeof (WCHAR));
>  	      if (!RtlEqualUnicodeString (&upath, &fpath, !!ci_flag))
>  	        {
>  		  issymlink = true;

First, I think the same. However, with this patch, it sometimes causes
hang for a few seconds around the code:
	      else if (isvirtual_dev (dev))
		{
		  /* FIXME: Calling build_fhandler here is not the right way to
			    handle this. */
		  fhandler_virtual *fh = (fhandler_virtual *)
					 build_fh_dev (dev, path_copy);
		  virtual_ftype_t file_type;
		  if (!fh)
		    file_type = virt_none;
		  else
		    {
		      file_type = fh->exists ();
		      if (file_type == virt_symlink
			  || file_type == virt_fdsymlink)
			{
			  fh->fill_filebuf ();
			  symlen = sym.set (fh->get_filebuf ());
			}

with path_copy of "//VBoxSrv". I am not sure why.

In addition,
https://cygwin.com/pipermail/cygwin/2021-December/250103.html
still needs fix.

So I proposed the patch which stops to treat UNC path as symlink.

-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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