delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/10/11/18:38:31

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=mkCMFZB7d4aUOlcYZ2x1w/t7JW00fPjp4BqCzQ0WdTI
70vFq31aa9Xfo1nZIGTwiUQIZkCLceVvsxiluS+48JYJn4YrtwHT1yvMrmVlIhs3
GF3peK9NeZDuMpDnwttIEwJ3a1Bj1sOQ4eQzuBFWhyZxewDzaHXUI4l+9AAtvAuM
=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=aDYXH0AT7x4znyibp9Ot9z73vOo=; b=W+BoaiD8cLGo/mOXy
brUk1syNvsBo8JxyiBCeNFeg8K/B4rvMKxTEgM9wfMrmAFpGV7cmh0BuMEO7vh1p
N7X5bFLSASbi4QBqzTafuenTnuF4oMd0/VdPR43iXsoIZycxMAXsJNNIWx5pooQR
Su9VMfA2HNHpjoAntAbEps+cJ4=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.0 required=5.0 tests=AWL,BAYES_50,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2
X-HELO: Ishtar.hs.tlinx.org
Message-ID: <561AE4CF.5030303@tlinx.org>
Date: Sun, 11 Oct 2015 15:38:07 -0700
From: Linda Walsh <cygwin AT tlinx DOT org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Problems w/cygsym links vs. winsymlnks: (was Re: Running a program using a DLL under Cygwin)
References: <22038 DOT 29093 DOT 221000 DOT 863384 AT woitok DOT gmail DOT com> <CAJygYd3DLkzj=Va7uuU8-NSjUG6kog0YqBuvhDMMA=0vZwY+=Q AT mail DOT gmail DOT com> <393201296 DOT 20151008181210 AT yandex DOT ru> <5619F993 DOT 1030703 AT tlinx DOT org> <2710156785 DOT 20151011172001 AT yandex DOT ru>
In-Reply-To: <2710156785.20151011172001@yandex.ru>
X-IsSubscribed: yes

Andrey Repin wrote:
> Greetings, Linda Walsh!
> 
>>>> I think symlink is a cygwin thing.  Windows won't find that DLL (just
>>>> like you won't find it using windows explorer.)
>>> Unless he have created a Windows symlink, that is correct.
>>> Explorer, however, may find it, as Cygwin symlinks are Windows LNK files.
>> ----
>> Cygwin symlinks can use native Windows format, if you put 'winsymlinks:native export'
>> in your 'CYGWIN' env var at startup -- preferably in your Win profile.
> 
>> However, cygwin occasionally has some bugs in how it creates links:
>> /tmp> touch x
>> /tmp> ln -s x y    
>> /tmp> ll x y
>> -rw-rw-r--+ 1 0 Oct 10 22:27 x
>> lrwxrwxrwx  1 6 Oct 10 22:28 y -> /tmp/x
>> /tmp> cmd /c dir ?|grep '\s[xy]'
>> 10/10/2015  10:32 PM                 0 x
>> 10/10/2015  10:40 PM    <SYMLINK>      y [C:\tmp\x]
>> /tmp> rm y
>> /tmp> mklink x y
> 
> Do note that native mklink has arguments in the opposite order. (Microsoft...)
---
	Yes... but notice I typed that at a bash prompt and that 
it did the same thing as 'ln -s' and worked with the same order
(mklink = bash-script that wraps around native mklink to make
it same order).  This also has mklink working but 'ln -s'
changing a relative link to a absolute link


	Another example of cygwin's 'ln -s' chainging the link:
