Index: kern_mib.c =================================================================== RCS file: /private/FreeBSD/src/sys/kern/kern_mib.c,v retrieving revision 1.71 diff -u -p -r1.71 kern_mib.c --- kern_mib.c 5 Apr 2004 21:03:34 -0000 1.71 +++ kern_mib.c 31 Oct 2004 09:12:21 -0000 @@ -76,6 +76,8 @@ SYSCTL_NODE(, CTL_P1003_1B, p1003_1b, SYSCTL_NODE(, OID_AUTO, compat, CTLFLAG_RW, 0, "Compatibility code"); +SYSCTL_NODE(_compat, OID_AUTO, unix, CTLFLAG_RW, 0, + "UNIX compatibility code"); SYSCTL_NODE(, OID_AUTO, security, CTLFLAG_RW, 0, "Security"); #ifdef REGRESSION Index: imgact_shell.c =================================================================== RCS file: /private/FreeBSD/src/sys/kern/imgact_shell.c,v retrieving revision 1.26 diff -u -p -r1.26 imgact_shell.c --- imgact_shell.c 11 Jun 2003 00:56:54 -0000 1.26 +++ imgact_shell.c 31 Oct 2004 09:27:02 -0000 @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD: src/sys/kern/imgact_ #include #include #include +#include #if BYTE_ORDER == LITTLE_ENDIAN #define SHELLMAGIC 0x2123 /* #! */ @@ -40,6 +41,12 @@ __FBSDID("$FreeBSD: src/sys/kern/imgact_ #define SHELLMAGIC 0x2321 #endif +SYSCTL_DECL(_compat_unix); +int interpreter_comment = 1; +SYSCTL_UINT(_compat_unix, OID_AUTO, interpreter_comment, CTLFLAG_RW, + &interpreter_comment, 0, + "Treat # as start of a comment in interpreter line."); + /* * Shell interpreter image activator. An interpreter name beginning * at imgp->stringbase is the minimal successful exit requirement. @@ -73,7 +80,8 @@ exec_shell_imgact(imgp) /* * Find end of line; return if the line > MAXSHELLCMDLEN long. */ - for (ihp = &image_header[2]; *ihp != '\n' && *ihp != '#'; ++ihp) { + for (ihp = &image_header[2]; + *ihp != '\n' && (!interpreter_comment || *ihp != '#'); ++ihp) { if (ihp >= &image_header[MAXSHELLCMDLEN]) return(ENAMETOOLONG); }