[comp.unix.wizards] ln -f, POSIX requirements

djm@eng.umd.edu (David J. MacKenzie) (07/24/90)

POSIX.2 draft 9 requires that ln unlink unwritable existing
destination files before linking; it also requires a -i option to ask
first, and an -f option to unlink all existing destination files
before linking.  All of this was designed to make ln more consistent
with mv and cp.

The BSD ln's -f option has a completely different meaning -- allow
hard links to directories (what started this discussion), but only for
the superuser.  The SunOS 4.1 "System V" ln command has -f with the
POSIX meaning (almost -- it also suppresses error messages) and -F
with the BSD meaning.  The GNU ln follows POSIX, and has -d to allow
hard links to directories for the superusr, but I'm going to add -F as
a synonym for Sun compatibility in the next release.

--
David J. MacKenzie <djm@eng.umd.edu> <djm@ai.mit.edu>

decot@hpisod2.HP.COM (Dave Decot) (08/01/90)

> POSIX.2 draft 9 requires that ln unlink unwritable existing
> destination files before linking; it also requires a -i option to ask
> first, and an -f option to unlink all existing destination files
> before linking.  All of this was designed to make ln more consistent
> with mv and cp.

This has changed dramatically in Draft 10:

   The -i option has been dropped.

   The default is to ask.

   The -f option prevents the asking and forces removal to allow the new link.

So, ln is no longer as consistent with cp and mv (or with the long-standing
SVID behavior).

Part of the rationale for this change is that "It is preferable that ln
perform in the same manner as the link() function, which does not permit
the target to already exist."

Cp and mv were changed in various other ways as well, so that none of
them are consistent with each other or ln in their default behavior
with respect to existing files.

Dave Decot

gwyn@smoke.BRL.MIL (Doug Gwyn) (08/02/90)

In article <14020102@hpisod2.HP.COM> decot@hpisod2.HP.COM (Dave Decot) writes:
>Cp and mv were changed in various other ways as well, so that none of
>them are consistent with each other or ln in their default behavior
>with respect to existing files.

Oh, for Christ's sake!  If 1003.2 isn't going to standardize existing
practice, they could at least try to avoid conflicting with it!

decot@hpisod2.HP.COM (Dave Decot) (08/03/90)

> This has changed dramatically in Draft 10:
> 
  ...
>    The default is to ask.

Oops, this point is not true (my mistake).  Draft 10 ln never asks
permission to remove existing files (it just fails to make the link),
and has no option to request that behavior.

Sorry for any (added) confusion.

Dave Decot

andrew@alice.UUCP (Andrew Hume) (08/03/90)

i agree with doug; despite the fact that more than a few competent people
work very hard on P1003.2, the best i can hope for is that it won't be
a complete embarassment. it certainly isn't unix; it certainly isn't
like any unix i have used. in fact, it is less like unix than plan 9 is.
so guess what i am going to use.