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

View File

@@ -1,5 +1,5 @@
#if defined(SHFLAGS_DEFNS)
__RCSID("$MirOS: src/bin/mksh/sh_flags.h,v 1.4 2009/10/02 18:08:37 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh_flags.h,v 1.5 2010/01/28 15:18:51 tg Exp $");
#define FN(sname,cname,ochar,flags) /* nothing */
#elif defined(SHFLAGS_ENUMS)
#define FN(sname,cname,ochar,flags) cname,
@@ -89,13 +89,16 @@ FN("nounset", FNOUNSET, 'u', OF_ANY)
/* ./. don't do logical cds/pwds (non-standard) */
FN("physical", FPHYSICAL, 0, OF_ANY)
/* ./. pdksh compat: somewhat more POSIXish mode (non-standard) */
FN("posix", FPOSIX, 0, OF_ANY)
/* -p use suid_profile; privileged shell */
FN("privileged", FPRIVILEGED, 'p', OF_ANY)
/* -r restricted shell */
FN("restricted", FRESTRICTED, 'r', OF_CMDLINE)
/* ./. called as sh (some POSIX, some kludgy) not mksh (non-standard) */
/* ./. pdksh compat: called as sh not mksh; kludge mode (non-standard) */
FN("sh", FSH, 0, OF_ANY)
/* -s (invocation) parse stdin (pseudo non-standard) */