Subject: Re: bug#52115: Suggestion: LN command should swap TARGET and LINK_NAME if LINK_NAME already exists

From: Bernhard Voelker <[email-masked]>
Date: Fri, 26 Nov 2021 00:32:01 +0100

On 11/26/21 00:10, Warren Parad wrote:
> On Fri, Nov 26, 2021 at 12:02 AM Bernhard Voelker <[email-masked] <mailto:[email-masked]>> wrote:
>> The synopsis is already complex and confusing enough:
>
> Opinion, it is as complex as it allows, sounds like you are saying "LN Sucks, we really need 4 commands
> which are all simpler", sure okay we can have another command, but doing the right thing ALWAYS takes
> precedence over "I have an opinion".

That is my opinion, correct.
Yet there's also standardization (POSIX) and 40+ years of known behavior.  Adding functionality has to be
well-thought and must not contradict any existing usage, nor open doors for more surprises to users.
Finally, there's compatibility to other implementations to consider.

>> what happens if another (malicious?) user B creates LINK_TARGET while user A is typing the command?
>
> While typing before entering? Then it doesn't matter if they are reversed since the command would still fail because
> both exist, that should result in the only real failure. I'm not suggesting removing the error in all cases.

That's the point: the outcome would greatly depend on whether LINK_TARGET is created as regular file
or as a directory.  And no, one cannot predict when another process is modifying the file system.
IMO this is more surprising and therefore inconvenient than to get an error message if the
user missed to put TARGET and LINK_NAME in the correct order.

Have a nice day,
Berny