To solve the incompatibility issues between mksh-current, old mksh versions

and vendor pdksh versions, re-introduce FPOSIX alongside FSH. The semantics
are now:
‣ set -o posix ⇒
  • disable brace expansion and FSH when triggered
  • use Debian Policy 10.4 compliant non-XSI “echo” builtin
  • do not keep file descriptors > 2 to ksh
‣ set -o sh ⇒
  • set automatically #ifdef MKSH_BINSHREDUCED
  • disable brace expansion and FPOSIX when triggered
  • use Debian Policy 10.4 compliant non-XSI “echo” builtin
  • do not keep file descriptors > 2 to ksh
  • trigger MKSH_MIDNIGHTBSD01ASH_COMPAT mode if compiled in
  • make “set -- $(getopt ab:c "$@")” construct work

Note that the set/getopt one used to behave POSIXly only with FSH or
FPOSIX (depending on the mksh version) set and Bourne-ish with it not
set, so this changes default mksh behaviour to POSIX!
This commit is contained in:
tg
2010-01-28 15:18:51 +00:00
parent 17b04f3879
commit 0c94277ccb
6 changed files with 68 additions and 45 deletions

7
misc.c
View File

@@ -29,7 +29,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.136 2010/01/25 14:07:39 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.137 2010/01/28 15:18:49 tg Exp $");
unsigned char chtypes[UCHAR_MAX + 1]; /* type bits for unsigned char */
@@ -232,8 +232,9 @@ change_flag(enum sh_flag f, int what, unsigned int newval)
setegid(kshegid = kshgid = getgid());
setgid(kshegid);
#endif
} else if (f == FSH && newval) {
Flag(FBRACEEXPAND) = 0;
} else if ((f == FPOSIX || f == FSH) && newval) {
Flag(FPOSIX) = Flag(FSH) = Flag(FBRACEEXPAND) = 0;
Flag(f) = (unsigned char)newval;
}
/* Changing interactive flag? */
if (f == FTALKING) {