From 213fb932c073caa0849a2fac1aa705319cdb9fce Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Wed, 7 Oct 2020 03:36:54 +0200 Subject: [PATCH] Remove SH_NOLOG vestiges The '-o nolog' option (which prevented function definitions from being recorded in the history file) was removed a long time ago, leaving only a stub for backwards compatibility to stop 'set' from erroring out if the option is set. But some other vestiges remained. src/cmd/ksh93/sh/path.c, src/cmd/ksh93/sh/subshell.c, src/cmd/ksh93/sh/xec.c: - Remove a few pointless 'sh_onstate(SH_NOLOG)' statements. As of 93u+ or earlier, this is never checked for anywhere. src/cmd/ksh93/sh.1: - They forgot to remove the 'nolog' option documentation here. Specify that it's obsolete and has no effect. src/cmd/ksh93/data/builtins.c: sh_set[]: - Be more concise. --- src/cmd/ksh93/data/builtins.c | 3 +-- src/cmd/ksh93/sh.1 | 2 +- src/cmd/ksh93/sh/path.c | 1 - src/cmd/ksh93/sh/subshell.c | 1 - src/cmd/ksh93/sh/xec.c | 1 - 5 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/cmd/ksh93/data/builtins.c b/src/cmd/ksh93/data/builtins.c index 46130c91c..262ff4371 100644 --- a/src/cmd/ksh93/data/builtins.c +++ b/src/cmd/ksh93/data/builtins.c @@ -230,8 +230,7 @@ const char sh_set[] = "[+noclobber?Equivalent to \b-C\b.]" "[+noexec?Equivalent to \b-n\b.]" "[+noglob?Equivalent to \b-f\b.]" - "[+nolog?This has no effect. It is provided for backward " - "compatibility.]" + "[+nolog?Obsolete; has no effect.]" "[+notify?Equivalent to \b-b\b.]" "[+nounset?Equivalent to \b-u\b.]" "[+pipefail?A pipeline will not complete until all components " diff --git a/src/cmd/ksh93/sh.1 b/src/cmd/ksh93/sh.1 index ef222296c..b8cc46d8f 100644 --- a/src/cmd/ksh93/sh.1 +++ b/src/cmd/ksh93/sh.1 @@ -7062,7 +7062,7 @@ Same as .BR \-f . .TP 8 .B nolog -Do not save function definitions in the history file. +Obsolete; has no effect. .TP 8 .B notify Same as diff --git a/src/cmd/ksh93/sh/path.c b/src/cmd/ksh93/sh/path.c index 65b6330f7..68e68c3dd 100644 --- a/src/cmd/ksh93/sh/path.c +++ b/src/cmd/ksh93/sh/path.c @@ -610,7 +610,6 @@ static void funload(Shell_t *shp,int fno, const char *name) free((void*)pname); return; } - sh_onstate(SH_NOLOG); sh_onstate(SH_NOALIAS); shp->readscript = (char*)name; shp->st.filename = pname; diff --git a/src/cmd/ksh93/sh/subshell.c b/src/cmd/ksh93/sh/subshell.c index 45895a4c0..a9277b560 100644 --- a/src/cmd/ksh93/sh/subshell.c +++ b/src/cmd/ksh93/sh/subshell.c @@ -206,7 +206,6 @@ void sh_subfork(void) /* this is the child part of the fork */ /* setting subpid to 1 causes subshell to exit when reached */ sh_onstate(SH_FORKED); - sh_onstate(SH_NOLOG); sh_offoption(SH_MONITOR); sh_offstate(SH_MONITOR); subshell_data = 0; diff --git a/src/cmd/ksh93/sh/xec.c b/src/cmd/ksh93/sh/xec.c index 59e8d548d..11ca91cc9 100644 --- a/src/cmd/ksh93/sh/xec.c +++ b/src/cmd/ksh93/sh/xec.c @@ -2919,7 +2919,6 @@ pid_t _sh_fork(Shell_t *shp,register pid_t parent,int flags,int *jobid) shp->login_sh = 0; sh_offoption(SH_LOGIN_SHELL); sh_onstate(SH_FORKED); - sh_onstate(SH_NOLOG); if (shp->fn_reset) shp->fn_depth = shp->fn_reset = 0; #if SHOPT_ACCT