[darcs-users] symbolic links

David Roundy droundy at darcs.net
Mon Dec 17 19:54:54 UTC 2007


On Mon, Dec 17, 2007 at 08:18:01PM +0100, Albert Reiner wrote:
> On Sun, Dec 16, 2007 at 04:30:43PM -0500, David Roundy wrote:
> > I'm not clear what you would like darcs to do with symbolic links.  Do you
> > want darcs to delete the symbolic links when file contents change? That's
> > the only sane behavior I can imagine, but it hardly seems useful.  Perhaps
> > you could give us a hint what you want to do with symbolic links, and why
> > you think they'd be better than just copying the file contents.
> 
> No, deleting the file contents is definitely not what I want.  And I
> would hardly call it sane, either, especially if this happens
> silently.

I didn't say deleting the file contents, I said deleting the symlink.  And
there's no other sane way to behave, if we're going to pretend that the
symlink is a real file, as you suggest.

> What I want is for darcs to ignore that those are symbolic links, and
> to treat the file contents as if they were hard links or copies, at
> least as an optional behavior.  This also seems to be the behavior of
> least surprise, and it is the way things used to be.

What you describe involves deleting the symlinks.  And this behavior has
not changed in a *long* time.  Note that this behavior isn't particularly
unusual.  You'll get the same effect if you try to edit a symlink using
emacs, for instance.

> And the reason I think that is preferable to copying the files is that
> I expect a RCS to accomodate my work habits as much as possible
> (especially if it did work in the past), and that I am not really keen
> on adapting my habits to the quirks of the RCS.  In other words: I do
> not want to re-write my Makefiles and other scripts just for the sake
> of an RCS, but in some cases I want the files pulled into my working
> directory by those scripts etc. to reside in the repository anyway.
> Copying might be a work-around, but I am not sure I want to go through
> all the trouble of changing the scripts etc.; sticking some option
> into my preferences file is about the most I am willing to do.
> Downgrading to an earlier version of darcs is an option, too.

Why are you including auto-generated symlinks in your repository?

> > > At any rate, automatically flagging items for removal from the
> > > repository seems an extremely unfortunate design decision, especially
> > > if the behavior I want and is likely to be expected by many users was
> > > present in earlier versions.
> > 
> > Perhaps you could point to a bug report describing the behavior you
> > describe? Or file such a bug report? I really have no idea under what
> > circumstance this is happening to you, running what darcs commands, or how
> > to reproduce it.
> 
> My original description was not accurate: my impression arose because
> (1) things worked in the past, and (2) the files are replaced by the
> symlinks whenever the scripts in the working directory are run so that
> I am never consciously setting up links.  The net effect is that
> symlinks are flagged for removal if only I run the scripts in the
> working tree.
> 
> At any rate, the following does exhibit the unfortunate behavior:
> 
>   $ mkdir foo
>   $ cd foo
>   $ touch a
>   $ darcs init
>   $ darcs add a
>   $ darcs rec -a -m 'add a'
>   Finished recording patch 'add a'
>   $ rm a
>   $ touch b
>   $ ln -s b a
>   $ darcs w
>   {
>   rmfile ./a
>   }

Okay, this is the intended behavior.

> The expected (and for my applications correct) answer in the last step
> would be
> 
>   $ darcs w
>   No changes!
> 
> as the contents of a have not changed at all.

Actually, the contents of a have changed quite dramatically, as a is no
longer a file.

Note that the behavior you are asking is quite different from what will
happen when darcs properly supports symlinks.

The semantics you describe could certainly be implemented, but I'd by
highly suspicious of supporting symlinks to directories.  It's asking for
crazy things to happen, since it'd mean that darcs would then be willing to
write outside of a repository.
-- 
David Roundy
Department of Physics
Oregon State University


More information about the darcs-users mailing list