public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Fun with symlinks?
@ 2002-06-27  2:38 Peter A. Castro
  2002-06-27  4:44 ` Corinna Vinschen
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Peter A. Castro @ 2002-06-27  2:38 UTC (permalink / raw)
  To: cygwin

I've seen a specific "problem" two times now, and I'm pretty sure it's
a minor flaw in the installer, but I've been bitten by it twice now and
felt others should be aware of it incase it happens to them.

The problem is this:
Suppose you have created a symlink for, say /etc/profile pointing to some
custom file, say profile.pac, thus:
	$ cd /etc
	$ cp profile profile.pac
	$ mv profile profile.orig
	$ ln -s profile.pac profile
	$ vim profile.pac
	Make some changes that showup when Bash is started.

Fine, so far.  Now, suppose you got a notice that a new Bash was uploaded
to the cygwin release area.  So, you fire up 'setup' and tell it to
upgrade Bash.  Now, start Bash.  Notice your changes don't show up anymore.
Now, do an 'ls -al /etc/pro*'

-rw-r--r--    1 Administ None          386 May 30 19:08 /etc/profile
-rw-r--r--    1 Administ None          386 May 30 19:08 /etc/profile
-rw-r--r--    1 Administ None          386 May 14 23:21 /etc/profile.orig
-rw-r--r--    1 Administ None          525 May 22 13:06 /etc/profile.pac 

Notice that there are *two* files named 'profile'.  Now, one has to be a
real file, and one has to be the symlink.  The access rules seem to favor
the real file, so the symlink is, apparently, ignored.  But, this
presents a consistency problem as there should only be one "file" named
'profile'.  Also, when Bash was updated, it should have either removed
the symlink and created a real file, or updated what the symlink pointed
to. 

I considder this a minor issue, really, but it does illustrate a problem.
Now, for another real-life example:

I recently upgraded to the latest XFree packages.  After re-starting X,
suddenly I was getting errors from various apps (eg: xcalc & xman) about
missing app defaults.  I checked /etc/X11/app-defaults but all the
default files were there.  So, I checked /usr/X11R6/lib/X11 and sure
enough, there were two directories named 'app-defaults'.  One was a
symlink to /etc/X11/app-defaults and the other was an almost empty
directory containing a lone file: Mwm.  After renaming the offending
directory to something else, the symlink once again provided the proper
reference.

The only reason I bring this up is that I feel others might encounter
this problem.  I haven't had time to look into the setup code yet, sorry. 
It's probably something simple, like checking if the destination path is a
symlink and either following it or removing it.

-- 
Peter A. Castro <doctor@fruitbat.org> or <Peter.Castro@oracle.com>
	"Cats are just autistic Dogs" -- Dr. Tony Attwood


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Fun with symlinks?
  2002-06-27  2:38 Fun with symlinks? Peter A. Castro
@ 2002-06-27  4:44 ` Corinna Vinschen
  2002-06-27  5:22   ` Robert Collins
  2002-06-27  4:47 ` Xclients not working correctly (was: Re: Fun with symlinks?) Peter Keller
  2002-06-27  4:48 ` Fun with symlinks? Pavel Tsekov
  2 siblings, 1 reply; 10+ messages in thread
From: Corinna Vinschen @ 2002-06-27  4:44 UTC (permalink / raw)
  To: cygwin

On Wed, Jun 26, 2002 at 10:17:25PM -0700, Peter A. Castro wrote:
> Fine, so far.  Now, suppose you got a notice that a new Bash was uploaded
> to the cygwin release area.  So, you fire up 'setup' and tell it to
> upgrade Bash.  Now, start Bash.  Notice your changes don't show up anymore.
> Now, do an 'ls -al /etc/pro*'
> 
> -rw-r--r--    1 Administ None          386 May 30 19:08 /etc/profile
> -rw-r--r--    1 Administ None          386 May 30 19:08 /etc/profile
> -rw-r--r--    1 Administ None          386 May 14 23:21 /etc/profile.orig
> -rw-r--r--    1 Administ None          525 May 22 13:06 /etc/profile.pac 
> 
> Notice that there are *two* files named 'profile'.  Now, one has to be a
> real file, and one has to be the symlink.  The access rules seem to favor
> the real file, so the symlink is, apparently, ignored.  But, this

That's a problem of setup.exe which doesn't understand that there's
a symlink of the Windows shortcut type (*.lnk) is in the way.
Setup should actually remove the symlink when creating the real
file.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Xclients not working correctly (was: Re: Fun with symlinks?)
  2002-06-27  2:38 Fun with symlinks? Peter A. Castro
  2002-06-27  4:44 ` Corinna Vinschen
