delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/06/27/01:20:44

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Date: Wed, 26 Jun 2002 22:17:25 -0700 (PDT)
From: "Peter A. Castro" <doctor AT fruitbat DOT org>
To: cygwin AT cygwin DOT com
Subject: Fun with symlinks?
Message-ID: <Pine.LNX.4.21.0206261845460.17279-100000@gremlin.fruitbat.org>
MIME-Version: 1.0

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 AT fruitbat DOT org> or <Peter DOT Castro AT oracle DOT 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/

- Raw text -


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