public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@Shaw.ca>
To: cygwin@cygwin.com
Subject: Re: Cygwin tool to differ junctions from soft links?
Date: Thu, 16 Nov 2023 13:30:26 -0700	[thread overview]
Message-ID: <6752f3b0-0fbf-4709-976c-12030285e0bb@Shaw.ca> (raw)
In-Reply-To: <1439487749.2493319.1700160923985@mail.yahoo.com>

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.

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

  reply	other threads:[~2023-11-16 20:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-01  9:14 Martin Wege
2023-11-16  7:29 ` Martin Wege
2023-11-17  1:59   ` Doug Henderson
2023-11-16  8:47 ` Andrey Repin
2023-11-16 18:55   ` matthew patton
2023-11-16 20:30     ` Brian Inglis [this message]
2023-11-17  5:54       ` Thomas Wolff
2023-11-17 12:06         ` Corinna Vinschen
2023-11-17 14:56         ` Brian Inglis
2023-11-17 18:44           ` matthew patton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6752f3b0-0fbf-4709-976c-12030285e0bb@Shaw.ca \
    --to=brian.inglis@shaw.ca \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).