---
/tmp> mkdir foo
/tmp> ln -s foo cygfoo
/tmp> mklink foo winfoo
symbolic link created for winfoo <<===>> foo
/tmp> cmd /c dir|grep  foo
10/11/2015  11:23 AM    <SYMLINKD>     cygfoo [C:\tmp\foo]
10/11/2015  11:22 AM    <DIR>          foo
10/11/2015  11:24 AM    <SYMLINKD>     winfoo [foo]
---
looks innocent enough until I mv them:
/tmp> mkdir links
/tmp> mv foo cygfoo winfoo links
/tmp> cd links
/tmp/links> ls
cygfoo@  foo/  winfoo@
/tmp/links> ll
total 0
lrwxrwxrwx  1 8 Oct 11 11:23 cygfoo -> /tmp/foo
drwxrwxr-x+ 1 0 Oct 11 11:22 foo/
lrwxrwxrwx  1 3 Oct 11 11:24 winfoo -> foo/
-----
Notice the cygwin created symlink points to a
non-existing file /tmp/foo. 
 
A 3rd problem is trying to create the links 
before creating the dir.

Not a problem on linux, but on windows, notice above, the
symlinks to directories are a different type
than the ones to regular files.

So, currently the shell wrapper complains, but cygwin
creates a cygwin-only symlink: a hidden 'System' file that
windows can't use and normally doesn't see:

/tmp/links> ln -s foo2 cygfoo2
/tmp/links> mklink foo2 winfoo2
Source, "foo2", does not exist.
  ### uhoh, "forgot" to create foo2 1st, better create it now:
/tmp/links> mkdir foo2
/tmp/links> mklink foo2 winfoo2

/tmp/links> ls *?foo2
cygfoo2@  winfoo2@
/tmp/links> ll *?foo2
lrwxrwxrwx 1 4 Oct 11 12:31 cygfoo2 -> foo2/
lrwxrwxrwx 1 4 Oct 11 12:37 winfoo2 -> foo2/

  ### create files in cygfoo2 and winfoo2 from cygwin:
/tmp/links> touch {cyg,win}foo2/child_file
/tmp/links> ll {cyg,win}foo2/child_file   
-rw-rw-r-- 1 0 Oct 11 13:22 cygfoo2/child_file
-rw-rw-r-- 1 0 Oct 11 13:22 winfoo2/child_file

  ## so cygwin can create a child_file in each, but
  ## win's dir /a?



  ### looks like cygfoo2 is there, as seen on cygwin, above, but a 
  ### dir cmd from win doesn't see it:


/tmp/links> cmd /c dir|grep ' [AP]M'
10/11/2015  12:37 PM    <DIR>          .
10/11/2015  12:37 PM    <DIR>          ..
10/11/2015  11:23 AM    <SYMLINKD>     cygfoo [C:\tmp\foo]
10/11/2015  11:22 AM    <DIR>          foo
10/11/2015  12:35 PM    <DIR>          foo2
10/11/2015  11:24 AM    <SYMLINKD>     winfoo [foo]
10/11/2015  12:37 PM    <SYMLINKD>     winfoo2 [foo2]


  ### attrib/no args shows files with attrs set:

/tmp/links> attrib                     
   S         C:\tmp\links\cygfoo2

  ### dir /a will show also reveal hidden and system files:
  ### this shows diff of cygwin ln -s foo2 cygfoo2
  ###                 and the bash-shell wrapper calling mklink
  ###	              (after 'mkdir foo2')

/tmp/links> cmd /c dir /a *?foo2|grep ' [AP]M'
10/11/2015  12:31 PM                22 cygfoo2
10/11/2015  12:37 PM    <SYMLINKD>     winfoo2 [foo2]

 ## creating files in 'cygfoo2 and winfoo2


> For the purposes of DLL loading, hardlink is probably a good choice.
---
There is one drawback to hardlink usage (if softlink usage doesn't
matter, of course, that's irrelevant).  All copies of a hardlinked
file will be locked if any of them are.

Vs. if you use softlinks, -- the file they point to will
likely be locked, by the symlinks might not be... if that's
the case, symlinks could be repointed at new "dll"'s for
fixes without requiring requiring the current dll's not
be in use.


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

- Raw text -


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