@ 2002-06-27  4:47 ` Peter Keller
  2002-06-27  4:48 ` Fun with symlinks? Pavel Tsekov
  2 siblings, 0 replies; 10+ messages in thread
From: Peter Keller @ 2002-06-27  4:47 UTC (permalink / raw)
  To: cygwin

Hi,

Peter's real-life example described at the bottom of his message also
fixes X client problems that I had when upgrading to the latest release.
All credit to him for figuring this out.

One thing that needs clarifying, is that the extra app-defaults symlink
does not show up (for me at least) as a symlink with 'ls -l'. I could only
tell that it was a shortcut from the windows explorer.

Regards,
Peter Keller.

"Peter A. Castro" wrote:

> I've seen a specific "problem" two times now, and I'm pretty sure it's
> a minor flaw in the installer, but I've been bitten by it twice now and
> felt others should be aware of it incase it happens to them.

[snip]

>
> I considder this a minor issue, really, but it does illustrate a problem.
> Now, for another real-life example:
>
> I recently upgraded to the latest XFree packages.  After re-starting X,
> suddenly I was getting errors from various apps (eg: xcalc & xman) about
> missing app defaults.  I checked /etc/X11/app-defaults but all the
> default files were there.  So, I checked /usr/X11R6/lib/X11 and sure
> enough, there were two directories named 'app-defaults'.  One was a
> symlink to /etc/X11/app-defaults and the other was an almost empty
> directory containing a lone file: Mwm.  After renaming the offending
> directory to something else, the symlink once again provided the proper
> reference.
>
> The only reason I bring this up is that I feel others might encounter
> this problem.  I haven't had time to look into the setup code yet, sorry.
> It's probably something simple, like checking if the destination path is a
> symlink and either following it or removing it.
>
> --
> Peter A. Castro <doctor@fruitbat.org> or <Peter.Castro@oracle.com>
>         "Cats are just autistic Dogs" -- Dr. Tony Attwood
>
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Fun with symlinks?
  2002-06-27  2:38 Fun with symlinks? Peter A. Castro
  2002-06-27  4:44 ` Corinna Vinschen
  2002-06-27  4:47 ` Xclients not working correctly (was: Re: Fun with symlinks?) Peter Keller
@ 2002-06-27  4:48 ` Pavel Tsekov
  2002-07-04 15:20   ` Peter A. Castro
  2 siblings, 1 reply; 10+ messages in thread
From: Pavel Tsekov @ 2002-06-27  4:48 UTC (permalink / raw)
  To: Peter A. Castro; +Cc: cygwin

Hello Peter,

Thursday, June 27, 2002, 7:17:25 AM, you wrote:

[snip]

PAC> Fine, so far.  Now, suppose you got a notice that a new Bash was uploaded
PAC> to the cygwin release area.  So, you fire up 'setup' and tell it to
PAC> upgrade Bash.  Now, start Bash.  Notice your changes don't show up anymore.
PAC> Now, do an 'ls -al /etc/pro*'

PAC> -rw-r--r--    1 Administ None          386 May 30 19:08 /etc/profile
PAC> -rw-r--r--    1 Administ None          386 May 30 19:08 /etc/profile

This is not real :) If you go to the /etc directory from a windows
command prompt and type 'dir' you will see:

profile
profile.lnk

The second one is your link and it is compatible with the windows type
shortcuts.

