bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: No action with forced symbolic link if link already exists


From: Bob Proulx
Subject: Re: No action with forced symbolic link if link already exists
Date: Tue, 20 Sep 2005 07:39:34 -0600
User-agent: Mutt/1.5.9i

Till Halbach wrote:
> I'm running
> ln (coreutils) 5.2.1.
> 
> Assume the link "link" already exists and points to "other_file". Then
> "ln -sf new_file link" won't trigger any action at all. No error message  
> is uttered either.

I will guess that you are only seeing this when link points to a
directory and not to a file.  Because then the new symlink will be
created in the directory.  If you look at the symlink you may be
fooled into thinking nothing happened.  But I am sure the symlink was
created.

Try using the --verbose option and you should see exactly what is
happening.

  ln -v -sf new_file link

> This is a regression, as it worked before (i.e., the old link was  
> overwritten).
> Unfortunately I cannot tell exactly where it was introduced.

You may find these previous discussions useful.

  http://lists.gnu.org/archive/html/bug-fileutils/2003-10/msg00001.html

And more recently.

  http://lists.gnu.org/archive/html/bug-coreutils/2005-05/msg00171.html

This is BSD style functionality.  You are probably wanting SysV style
functionality.  The only portable way to do this is to remove the
symlink first.

  rm -f dstfile
  ln -s srcfile dstfile

Also best to remove the slash from the value of the link.

As an extension but something that won't work on legacy SysV like
systems such as HP-UX or AIX you can use the -n option.

  ln -fns srcfile dstfile

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]