delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2022/05/27/09:17:38

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 BE2DA395B45E
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-02.nifty.com 24RApMCV014048
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp;
s=dec2015msa; t=1653648682;
bh=kd0cI1GrTWFE9D76KF5JRNA2bdkmOPDK3U7D3yODYXg=;
h=Date:From:To:Subject:In-Reply-To:References:From;
b=WGZwGR8YcCpwLwnh+9gzfIOr2ZS6f6QMoyQFxlPhcFOv8dspYTDu/fkXrZtM/PshX
us4dRuyzigO9poxL6U/yLjgFk4ux6krBd4oTtLPzDYB/onLFZ8QvGsgvMsil9ArENQ
Mkh5TyQs6VJiBvAaNFj5pHuUB759xXx28BdD6h9kxmvg744y/NnP+4TnbZkS9lSbYn
FH0ASzWlIx2lwakEf2XD2k/v87l/coKFrCIGUCSJMFIYjViBY4UL7OUpFiB+lBTsaJ
0ImI1S4ECdJVupW7bdHX/qKi5z2ayOfQOo+yHSu7oJpaghl6dfuooWvwl6HzFgKPtE
Q8xmSNWL2aMgQ==
X-Nifty-SrcIP: [119.150.44.95]
Date: Fri, 27 May 2022 19:51:23 +0900
From: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
To: cygwin AT cygwin DOT com
Subject: Re: Unable to execute Cygwin application within UDF format
Message-Id: <20220527195123.abd2d66a17e28b51f1a745a3@nifty.ne.jp>
In-Reply-To: <20220527181849.6baaa5d9e8446f3e7d23cbee@nifty.ne.jp>
References: <CANe7G9EE5Q9kd7FM=+ERhhB2zBxyNo1Tx7Rbuy=X4svaG2m0fw AT mail DOT gmail DOT com>
<20220527133120 DOT 58530edd99f4a87c605b8a04 AT nifty DOT ne DOT jp>
<CANe7G9EZbuKOJt_X2mq1X70Y=tWFiy5_w9fnKp59EgCGQjAUAw AT mail DOT gmail DOT com>
<20220527181849 DOT 6baaa5d9e8446f3e7d23cbee AT nifty DOT ne DOT jp>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
X-Spam-Status: No, score=-11.7 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, SPF_HELO_NONE, SPF_PASS, TXREP,
T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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 Fri, 27 May 2022 18:18:49 +0900
Takashi Yano wrote:
> On Fri, 27 May 2022 16:47:09 +0800
> Sam Lin wrote:
> > I have also successfully executed that is to move cygwin1.dll to the root
> > directory to execute.
> > 
> > Will cygwin1.dll be supported to execute in UDF format in the future?
> 
> As I wrote earlier, it doesn't matter that the file system
> is UDF. cygwin1.dll 3.2.0 and later seems to cause problems
> if it is placed in the root directory.
> 
> Even with UDF format, the problem does not occur if hello.exe
> and cygwin1.dll are placed in any directory other than root
> directory.

I looked into this problem and found the problem occurs after
the commit:

commit 6d898f43fc87a7bf3ab100d75538e381bd86f657
Author: Corinna Vinschen <corinna AT vinschen DOT de>
Date:   Fri Feb 19 18:15:58 2021 +0100

    Cygwin: realpath: fix cygwin installation dir being access via junction
    
    Consider this case:
    
    - Cygwin installed in C:\cygwin64
    
    - mklink /j D:\cygwin64 C:\cygwin64
    
    - create testcase calling
    
        realpath("/", result);
        printf ("%s\n", result);
    
    - start cmd
    
        >C:\cygwin64\bin\bash -lc <path-to-testcase>
        /
        >D\cygwin64\bin\bash -lc <path-to-testcase>
        /cygdrive/c/cygwin64
    
    This scenario circumventing the mount point handling which is automated
    in terms of /, depending on the path returned from GetModuleFileNameW
    for the Cygwin DLL.  When calling D:\cygwin64\bin\bash the dir returned
    from GetModuleFileNameW is D:\cygwin64\bin, thus root is D:\cygwin64.
    
    However, junctions are treated as symlinks in Cygwin which explains why
    the path gets converted to a cygdrive path.
    
    Fix this by calling GetFinalPathNameByHandleW on the result from
    GetModuleFileNameW to get the correct root path, even if accessed via
    a junction point.
    
    Signed-off-by: Corinna Vinschen <corinna AT vinschen DOT de>

And also found the following patch fixes the issue.

diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index 01b49468e..c4031b919 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -183,6 +183,8 @@ init_cygheap::init_installation_root ()
 	  if (p)
 	    p = wcschr (p + 1, L'\\');  /* Skip share name */
 	}
+      else
+	p = installation_root_buf + 4; /* 4 is the length of "\\\\?\\" */
     }
   installation_root_buf[1] = L'?';
   RtlInitEmptyUnicodeString (&installation_key, installation_key_buf,

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