I know there is a way, in terms of a flag in the CYGWIN variable, to
control the type of symlinks which cygwin creates, but I don't
remember the details :( You can check the user's guide though.

I agree that the setup.exe behaviour in this case maybe needs an
improvement.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Fun with symlinks?
  2002-06-27  4:44 ` Corinna Vinschen
@ 2002-06-27  5:22   ` Robert Collins
  2002-06-27  6:06     ` Corinna Vinschen
  0 siblings, 1 reply; 10+ messages in thread
From: Robert Collins @ 2002-06-27  5:22 UTC (permalink / raw)
  To: cygwin


----- Original Message ----- 
From: "Corinna Vinschen" <corinna-cygwin@cygwin.com>
To: <cygwin@cygwin.com>
Sent: Thursday, June 27, 2002 7:12 PM

> That's a problem of setup.exe which doesn't understand that there's
> a symlink of the Windows shortcut type (*.lnk) is in the way.
> Setup should actually remove the symlink when creating the real
> file.

Hmm, I thought we had patched setup to handle this. mmm.

Rob


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Fun with symlinks?
  2002-06-27  5:22   ` Robert Collins
@ 2002-06-27  6:06     ` Corinna Vinschen
  2002-06-27  6:18       ` Robert Collins
  0 siblings, 1 reply; 10+ messages in thread
From: Corinna Vinschen @ 2002-06-27  6:06 UTC (permalink / raw)
  To: cygwin

On Thu, Jun 27, 2002 at 08:17:12PM +1000, Robert Collins wrote:
> 
> ----- Original Message ----- 
> From: "Corinna Vinschen" <corinna-cygwin@cygwin.com>
> To: <cygwin@cygwin.com>
> Sent: Thursday, June 27, 2002 7:12 PM
> 
> > That's a problem of setup.exe which doesn't understand that there's
> > a symlink of the Windows shortcut type (*.lnk) is in the way.
> > Setup should actually remove the symlink when creating the real
> > file.
> 
> Hmm, I thought we had patched setup to handle this. mmm.

I've proposed a patch on cygwin-apps months ago but somehow it didn't
make it into the sources.  Or did it make it into the sources but
didn't survive for some reason?  I don't remember...

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* RE: Fun with symlinks?
  2002-06-27  6:06     ` Corinna Vinschen
@ 2002-06-27  6:18       ` Robert Collins
  2002-06-27  6:38         ` Corinna Vinschen
  0 siblings, 1 reply; 10+ messages in thread
From: Robert Collins @ 2002-06-27  6:18 UTC (permalink / raw)
  To: cygwin



> -----Original Message-----
> From: cygwin-owner@cygwin.com 
> [mailto:cygwin-owner@cygwin.com] On Behalf Of Corinna Vinschen
> Sent: Thursday, 27 June 2002 9:41 PM
> To: cygwin@cygwin.com
> Subject: Re: Fun with symlinks?
> 
> 
> On Thu, Jun 27, 2002 at 08:17:12PM +1000, Robert Collins wrote:
> > 
> > ----- Original Message ----- 
> > From: "Corinna Vinschen" <corinna-cygwin@cygwin.com>
> > To: <cygwin@cygwin.com>
> > Sent: Thursday, June 27, 2002 7:12 PM
> > 
> > > That's a problem of setup.exe which doesn't understand 
> that there's
> > > a symlink of the Windows shortcut type (*.lnk) is in the way.
> > > Setup should actually remove the symlink when creating the real
> > > file.
> > 
> > Hmm, I thought we had patched setup to handle this. mmm.
> 
> I've proposed a patch on cygwin-apps months ago but somehow it didn't
> make it into the sources.  Or did it make it into the sources but
> didn't survive for some reason?  I don't remember...

2002-01-15  Corinna Vinschen  <corinna@vinschen.de>

        * io_stream.cc (io_stream::gets): Eliminate trailing new line
chars.
        * package_meta.cc (packagemeta::uninstall): Check for additional
        Windows shortcut.  Unset R/O file attribute before trying to
delete
        file.

Rob.



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Fun with symlinks?
  2002-06-27  6:18       ` Robert Collins
@ 2002-06-27  6:38         ` Corinna Vinschen
  2002-06-27  6:41           ` Robert Collins
  0 siblings, 1 reply; 10+ messages in thread
From: Corinna Vinschen @ 2002-06-27  6:38 UTC (permalink / raw)
  To: cygwin

On Thu, Jun 27, 2002 at 09:44:35PM +1000, Robert Collins wrote:
> > I've proposed a patch on cygwin-apps months ago but somehow it didn't
> > make it into the sources.  Or did it make it into the sources but
> > didn't survive for some reason?  I don't remember...
> 
> 2002-01-15  Corinna Vinschen  <corinna@vinschen.de>
> 
>         * io_stream.cc (io_stream::gets): Eliminate trailing new line
> chars.
>         * package_meta.cc (packagemeta::uninstall): Check for additional
>         Windows shortcut.  Unset R/O file attribute before trying to
> delete
>         file.

So is it actually still called?

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* RE: Fun with symlinks?
  2002-06-27  6:38         ` Corinna Vinschen
@ 2002-06-27  6:41           ` Robert Collins
  0 siblings, 0 replies; 10+ messages in thread
From: Robert Collins @ 2002-06-27  6:41 UTC (permalink / raw)
  To: cygwin



> -----Original Message-----
> From: cygwin-owner@cygwin.com 
> [mailto:cygwin-owner@cygwin.com] On Behalf Of Corinna Vinschen
> Sent: Thursday, 27 June 2002 9:48 PM
> To: cygwin@cygwin.com
> Subject: Re: Fun with symlinks?
> 
> 
> On Thu, Jun 27, 2002 at 09:44:35PM +1000, Robert Collins wrote:
> > > I've proposed a patch on cygwin-apps months ago but 
> somehow it didn't
> > > make it into the sources.  Or did it make it into the sources but
> > > didn't survive for some reason?  I don't remember...
> > 
> > 2002-01-15  Corinna Vinschen  <corinna@vinschen.de>
> > 
> >         * io_stream.cc (io_stream::gets): Eliminate 
> trailing new line
> > chars.
> >         * package_meta.cc (packagemeta::uninstall): Check 
> for additional
> >         Windows shortcut.  Unset R/O file attribute before trying to
> > delete
> >         file.
> 
> So is it actually still called?

I haven't looked into this in detail, I happened to have the ChangeLog
open :}.

