coreutils
[Top][All Lists]
Advanced

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

Re: bug#32127: RFE -- in the way "cp -rl" -- enable 'ln' to do likewise?


From: L A Walsh
Subject: Re: bug#32127: RFE -- in the way "cp -rl" -- enable 'ln' to do likewise?
Date: Fri, 13 Jul 2018 15:17:03 -0700
User-agent: Thunderbird



Paul Eggert wrote:
On 07/12/2018 02:16 AM, L A Walsh wrote:
    I'm asking why does 'ln' bother to tell the user that they are
wrong and do nothing useful?  Why not just go ahead and create a symlink

The user didn't ask for a symlink, and it sounds unwise for ln to be
second-guessing that. Sometimes, reporting an error and exiting is a
better thing to do.

Often in deciding whether it is good or not good to make a reasonable
attempt at completion factors are evaluated --  such as consequences
for trying or not trying and whether or not the user is running
interactively or not, and the likelihood of the possible solution being
what they wanted.

In this case, it seems they wanted some type of link created or they would not have used the link command. If they link was created as a symlink because hardlinks are not available, then they have solved their problem. If the link isn't created because hardlinks are not supported (even though they did not specify the link type (-P|-s) then ln would fail and they would need to redo the command. If they didn't want the link created, it would be unlikely they'd be using the 'ln' (link) command.
Only in the case that they wanted a link -- but only a hard link, would they 
need to remove it -- 'ln' would have failed to do the right thing.


I posit that they wouldn't need to create a hard link in a workable
solution -- they will need to find some other way to create a solution ( 
perhaps mounting the file).  However if they are not root, they won't be able 
to use that solution.  I would suggest that it would be unlikely that they 
would need a hard link there and they might change their mind and decide that a 
symlink is fine.


In all of the cases, given the probabilities, it would be most helpful and most 
useful to create *some link*, as that is what they asked for by using the 'ln' 
command.  Non of the outcomes require any more correction than undoing the 
incorrect action, but it is likely they would agree that a symbolic link was 
the right choice given that physical links are not
available.

You said "The user didn't ask for a symlink".  Neither did they hask
for a hardlink by using "-P'.  They wanted a link.  Creating the only
possible link would seem to be the best option available.

Indeed -- my focus was on creating a link -- that it had to be a symlink
was a bit of minutia that I didn't care much about.  If I had stated that
I wanted a physical link by specifying "-P" -- then I would not suggest
auto-creating the link -- only in the case where a link was asked for
without specification of type.

Frequently is is more user friendly to do something than do nothing (assuming 
doing something doesn't cause damage -- which is the case here.

-L.





reply via email to

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