• change mksh to only then behave more POSuXish when called as /bin/sh or

“-sh” if -DMKSH_BINSHREDUCED was passed during compilation, for example
  for Debian, but d̲e̲f̲i̲n̲i̲t̲i̲v̲e̲l̲y̲ n̲̲o̲̲t̲̲ for MirBSD™
• split up regression test to force this behaviour
• remove the gunk from our MirBSD™ startup scripts again
• mention arc4random.c changes on website, sync clog, warn packagers
This commit is contained in:
tg
2008-10-20 19:29:25 +00:00
parent 2fc9fb99d7
commit 0c2de1902c
5 changed files with 45 additions and 13 deletions

View File

@@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.354 2008/10/10 21:57:16 tg Exp $' srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.355 2008/10/20 19:29:22 tg Exp $'
#- #-
# Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS # Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI # CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI
# MKSH_CLS_STRING MKSH_AFREE_DEBUG # MKSH_CLS_STRING MKSH_AFREE_DEBUG MKSH_BINSHREDUCED
LC_ALL=C LC_ALL=C
export LC_ALL export LC_ALL
@@ -838,6 +838,15 @@ ac_testn mksh_full '' "if a full-featured mksh is requested" <<-'EOF'
int main(void) { return (0); } int main(void) { return (0); }
#endif #endif
EOF EOF
ac_testn mksh_reduced mksh_full 0 "if a reduced-feature sh is requested" <<-'EOF'
#ifdef MKSH_BINSHREDUCED
/* force a success: we want a reduced mksh-as-bin-sh */
int main(void) { return (0); }
#else
/* force a failure: we want a full mksh, always */
int main(void) { return (thiswillneverbedefinedIhope()); }
#endif
EOF
if test 0 = $HAVE_MKSH_FULL; then if test 0 = $HAVE_MKSH_FULL; then
if test $ct = xlc; then if test $ct = xlc; then
@@ -849,6 +858,9 @@ if test 0 = $HAVE_MKSH_FULL; then
: ${HAVE_MKNOD=0} : ${HAVE_MKNOD=0}
check_categories=$check_categories,smksh check_categories=$check_categories,smksh
fi fi
if test 1 = $HAVE_MKSH_REDUCED; then
check_categories=$check_categories,binsh
fi
# #
# Environment: headers # Environment: headers

27
check.t
View File

@@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.232 2008/10/19 20:15:42 tg Exp $ # $MirOS: src/bin/mksh/check.t,v 1.233 2008/10/20 19:29:23 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@@ -7,7 +7,7 @@
# http://www.research.att.com/~gsf/public/ifs.sh # http://www.research.att.com/~gsf/public/ifs.sh
expected-stdout: expected-stdout:
@(#)MIRBSD KSH R35 2008/10/19 @(#)MIRBSD KSH R35 2008/10/20
description: description:
Check version of shell. Check version of shell.
stdin: stdin:
@@ -4273,10 +4273,29 @@ expected-stdout:
posix posix
brex brex
--- ---
name: posix-mode-2 name: posix-mode-2a
description:
Check that posix mode is *not* automatically turned on
category: !binsh
stdin:
ln -s "$__progname" ksh
ln -s "$__progname" sh
ln -s "$__progname" ./-ksh
ln -s "$__progname" ./-sh
for shell in {,-}{,k}sh; do
print -- $shell $(./$shell +l -c \
'[[ $(set +o) == *@(-o posix)@(| *) ]] && echo posix || echo noposix')
done
expected-stdout:
sh noposix
ksh noposix
-sh noposix
-ksh noposix
---
name: posix-mode-2b
description: description:
Check that posix mode is automatically turned on Check that posix mode is automatically turned on
category: !smksh category: binsh
stdin: stdin:
ln -s "$__progname" ksh ln -s "$__progname" ksh
ln -s "$__progname" sh ln -s "$__progname" sh

4
main.c
View File

@@ -13,7 +13,7 @@
#include <locale.h> #include <locale.h>
#endif #endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.103 2008/10/15 10:25:01 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/main.c,v 1.104 2008/10/20 19:29:23 tg Exp $");
extern char **environ; extern char **environ;
@@ -173,7 +173,7 @@ main(int argc, const char *argv[])
Flag(FVITABCOMPLETE) = 1; Flag(FVITABCOMPLETE) = 1;
#endif #endif
#ifndef MKSH_SMALL #ifdef MKSH_BINSHREDUCED
/* Set FPOSIX if we're called as -sh or /bin/sh or so */ /* Set FPOSIX if we're called as -sh or /bin/sh or so */
{ {
const char *cc; const char *cc;

7
mksh.1
View File

@@ -1,4 +1,4 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.141 2008/10/19 20:15:44 tg Exp $ .\" $MirOS: src/bin/mksh/mksh.1,v 1.142 2008/10/20 19:29:24 tg Exp $
.\" $OpenBSD: ksh.1,v 1.122 2008/05/17 23:31:52 sobrado Exp $ .\" $OpenBSD: ksh.1,v 1.122 2008/05/17 23:31:52 sobrado Exp $
.\"- .\"-
.\" Try to make GNU groff and AT&T nroff more compatible .\" Try to make GNU groff and AT&T nroff more compatible
@@ -30,7 +30,7 @@
.el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 .el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
.. ..
.\"- .\"-
.Dd $Mdocdate: October 19 2008 $ .Dd $Mdocdate: October 20 2008 $
.Dt MKSH 1 .Dt MKSH 1
.Os MirBSD .Os MirBSD
.Sh NAME .Sh NAME
@@ -3586,7 +3586,8 @@ commands above for more details.
.It Ic posix .It Ic posix
Enable POSIX mode. Enable POSIX mode.
Automatically enabled if the basename of the shell invocation begins with Automatically enabled if the basename of the shell invocation begins with
.Dq sh . .Dq sh
and this autodetection feature was requested at compilation time.
As a side effect, setting this flag turns off As a side effect, setting this flag turns off
.Ic braceexpand .Ic braceexpand
mode, which can be turned back on manually. mode, which can be turned back on manually.

4
sh.h
View File

@@ -100,9 +100,9 @@
#define __SCCSID(x) __IDSTRING(sccsid,x) #define __SCCSID(x) __IDSTRING(sccsid,x)
#ifdef EXTERN #ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.242 2008/10/19 20:15:45 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.243 2008/10/20 19:29:25 tg Exp $");
#endif #endif
#define MKSH_VERSION "R35 2008/10/19" #define MKSH_VERSION "R35 2008/10/20"
#ifndef MKSH_INCLUDES_ONLY #ifndef MKSH_INCLUDES_ONLY