I noticed this in a failing tcsh regression test where it checks what happens when you try to execute a directory:
-testsuite.dir/177/subdir: Permission denied. +testsuite.dir/177/subdir: Is a directory. POSIX doesn't list EISDIR as a possible error for execve(). Instead: | [EACCES] | The new process image file is not a regular file and the | implementation does not support execution of files of its type. FreeBSD returns EACCES. NetBSD obviously, too. Ironically, the commit message for rev 1.9 of kern_exec.c says "Return EISDIR for directories; idea from NetBSD" but NetBSD backed this out again after a month (rev 1.80, 1.81 of their kern_exec.c). So, follow the herd and return EACCES for execve() on a directory. OK? Index: sys/kern/kern_exec.c =================================================================== RCS file: /cvs/src/sys/kern/kern_exec.c,v retrieving revision 1.210 diff -u -p -r1.210 kern_exec.c --- sys/kern/kern_exec.c 29 Nov 2019 06:34:45 -0000 1.210 +++ sys/kern/kern_exec.c 1 Dec 2019 12:12:50 -0000 @@ -125,10 +125,6 @@ check_exec(struct proc *p, struct exec_p epp->ep_vp = vp = ndp->ni_vp; /* check for regular file */ - if (vp->v_type == VDIR) { - error = EISDIR; - goto bad1; - } if (vp->v_type != VREG) { error = EACCES; goto bad1; Index: lib/libc/sys/execve.2 =================================================================== RCS file: /cvs/src/lib/libc/sys/execve.2,v retrieving revision 1.52 diff -u -p -r1.52 execve.2 --- lib/libc/sys/execve.2 29 Jul 2019 23:14:06 -0000 1.52 +++ lib/libc/sys/execve.2 1 Dec 2019 12:34:46 -0000 @@ -250,8 +250,6 @@ bytes. The new process file does not exist. .It Bq Er ELOOP Too many symbolic links were encountered in translating the pathname. -.It Bq Er EISDIR -The new process file is a directory. .It Bq Er EACCES Search permission is denied for a component of the path prefix. .It Bq Er EACCES -- Christian "naddy" Weisgerber na...@mips.inka.de