public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Symlinks and sharing a home directory between Windows and Linux
@ 2011-12-14 19:34 Andrew DeFaria
  2011-12-14 20:00 ` Jeremy Bopp
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew DeFaria @ 2011-12-14 19:34 UTC (permalink / raw)
  To: cygwin

I like having only one home directory. It's extremely convenient to have 
the same settings and the like both when on Cygwin and when on Linux.

Often home directories are on NAS's and the like and served out via smb.

Somewhere along the line Cygwin's symlink implementation changed again. 
It used to be that symlinks ended in .lnk, which was sort of a pain but 
workable. One nice thing is that they didn't clash with Linux symlinks. 
A Cygwin symlink is not the same as a Linux symlink and so you could have:

$ ln -s a_file.txt link1 # in Cygwin
$ ln -s a_file.txt link1 # in Linux

and you'd end up having a symlink with the same name, link1, pointing to 
the same file from either Cygwin or Linux. This is because the Linux 
symlink is named just "link1" and the Cygwin symlink is named "link1.txt".

But now Cygwin names its symlink "link1". When you then log into Linux 
and try to access that link it doesn't work.

Where this is happening for me is that I put all of my rc files under 
~/.rc and then I symlink them to ~ as appropriate. So, for example I 
have a ~/.rc/inputrc. I then symlink them to ~/.inputrc. Under the old 
scenario I'd get a ~/.inputrc.lnk for Cygwin and a ~/.inputrc on Linux. 
Under the new scenario I get a clash.

Is there any way around this?


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Symlinks and sharing a home directory between Windows and Linux
  2011-12-14 19:34 Symlinks and sharing a home directory between Windows and Linux Andrew DeFaria
@ 2011-12-14 20:00 ` Jeremy Bopp
  2011-12-14 20:15   ` Buchbinder, Barry (NIH/NIAID) [E]
  0 siblings, 1 reply; 9+ messages in thread
From: Jeremy Bopp @ 2011-12-14 20:00 UTC (permalink / raw)
  To: cygwin

On 12/14/2011 01:33 PM, Andrew DeFaria wrote:
> I like having only one home directory. It's extremely convenient to have
> the same settings and the like both when on Cygwin and when on Linux.
> 
> Often home directories are on NAS's and the like and served out via smb.
> 
> Somewhere along the line Cygwin's symlink implementation changed again.
> It used to be that symlinks ended in .lnk, which was sort of a pain but
> workable. One nice thing is that they didn't clash with Linux symlinks.
> A Cygwin symlink is not the same as a Linux symlink and so you could have:
> 
> $ ln -s a_file.txt link1 # in Cygwin
> $ ln -s a_file.txt link1 # in Linux
> 
> and you'd end up having a symlink with the same name, link1, pointing to
> the same file from either Cygwin or Linux. This is because the Linux
> symlink is named just "link1" and the Cygwin symlink is named "link1.txt".
> 
> But now Cygwin names its symlink "link1". When you then log into Linux
> and try to access that link it doesn't work.
> 
> Where this is happening for me is that I put all of my rc files under
> ~/.rc and then I symlink them to ~ as appropriate. So, for example I
> have a ~/.rc/inputrc. I then symlink them to ~/.inputrc. Under the old
> scenario I'd get a ~/.inputrc.lnk for Cygwin and a ~/.inputrc on Linux.
> Under the new scenario I get a clash.
> 
> Is there any way around this?

Would a hard link work instead?

-Jeremy

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: Symlinks and sharing a home directory between Windows and Linux
  2011-12-14 20:00 ` Jeremy Bopp
@ 2011-12-14 20:15   ` Buchbinder, Barry (NIH/NIAID) [E]
  2011-12-14 22:32     ` Andrew DeFaria
  0 siblings, 1 reply; 9+ messages in thread
From: Buchbinder, Barry (NIH/NIAID) [E] @ 2011-12-14 20:15 UTC (permalink / raw)
  To: cygwin

Jeremy Bopp sent the following at Wednesday, December 14, 2011 3:01 PM
>On 12/14/2011 01:33 PM, Andrew DeFaria wrote:
>> I like having only one home directory. It's extremely convenient to have
>> the same settings and the like both when on Cygwin and when on Linux.
>>
>> Often home directories are on NAS's and the like and served out via smb.
>>
>> Somewhere along the line Cygwin's symlink implementation changed again.
>> It used to be that symlinks ended in .lnk, which was sort of a pain but
>> workable. One nice thing is that they didn't clash with Linux symlinks.
>> A Cygwin symlink is not the same as a Linux symlink and so you could have:
>>
>> $ ln -s a_file.txt link1 # in Cygwin
>> $ ln -s a_file.txt link1 # in Linux
>>
>> and you'd end up having a symlink with the same name, link1, pointing to
>> the same file from either Cygwin or Linux. This is because the Linux
>> symlink is named just "link1" and the Cygwin symlink is named "link1.txt".
>>
>> But now Cygwin names its symlink "link1". When you then log into Linux
>> and try to access that link it doesn't work.
>>
>> Where this is happening for me is that I put all of my rc files under
>> ~/.rc and then I symlink them to ~ as appropriate. So, for example I
>> have a ~/.rc/inputrc. I then symlink them to ~/.inputrc. Under the old
>> scenario I'd get a ~/.inputrc.lnk for Cygwin and a ~/.inputrc on Linux.
>> Under the new scenario I get a clash.
>>
>> Is there any way around this?
>
>Would a hard link work instead?