Rob


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Fun with symlinks?
  2002-06-27  4:48 ` Fun with symlinks? Pavel Tsekov
@ 2002-07-04 15:20   ` Peter A. Castro
  0 siblings, 0 replies; 10+ messages in thread
From: Peter A. Castro @ 2002-07-04 15:20 UTC (permalink / raw)
  To: cygwin

On Thu, 27 Jun 2002, Pavel Tsekov wrote:

> Hello Peter,

Hi Pavel!

> Thursday, June 27, 2002, 7:17:25 AM, you wrote:
> 
> [snip]
> 
> PAC> Fine, so far.  Now, suppose you got a notice that a new Bash was uploaded
> PAC> to the cygwin release area.  So, you fire up 'setup' and tell it to
> PAC> upgrade Bash.  Now, start Bash.  Notice your changes don't show up anymore.
> PAC> Now, do an 'ls -al /etc/pro*'
> 
> PAC> -rw-r--r--    1 Administ None          386 May 30 19:08 /etc/profile
> PAC> -rw-r--r--    1 Administ None          386 May 30 19:08 /etc/profile
> 
> This is not real :) If you go to the /etc directory from a windows
> command prompt and type 'dir' you will see:
> 
> profile
> profile.lnk
> 
> The second one is your link and it is compatible with the windows type
> shortcuts.

I'm quite aware that this is a windows shortcut, but the issue is that
under the cygwin environment, you will see two, identically named, files
under these conditions.

> I know there is a way, in terms of a flag in the CYGWIN variable, to
> control the type of symlinks which cygwin creates, but I don't
> remember the details :( You can check the user's guide though.

It's not so much how the cygwin environment creates symlinks but how the
*installer* (setup.exe) creates them (or ignore them :-).

> I agree that the setup.exe behaviour in this case maybe needs an
> improvement.

I seem to recall seeing a note from Corinna saying she had an enhancement
for this, but it doesn't appear to have made it into the code. 

-- 
Peter A. Castro <doctor@fruitbat.org> or <Peter.Castro@oracle.com>
	"Cats are just autistic Dogs" -- Dr. Tony Attwood


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

end of thread, other threads:[~2002-07-04 22:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-27  2:38 Fun with symlinks? Peter A. Castro
2002-06-27  4:44 ` Corinna Vinschen
2002-06-27  5:22   ` Robert Collins
2002-06-27  6:06     ` Corinna Vinschen
2002-06-27  6:18       ` Robert Collins
2002-06-27  6:38         ` Corinna Vinschen
2002-06-27  6:41           ` Robert Collins
2002-06-27  4:47 ` Xclients not working correctly (was: Re: Fun with symlinks?) Peter Keller
2002-06-27  4:48 ` Fun with symlinks? Pavel Tsekov
2002-07-04 15:20   ` Peter A. Castro

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