Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
Date: Fri, 1 Jun 2001 14:27:04 +0200
From: Corinna Vinschen <cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: patching symlinks
Message-ID: <20010601142704.A595@cygbert.vinschen.de>
Mail-Followup-To: cygwin@cygwin.com
References: <15126.27720.592000.876140@gargle.gargle.HOWL>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
In-Reply-To: <15126.27720.592000.876140@gargle.gargle.HOWL>; from Markus.Hoenicka@uth.tmc.edu on Thu, May 31, 2001 at 04:07:36PM +0000

On Thu, May 31, 2001 at 04:07:36PM +0000, Markus Hoenicka wrote:
> I hope I didn't miss something obvious. I tried to apply a patch to a
> file which is a symlink to the real file. What happens is that the
> .lnk file is patched, rendering it unusable as a symlink, whereas the
> real file is not touched. Is this the expected behaviour?

Partly. Just to be clear, let's create a situation:

$ ls -l
-rw-r--r--   1 corinna  root         9298 May 31 18:11 cyg_utils.cc
lrwxrwxrwx   1 corinna  root          104 Jun  1 14:15 utils.cc -> cyg_utils.cc
-rw-r--r--   1 corinna  root          756 May 31 18:11 utils.patch

`utils.patch' contains a patch to a file called `utils.cc'.

$ patch -p0 -i utils.patch
patching file `utils.cc'

$ ls -l
-rw-r--r--   1 corinna  root         9298 May 31 18:11 cyg_utils.cc
-rw-r--r--   1 corinna  root         9623 May 31 18:11 utils.cc
-rw-r--r--   1 corinna  root          756 May 31 18:11 utils.patch

That situation is absolute normal. Patch ignores that a file is
actually a symlink, not only on Cygwin. Patch merges the patches
into a file by creating another file including the merge,
typically in /tmp, and then simply moves the new file to the old
one. If that file is actually a symlink, the symlink is simply
substituted by the temporary file which is the result of
applying the patch.

In the current Cygwin version is an error in rename(2), though,
which has a slightly different (and wrong) result.
I have applied a patch to the Cygwin CVS repository.

Thanks for pointing this out,
Corinna

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

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

