From af9cabec24c7f07bf2927df086a32adbda5f4431 Mon Sep 17 00:00:00 2001 From: Siteshwar Vashisht Date: Wed, 20 Jun 2018 12:32:37 +0200 Subject: [PATCH] Disable SHOPT_BASH macro by default SHOPT_BASH macro was disabled by default in ksh93u release, so keep it disabled. Related: #238 --- src/cmd/ksh93/meson.build | 1 - src/cmd/ksh93/sh/bash.c | 5 +++++ src/cmd/ksh93/sh/meson.build | 1 + src/cmd/ksh93/sh/xec.c | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cmd/ksh93/meson.build b/src/cmd/ksh93/meson.build index 93ca3492b4e9..b33b4123bf85 100644 --- a/src/cmd/ksh93/meson.build +++ b/src/cmd/ksh93/meson.build @@ -27,7 +27,6 @@ shared_c_args += [ '-D_BLD_shell', '-DERROR_CONTEXT_T=Error_context_t', '-DKSHELL', - '-DSHOPT_BASH', '-DSHOPT_COSHELL', '-DREAD_TIMEOUT=' + '@0@'.format(get_option('read-timeout')), '-DAUDIT_FILE=' + '"@0@"'.format(get_option('audit-file')), diff --git a/src/cmd/ksh93/sh/bash.c b/src/cmd/ksh93/sh/bash.c index f00738c5c4f5..65bc21cc736a 100644 --- a/src/cmd/ksh93/sh/bash.c +++ b/src/cmd/ksh93/sh/bash.c @@ -17,6 +17,9 @@ * David Korn * * * ***********************************************************************/ + +#ifdef SHOPT_BASH + // // Bash specific extensions. // Originally provided by Karsten Fleischer. @@ -415,3 +418,5 @@ void bash_init(Shell_t *shp, int mode) { if (xtrace) sh_offoption(shp, SH_XTRACE); if (verbose) sh_offoption(shp, SH_VERBOSE); } + +#endif // SHOPT_BASH diff --git a/src/cmd/ksh93/sh/meson.build b/src/cmd/ksh93/sh/meson.build index ab1bb169c242..c119b49e31e6 100644 --- a/src/cmd/ksh93/sh/meson.build +++ b/src/cmd/ksh93/sh/meson.build @@ -9,6 +9,7 @@ ksh93_files += [ 'sh/timers.c', 'sh/trestore.c', 'sh/waitevent.c', 'sh/xec.c' ] + shcomp_files += [ 'sh/args.c', 'sh/arith.c', 'sh/array.c', 'sh/defs.c', 'sh/deparse.c', 'sh/env.c', 'sh/expand.c', 'sh/fault.c', 'sh/fcin.c', 'sh/init.c', diff --git a/src/cmd/ksh93/sh/xec.c b/src/cmd/ksh93/sh/xec.c index f2cd4eaff65e..588a20170f2a 100644 --- a/src/cmd/ksh93/sh/xec.c +++ b/src/cmd/ksh93/sh/xec.c @@ -1745,6 +1745,7 @@ int sh_exec(Shell_t *shp, const Shnode_t *t, int flags) { sh_redirect(shp, t->fork.forkio, execflg); (t->fork.forktre)->tre.tretyp |= t->tre.tretyp & FSHOWME; t = t->fork.forktre; +#ifdef SHOPT_BASH if ((t->tre.tretyp & COMMSK) == TCOM && sh_isoption(shp, SH_BASH) && !sh_isoption(shp, SH_LASTPIPE)) { Shnode_t *tt = (Shnode_t *)stkalloc(shp->stk, sizeof(Shnode_t)); @@ -1752,6 +1753,7 @@ int sh_exec(Shell_t *shp, const Shnode_t *t, int flags) { tt->par.partre = (Shnode_t *)t; t = tt; } +#endif sh_exec(shp, t, flags & ~simple); } else { sfsync(shp->outpool);