delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2022/02/20/18:42:40

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 9DCA93858403
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-03.nifty.com 21KNfigM030465
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp;
s=dec2015msa; t=1645400504;
bh=8dm3Ps8/UN3ergAYl54oWIGUGVfmPKV3k51orK2xNsc=;
h=Date:From:To:Subject:In-Reply-To:References:From;
b=EtCbw8a4/9N1hgYbvfUetMDMLvemRm62xitisCd8By3qbQnkRbpWwnqofY07gNKYQ
kHUwL1xQpr2LY0hYxfg7pjGY+3fUpyEGlozku67eTMUEj1mi3aC7BXf7NWA96Lyfs4
ZwQYBT4vNW8hmXBhmvkuvNCe8jI/1+7lx5KtJvZf6fcvjauDSL+6BwK6j7XGIg5d8+
tSHDcd0VZKkxHfOY6EFB91XXVXSdTSbQstUJS9kLOfrOTkF6L3fr9MjO/Bi4YOyiuE
nmYgClRRgC76WdQacyRMbPjtJl/y4aCmEWZee/XvgtYpcvvBJQPsxxsa2p/9kA4VT1
zeFWSNQ7CRVAg==
X-Nifty-SrcIP: [119.150.36.16]
Date: Mon, 21 Feb 2022 08:41:52 +0900
From: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
To: cygwin AT cygwin DOT com
Subject: Re: bash from local mounted drive with subst command
Message-Id: <20220221084152.d4ffc040ec085f001f1fad0d@nifty.ne.jp>
In-Reply-To: <CACR4mKVj1SAO04iFOukMKEkD0YNUUD=x3Gh4Ypz8TQaPYx=6TA@mail.gmail.com>
References: <CACR4mKVj1SAO04iFOukMKEkD0YNUUD=x3Gh4Ypz8TQaPYx=6TA AT mail DOT gmail DOT com>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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.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 Sun, 20 Feb 2022 22:38:53 +0100
Claude TETE wrote:
> A bash in a local mounted drive, use realpath instead of mounted one
> for all child processes.
> 
> Example, mount a local folder on Z: drive, go in there and run any
> external command:
> $ subst Z: C:\\Users
> $ cd /cygdrive/z/
> $ /bin/pwd
> /cygdrive/c/Users
> 
> Expected
> /cygdrive/w

This is since:

commit 19d59ce75d5301ae167b421111d77615eb307aa7
Author: Corinna Vinschen <corinna AT vinschen DOT de>
Date:   Fri May 7 16:07:03 2021 +0200

    Cygwin: path_conv: Rework handling native symlinks as inner path components

    commit 456c3a46386f was only going half-way.  It handled symlinks and
    junction points as inner path components and made realpath return the
    correct path, but it ignored drive letter substitution, i. e., virtual
    drives created with, e. g.

      subst X: C:\foo\bar

    It was also too simple.  Just returning an error code from
    symlink_info::check puts an unnecessary onus on the symlink evaluation
    loop in path_conv::check.

    Rework the code to use GetFinalPathNameByHandle, and only do this after
    checking the current file for being a symlink failed.

    If the final path returned by GetFinalPathNameByHandle is not the same
    as the incoming path, replace the incoming path with the POSIXified
    final path.  This also short-circuits path evaluation, because
    path_conv::check doesn't have to recurse over the inner path components
    multiple times if all symlinks are of a native type, while still getting
    the final path as end result.

    Virtual drives are now handled like symlinks.  This is a necessary change
    from before to make sure virtual drives are handled identically across
    different access methods.  An example is realpath(1) from coreutils.  It
    doesn't call readlink(2), but iterates over all path components using
    lstat/readlink calls.  Both methods should result in the same real path.

    Fixes: 456c3a46386f ("path_conv: Try to handle native symlinks more sanely")
    Signed-off-by: Corinna Vinschen <corinna AT vinschen DOT de>


The behaviour is by design. Does this cause any practical issue?

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