This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fun with symlinks?


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]