Might CYGWIN=winsymlinks help?
http://cygwin.com/cygwin-ug-net/using-cygwinenv.html
More:
http://cygwin.com/faq/faq-nochunks.html#faq.using.symlinkstoppedworking
http://cygwin.com/faq/faq-nochunks.html#faq.api.symlinks

Good luck.

- Barry
  Disclaimer: Statements made herein are not made on behalf of NIAID.



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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Symlinks and sharing a home directory between Windows and Linux
  2011-12-14 20:15   ` Buchbinder, Barry (NIH/NIAID) [E]
@ 2011-12-14 22:32     ` Andrew DeFaria
  2011-12-15 23:48       ` Andrew DeFaria
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew DeFaria @ 2011-12-14 22:32 UTC (permalink / raw)
  To: cygwin

On 12/14/2011 12:14 PM, Buchbinder, Barry (NIH/NIAID) [E] wrote:
> Might CYGWIN=winsymlinks help?
> http://cygwin.com/cygwin-ug-net/using-cygwinenv.html
I don't see how. I think that I need the .lnk portion of the file. It's 
not clear to me from that link's description that setting winsymlinks 
gives me .lnk.

Hmmm... Just tested. Ah yes! The winsymlinks seems to do the trick! Thanks!
> More:
> http://cygwin.com/faq/faq-nochunks.html#faq.using.symlinkstoppedworking
> http://cygwin.com/faq/faq-nochunks.html#faq.api.symlinks
>
Thanks for the references...
-- 
Andrew DeFaria <http://defaria.com>
Never argue with a fool; he will soon beat you with his experience.


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Symlinks and sharing a home directory between Windows and Linux
  2011-12-14 22:32     ` Andrew DeFaria
@ 2011-12-15 23:48       ` Andrew DeFaria
  2011-12-16  3:41         ` Larry Hall (Cygwin)
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew DeFaria @ 2011-12-15 23:48 UTC (permalink / raw)
  To: cygwin

On 12/14/2011 2:32 PM, Andrew DeFaria wrote:
> On 12/14/2011 12:14 PM, Buchbinder, Barry (NIH/NIAID) [E] wrote:
>> Might CYGWIN=winsymlinks help?
>> http://cygwin.com/cygwin-ug-net/using-cygwinenv.html
> I don't see how. I think that I need the .lnk portion of the file. 
> It's not clear to me from that link's description that setting 
> winsymlinks gives me .lnk.
>
> Hmmm... Just tested. Ah yes! The winsymlinks seems to do the trick! 
> Thanks!
>> More:
>> http://cygwin.com/faq/faq-nochunks.html#faq.using.symlinkstoppedworking
>> http://cygwin.com/faq/faq-nochunks.html#faq.api.symlinks
>>
> Thanks for the references...
I'm not sure this is working as well as I had hoped (or remembered). I 
think the question boils down to, given a Unix symlink of say 
.bash_login and a Cygwin symlink of say .bash_login.lnk, which does 
Cygwin read when logging it? I would have hoped that Cygwin would always 
see the .lnk file whereas Unix would see the regular symlink. That's how 
I thought this worked before. But it doesn't seem to be working that 
way. In fact I see:

$ ls -l .bash*
-rw-r--r-- 1 adefaria clearusers 7179 Dec 15 15:35 .bash_history
-rw-r--r-- 1 adefaria clearusers   29 Dec 15 14:36 .bash_login
-rw-r--r-- 1 adefaria clearusers   29 Dec 15 14:36 .bash_login
-rw-r--r-- 1 adefaria clearusers   29 Dec 15 14:36 .bashrc
-rw-r--r-- 1 adefaria clearusers   29 Dec 15 14:36 .bashrc

