Subject: standards/3397: ufs returns EISDIR upon link(2) on VDIR
To: None <gnats-bugs@gnats.netbsd.org>
From: Klaus Klein <kleink@layla.inka.de>
List: netbsd-bugs
Date: 03/26/1997 13:50:37
>Number: 3397
>Category: standards
>Synopsis: UFS returns EISDIR upon link(2) to VDIR
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: gnats-admin (GNATS administrator)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Mar 26 10:05:03 1997
>Last-Modified:
>Originator: Klaus Klein
>Organization:
private site
>Release: 970325
>Environment:
[mi]
>Description:
IEEE Std 1003.1-1988 states that link(2) shall fail with
[EPERM] [...], or the implementation prohibits using link()
on directories.
link.2 does not reflect this point either. However, the standard fails
to cover file systems which do not support link(2) at all (i.e. msdos),
so it's unclear whether we should stick with EOPNOTSUPP in that case
or not.
Also, EMLINK is not documented.
>How-To-Repeat:
>Fix:
Index: lib/libc/sys/link.2
===================================================================
RCS file: /cvsroot/netbsd/src/lib/libc/sys/link.2,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -b -c -r1.1.1.1 -r1.1.1.1.2.1
*** link.2 1996/12/20 13:21:10 1.1.1.1
--- link.2 1997/03/26 12:43:28 1.1.1.1.2.1
***************
*** 113,123 ****
The link named by
.Fa name2
does exist.
.It Bq Er EPERM
The file named by
.Fa name1
is a directory and the effective
! user ID is not super-user.
.It Bq Er EXDEV
The link named by
.Fa name2
--- 113,130 ----
The link named by
.Fa name2
does exist.
+ .It Bq Er EMLINK
+ The link count of the underlying object pointed at by
+ .Fa name1
+ would exceed
+ .Dv {LINK_MAX}.
.It Bq Er EPERM
The file named by
.Fa name1
is a directory and the effective
! user ID is not super-user, or the file system does not support using
! .Fn link
! on directories.
.It Bq Er EXDEV
The link named by
.Fa name2
***************
*** 150,154 ****
.Sh STANDARDS
The
.Fn link
! function is expected to conform to
.St -p1003.1-88 .
--- 157,161 ----
.Sh STANDARDS
The
.Fn link
! function conforms to
.St -p1003.1-88 .
Index: sys/ufs/ufs/ufs_vnops.c
===================================================================
RCS file: /cvsroot/netbsd/src/sys/ufs/ufs/ufs_vnops.c,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.2.1
diff -b -c -r1.1.1.2 -r1.1.1.2.2.1
*** ufs_vnops.c 1997/01/31 18:45:31 1.1.1.2
--- ufs_vnops.c 1997/02/06 18:18:44 1.1.1.2.2.1
***************
*** 627,633 ****
#endif
if (vp->v_type == VDIR) {
VOP_ABORTOP(dvp, cnp);
! error = EISDIR;
goto out2;
}
if (dvp->v_mount != vp->v_mount) {
--- 627,633 ----
#endif
if (vp->v_type == VDIR) {
VOP_ABORTOP(dvp, cnp);
! error = EPERM;
goto out2;
}
if (dvp->v_mount != vp->v_mount) {
>Audit-Trail:
>Unformatted: