delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/11/17/09:57:38

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29333385DC04
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1700233057;
bh=dCShJSeS8k76w77xtX0ilC711JwRt6fB9k0+yfIC/fM=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=v5+c1usQWezH0Yry5f2cvriuy1H+Nb/e7XW5AGohD2llMG5Iu+B/3yW5YGbRD9v87
UO7GyF9NqA6VBySEwHdE8JhhfoXmA5IlU2FHR5rxjVsLMlz22N2K/CbYnW/GsCGDio
M3IdLTmWPNthVoVSl7h5YTEzJjVOPGE0WGV/ULiY=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 235063858D20
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 235063858D20
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700233018; cv=none;
b=YjH0OoRim7ovaFE36Gy8MzcYXmwvfH10pIXDBbXyiHFkfqvZnmkh1IdqCJboYnHB0Nv3Vy4NRi6EwSJO4UDMNBZmr80fXkRCAPLKu93QQSRM9uMbs9NfBWi7t6j4T98/Nmml62/5bQJln/+rlvxcAFB6N+acE+4UNbj97HOwKFY=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1700233018; c=relaxed/simple;
bh=a78VEes0gwZ6XZZ4ZcgsUkdikVIVUpQycb5ABQAd4nw=;
h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From;
b=SwiMD1FDr4WqH4RsVLw9VcZMms0rO6uoG7ZifZ/171gLCj3YlwKD9jSFtKfbK8Ur0W4KIxHJz85KUv6+puyFur4VgOrzhJeruurpJLSYSO4KehnwtV6F+vSKjjhJxYiqIYTeEFLHqB5HJfp52eh/1bsnh0jrHZhugUQswDddzf0=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Authority-Analysis: v=2.4 cv=Cousz10D c=1 sm=1 tr=0 ts=65577f36
a=DxHlV3/gbUaP7LOF0QAmaA==:117 a=DxHlV3/gbUaP7LOF0QAmaA==:17
a=IkcTkHD0fZMA:10 a=FfVa6YyVAAAA:8 a=NEAV23lmAAAA:8 a=w_pzkKWiAAAA:8
a=ioSjotguIdqZv6BickgA:9 a=QEXdDO2ut3YA:10 a=YA-VbQCo1SUA:10
a=pwUoXiQdmvIA:10 a=Lz48L_9qCwoA:10 a=UiCPdkfYahhcG6y9nT3T:22
a=sRI3_1zDfAgwuvI8zelB:22
Message-ID: <fa1a4430-5da1-4f2b-8b6e-873a8c036d40@Shaw.ca>
Date: Fri, 17 Nov 2023 07:56:53 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: Cygwin tool to differ junctions from soft links?
To: cygwin AT cygwin DOT com
References: <CANH4o6M5C7=8eTWj2Jf8gsHDR0Fb_aFzDFWzsR1+3uzLdZ_6dg AT mail DOT gmail DOT com>
<48998319 DOT 20231116114707 AT yandex DOT ru>
<1439487749 DOT 2493319 DOT 1700160923985 AT mail DOT yahoo DOT com>
<6752f3b0-0fbf-4709-976c-12030285e0bb AT Shaw DOT ca>
<39d6c013-f929-49c1-948a-810383959a1b AT towo DOT net>
Organization: Inglis
In-Reply-To: <39d6c013-f929-49c1-948a-810383959a1b@towo.net>
X-CMAE-Envelope: MS4xfC2Cu0btJLYqfSf+5SmIc7owSP6RU8rtQnb3aBouJO8ICgbpZlj1QO33qCYLp4Xgk4/PYRFX+4zLyza6Zh51MWa+fHhyYY1KqDwOaEDiMMZ0GGF5pGEm
iUgg02DFP4ThXZ3guFKJv+M6S9H4UTpeJs2RAqmkvV6jhgXM3SujCrh7K1HU+O3hxsFF/+OGUesSew==
X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, BODY_8BITS,
DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW,
RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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.30
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>
From: Brian Inglis via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Brian Inglis <Brian DOT Inglis AT Shaw DOT ca>
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>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 3AHEvb2K016541

On 2023-11-16 22:54, Thomas Wolff via Cygwin wrote:
> Am 16.11.2023 um 21:30 schrieb Brian Inglis via Cygwin:
>> On 2023-11-16 11:55, matthew patton via Cygwin wrote:
>>> On Thursday, November 16, 2023 at 03:50:24 AM EST, Andrey Repin wrote:
>>>>> Does Cygwin have a command line tool (Scriptable!) which can be used to
>>>>> differ between soft links and Windows junctions?
>> Distinguishing between types of Windows reparse points is not a POSIX or 
>> emulation function, so not of interest to Cygwin developers.
>> I thought about it when support was added, but then realized there was no nice 
>> place to add it within the platform, without going the non-portable Windows 
>> specific utility route, as in lsattr.
>> You could in a function or script by running lsattr -d which seems to fail on 
>> reparse points, then ls -dl which shows a Symbolic Link with a relative path, 
>> and a Junction with an absolute path, although it could just be a Symbolic 
>> Link with an absolute path.