When I login bash see the Unix formated .bash_login symlink and chokes. 
I can remove this Unix symlink from the Unix side and log in with bash 
again and it works. If I remake the symlink on the Unix side it fails! :-(

I don't remember this being a problem before. I fear this is a Samba 
config thing...

Note: CYGWIN has winsymlinks in it...
-- 
Andrew DeFaria <http://defaria.com>
Law of Probability Dispersal: Whatever it is that hits the fan will not 
be evenly distributed.


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Symlinks and sharing a home directory between Windows and Linux
  2011-12-15 23:48       ` Andrew DeFaria
@ 2011-12-16  3:41         ` Larry Hall (Cygwin)
  2011-12-16 16:21           ` Andrew DeFaria
  0 siblings, 1 reply; 9+ messages in thread
From: Larry Hall (Cygwin) @ 2011-12-16  3:41 UTC (permalink / raw)
  To: cygwin

On 12/15/2011 6:47 PM, Andrew DeFaria wrote:
> On 12/14/2011 2:32 PM, Andrew DeFaria wrote:
>> On 12/14/2011 12:14 PM, Buchbinder, Barry (NIH/NIAID) [E] wrote:
>>> Might CYGWIN=winsymlinks help?
>>> http://cygwin.com/cygwin-ug-net/using-cygwinenv.html
>> I don't see how. I think that I need the .lnk portion of the file. It's
>> not clear to me from that link's description that setting winsymlinks
>> gives me .lnk.
>>
>> Hmmm... Just tested. Ah yes! The winsymlinks seems to do the trick! Thanks!
>>> More:
>>> http://cygwin.com/faq/faq-nochunks.html#faq.using.symlinkstoppedworking
>>> http://cygwin.com/faq/faq-nochunks.html#faq.api.symlinks
>>>
>> Thanks for the references...
> I'm not sure this is working as well as I had hoped (or remembered). I think
> the question boils down to, given a Unix symlink of say .bash_login and a
> Cygwin symlink of say .bash_login.lnk, which does Cygwin read when logging
> it? I would have hoped that Cygwin would always see the .lnk file whereas
> Unix would see the regular symlink. That's how I thought this worked before.
> But it doesn't seem to be working that way. In fact I see:
>
> $ ls -l .bash*
> -rw-r--r-- 1 adefaria clearusers 7179 Dec 15 15:35 .bash_history
> -rw-r--r-- 1 adefaria clearusers 29 Dec 15 14:36 .bash_login
> -rw-r--r-- 1 adefaria clearusers 29 Dec 15 14:36 .bash_login
> -rw-r--r-- 1 adefaria clearusers 29 Dec 15 14:36 .bashrc
> -rw-r--r-- 1 adefaria clearusers 29 Dec 15 14:36 .bashrc
>
> When I login bash see the Unix formated .bash_login symlink and chokes. I
> can remove this Unix symlink from the Unix side and log in with bash again
> and it works. If I remake the symlink on the Unix side it fails! :-(
>
> I don't remember this being a problem before. I fear this is a Samba config
> thing...
>
> Note: CYGWIN has winsymlinks in it...

I'm having difficulty seeing how what you have described could work unless
the consumers of these files are looking for symlinks only, which your
example above contradicts.  And both of the ".bashrc" files are registering
as plain files, so I think you're right that the file system on which they
reside is coming into play, assuming the output above is from Cygwin's
'ls'.  But even if you had ".bashrc" and ".bashrc.lnk" with the former
being a UNIX-form of symlink and the latter being the Cygwin one, I'd still
expect Cygwin to recognize ".bashrc" first and only go looking for the .lnk
version if it couldn't find that.  The output of strace may convince you
of that as well. ;-)  It might actually work as you describe it though if
you can get Cygwin to think that it can't open the former.  I could see that
being the case if the UNIX symlink was created by a user ID Cygwin didn't
recognize, for example.

-- 
Larry

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Symlinks and sharing a home directory between Windows and Linux
  2011-12-16  3:41         ` Larry Hall (Cygwin)
@ 2011-12-16 16:21           ` Andrew DeFaria
  2011-12-16 16:47             ` Jon Clugston
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew DeFaria @ 2011-12-16 16:21 UTC (permalink / raw)
  To: cygwin

On 12/15/2011 07:40 PM, Larry Hall (Cygwin) wrote:
> I'm having difficulty seeing how what you have described could work 
> unless the consumers of these files are looking for symlinks only, 
> which your example above contradicts.  And both of the ".bashrc" files 
> are registering as plain files, so I think you're right that the file 
> system on which they reside is coming into play, assuming the output 
> above is from Cygwin's 'ls'.  But even if you had ".bashrc" and 
> ".bashrc.lnk" with the former being a UNIX-form of symlink and the 
> latter being the Cygwin one, I'd still expect Cygwin to recognize 
> ".bashrc" first and only go looking for the .lnk version if it 
> couldn't find that.
I would think that Cygwin should see the .lnk version first. No? I guess 
not. I thought it worked that way before.
> The output of strace may convince you of that as well. ;-)  It might 
> actually work as you describe it though if
> you can get Cygwin to think that it can't open the former.  I could 
> see that being the case if the UNIX symlink was created by a user ID 
> Cygwin didn't recognize, for example.
I've backed off to using hardlinks which work on both systems but it 
doesn't work for directories.
-- 
Andrew DeFaria <http://defaria.com>
Accept that some days you're the pigeon, and some days you're the statue.


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Symlinks and sharing a home directory between Windows and Linux
  2011-12-16 16:21           ` Andrew DeFaria
@ 2011-12-16 16:47             ` Jon Clugston
  2011-12-20 17:44               ` Larry Hall (Cygwin)
  0 siblings, 1 reply; 9+ messages in thread
From: Jon Clugston @ 2011-12-16 16:47 UTC (permalink / raw)
  To: cygwin

On Fri, Dec 16, 2011 at 11:20 AM, Andrew DeFaria <Andrew@defaria.com> wrote:
> On 12/15/2011 07:40 PM, Larry Hall (Cygwin) wrote:
>>
>> I'm having difficulty seeing how what you have described could work unless
>> the consumers of these files are looking for symlinks only, which your
>> example above contradicts.  And both of the ".bashrc" files are registering
>> as plain files, so I think you're right that the file system on which they
>> reside is coming into play, assuming the output above is from Cygwin's 'ls'.
>>  But even if you had ".bashrc" and ".bashrc.lnk" with the former being a
>> UNIX-form of symlink and the latter being the Cygwin one, I'd still expect
>> Cygwin to recognize ".bashrc" first and only go looking for the .lnk version
>> if it couldn't find that.
>
> I would think that Cygwin should see the .lnk version first. No? I guess
> not. I thought it worked that way before.

This would be a performance disaster - forcing a check for 'x.lnk'
every time the software tried to access file 'x'.  I doubt that it
worked that way before.


>>
>> The output of strace may convince you of that as well. ;-)  It might
>> actually work as you describe it though if
>> you can get Cygwin to think that it can't open the former.  I could see
>> that being the case if the UNIX symlink was created by a user ID Cygwin
>> didn't recognize, for example.
>
> I've backed off to using hardlinks which work on both systems but it doesn't
> work for directories.
> --
> Andrew DeFaria <http://defaria.com>
> Accept that some days you're the pigeon, and some days you're the statue.
>
>
> --
> 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
>

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Symlinks and sharing a home directory between Windows and Linux
  2011-12-16 16:47             ` Jon Clugston
