Hi,

if somebody wants to commit, ok schwarze@.

Otherwise, i'm accepting OKs.

See inline for a note on the history.

Yours,
  Ingo


Tristan Le Guern wrote on Mon, May 05, 2014 at 03:06:12PM +0200:

> This patch removes the undocumented ln flag -F, which forces the
> creation of a hard link for a directory.
> 
> This option was present since before the first revision of NetBSD CVS,
> 21 years ago: http://cvsweb.netbsd.org/bsdweb.cgi/src/bin/ln/ln.c
> I don't know where to dig for a more precise appearance date.

A -f flag with the semantics of today's (well... for old values
of today) -F first appeared in AT&T Version 7 UNIX (1979).

http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/ln.c

Keith Bostic renamed -f to -F in September 1990,
from the CSRG SCCS logs in bin/ln/SCCS/s.ln.c:

  s 00010/00010/00111
  d D 4.13 90/06/19 14:10:53 bostic 16 15
  c make -f option -F, S5 uses -f and POSIX is expected to.

So 4.3BSD-Tahoe still called the flag -f,
but since 4.3BSD-Reno, it is called -F.

> The problem is this option doesn't even work, the call to linkat(2)
> fails with EPERM. It's already removed in NetBSD and DragonFly. FreeBSD
> has an option with a similar name but a different meaning.

Index: ln.c
===================================================================
RCS file: /home/tleguern/proj/perso/cvs/src/bin/ln/ln.c,v
retrieving revision 1.19
diff -u -p -r1.19 ln.c
--- ln.c        12 Mar 2013 06:00:05 -0000      1.19
+++ ln.c        5 May 2014 11:23:56 -0000
@@ -42,7 +42,6 @@
 #include <string.h>
 #include <unistd.h>
 
-int    dirflag;                        /* Undocumented directory flag. */
 int    fflag;                          /* Unlink existing files. */
 int    hflag;                          /* Check new name for symlink first. */
 int    Pflag;                          /* Hard link to symlink. */
@@ -58,11 +57,8 @@ main(int argc, char *argv[])
        int ch, exitval;
        char *sourcedir;
 
-       while ((ch = getopt(argc, argv, "FfhLnPs")) != -1)
+       while ((ch = getopt(argc, argv, "fhLnPs")) != -1)
                switch (ch) {
-               case 'F':
-                       dirflag = 1;    /* XXX: deliberately undocumented. */
-                       break;
                case 'f':
                        fflag = 1;
                        break;
@@ -126,8 +122,8 @@ linkit(char *target, char *source, int i
                        warn("%s", target);
                        return (1);
                }
-               /* Only symbolic links to directories, unless -F option used. */
-               if (!dirflag && S_ISDIR(sb.st_mode)) {
+               /* Only symbolic links to directories. */
+               if (S_ISDIR(sb.st_mode)) {
                        errno = EISDIR;
                        warn("%s", target);
                        return (1);

Reply via email to