> lsattr has an explicit flag:
>               'r', 'Reparse':       file or directory that has a reparse point
> I don't know whether it's the same as a junction, otherwise a 'j' flag could be 
> added.

Notice that the flag is the same as 'r' "Readonly" and lsattr does not work on 
Windows Reparse Points which are Junctions, Directory or File Symbolic Links 
[sanitized]:
$ cd ~
$ cmd /c dir /a:l | grep '>'
2021-04-13  10:41    <JUNCTION>     Application Data [$HOME/AppData/Roaming]
2021-06-21  21:07    <JUNCTION>     Bookshelf [...]
2021-04-13  10:41    <JUNCTION>     Cookies 
[$HOME/AppData/Local/Microsoft/Windows/INetCookies]
2021-09-15  10:23    <JUNCTION>     cygwin-64t [...]
2021-04-13  10:41    <JUNCTION>     Local Settings [$HOME/AppData/Local]
2020-04-21  03:33    <SYMLINKD>     Mail [AppData/Roaming/...]
2021-04-13  10:41    <JUNCTION>     My Documents [$HOME/Documents]
2021-04-13  10:41    <JUNCTION>     NetHood 
[$HOME/AppData/Roaming/Microsoft/Windows/Network Shortcuts]
2023-05-27  07:30    <JUNCTION>     ntp-dev [...]
2023-05-27  07:30    <JUNCTION>     ntp-stable [...]
2021-04-13  10:41    <JUNCTION>     PrintHood 
[$HOME/AppData/Roaming/Microsoft/Windows/Printer Shortcuts]
2021-04-13  10:41    <JUNCTION>     Recent 
[$HOME/AppData/Roaming/Microsoft/Windows/Recent]
2021-04-13  10:41    <JUNCTION>     SendTo 
[$HOME/AppData/Roaming/Microsoft/Windows/SendTo]
2021-04-13  10:41    <JUNCTION>     Start Menu 
[$HOME/AppData/Roaming/Microsoft/Windows/Start Menu]
2021-02-10  21:19    <JUNCTION>     Tech [...]
2021-04-13  10:41    <JUNCTION>     Templates 
[$HOME/AppData/Roaming/Microsoft/Windows/Templates]
2022-05-27  19:15    <JUNCTION>     weather [...]
2020-06-20  01:19    <SYMLINK>      _gvimrc [.vim/gvimrc]
2020-06-20  01:06    <SYMLINKD>     _vim [.vim]
2020-06-20  00:51    <SYMLINK>      _viminfo [.vim/viminfo]
2020-06-20  00:51    <SYMLINK>      _vimrc [.vim/vimrc]
$ cmd /c dir /a:l /b "$HOMEPATH" | d2u | xargs -I@ lsattr -d '@'
lsattr: Not supported on Application Data
lsattr: Not supported on Bookshelf
lsattr: Not supported on Cookies
lsattr: Not supported on cygwin-64t
lsattr: Not supported on Local Settings
lsattr: Not supported on Mail
lsattr: Not supported on My Documents
lsattr: Not supported on NetHood
lsattr: Not supported on ntp-dev
lsattr: Not supported on ntp-stable
lsattr: Not supported on PrintHood
lsattr: Not supported on Recent
lsattr: Not supported on SendTo
lsattr: Not supported on Start Menu
lsattr: Not supported on Tech
lsattr: Not supported on Templates
lsattr: Not supported on weather
lsattr: Not supported on _gvimrc
lsattr: Not supported on _vim
lsattr: Not supported on _viminfo
lsattr: Not supported on _vimrc

>> Perhaps something like the following would be useful to Windows users who want 
>> to know this stuff:
>>     https://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html
>>>> It would be easier to help you, if you specify the purpose of your
>>>> request. I.e. what you want to achieve with such tool.
>>> AFAIK no. what I do is re-implement 'ln' with a wrapper because the Cygwin
>>> behavior (Junctions) was driving me up the wall.
>>> https://github.com/tb3088/shell-environment/blob/ccf7aa161899c2c4ebe2d9e980e674bc726a3ef3/.functions_os.CYGWIN_NT#L9
>> Cygwin never creates Windows Directory or Filesystem Junction reparse points, 
>> and by default it uses its own version of Unix path symlink files, preceded by 
>> a flag ("magic cookie") value, and with system attribute, to allow 
>> compatibility with FAT file system limitations, or else NFS symlinks on NFS 
>> filesystems.
>> CYGWIN env var settings allow creation of Windows shortcuts and symbolic link 
>> reparse points instead of its default (equivalent to winsymlinks:sys), when 
>> supported by the file system and Windows release:
>>     https://cygwin.com/cygwin-ug-net/using-cygwinenv.html
>>     https://cygwin.com/cygwin-ug-net/using.html#pathnames-symlinks

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry


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