@ 2011-12-20 17:44               ` Larry Hall (Cygwin)
  0 siblings, 0 replies; 9+ messages in thread
From: Larry Hall (Cygwin) @ 2011-12-20 17:44 UTC (permalink / raw)
  To: cygwin

On 12/16/2011 11:46 AM, Jon Clugston wrote:
> On Fri, Dec 16, 2011 at 11:20 AM, Andrew DeFaria<Andrew@defaria.com>  wrote:
>> On 12/15/2011 07:40 PM, Larry Hall (Cygwin) wrote:
>>>
>>> I'm having difficulty seeing how what you have described could work unless
>>> the consumers of these files are looking for symlinks only, which your
>>> example above contradicts.  And both of the ".bashrc" files are registering
>>> as plain files, so I think you're right that the file system on which they
>>> reside is coming into play, assuming the output above is from Cygwin's 'ls'.
>>>   But even if you had ".bashrc" and ".bashrc.lnk" with the former being a
>>> UNIX-form of symlink and the latter being the Cygwin one, I'd still expect
>>> Cygwin to recognize ".bashrc" first and only go looking for the .lnk version
>>> if it couldn't find that.
>>
>> I would think that Cygwin should see the .lnk version first. No? I guess
>> not. I thought it worked that way before.
>
> This would be a performance disaster - forcing a check for 'x.lnk'
> every time the software tried to access file 'x'.  I doubt that it
> worked that way before.

Correct.  It did not work this way for the reason you stated.

-- 
Larry

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-12-20 17:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-14 19:34 Symlinks and sharing a home directory between Windows and Linux Andrew DeFaria
2011-12-14 20:00 ` Jeremy Bopp
2011-12-14 20:15   ` Buchbinder, Barry (NIH/NIAID) [E]
2011-12-14 22:32     ` Andrew DeFaria
2011-12-15 23:48       ` Andrew DeFaria
2011-12-16  3:41         ` Larry Hall (Cygwin)
2011-12-16 16:21           ` Andrew DeFaria
2011-12-16 16:47             ` Jon Clugston
2011-12-20 17:44               ` Larry Hall (Cygwin)

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