diff --git a/SOURCES/bash-5.0-syslog-history.patch b/SOURCES/bash-5.0-syslog-history.patch new file mode 100644 index 0000000..e5fe25e --- /dev/null +++ b/SOURCES/bash-5.0-syslog-history.patch @@ -0,0 +1,84 @@ +diff --git a/bashhist.c b/bashhist.c +index 9979f99..793c81f 100644 +--- a/bashhist.c ++++ b/bashhist.c +@@ -754,6 +754,12 @@ extern char *shell_name; + #define OPENLOG_OPTS 0 + #endif + ++#if defined (SYSLOG_SHOPT) ++int syslog_history = SYSLOG_SHOPT; ++#else ++int syslog_history = 1; ++#endif ++ + void + bash_syslog_history (line) + const char *line; +@@ -851,7 +857,8 @@ bash_add_history (line) + really_add_history (line); + + #if defined (SYSLOG_HISTORY) +- bash_syslog_history (line); ++ if (syslog_history) ++ bash_syslog_history (line); + #endif + + using_history (); +diff --git a/builtins/shopt.def b/builtins/shopt.def +index 2febb7e..38c398e 100644 +--- a/builtins/shopt.def ++++ b/builtins/shopt.def +@@ -118,6 +118,10 @@ extern char *shell_name; + extern int debugging_mode; + #endif + ++#if defined (SYSLOG_HISTORY) && defined (SYSLOG_SHOPT) ++extern int syslog_history; ++#endif ++ + static void shopt_error __P((char *)); + + static int set_shellopts_after_change __P((char *, int)); +@@ -223,6 +227,9 @@ static struct { + #endif + { "shift_verbose", &print_shift_error, (shopt_set_func_t *)NULL }, + { "sourcepath", &source_uses_path, (shopt_set_func_t *)NULL }, ++#if defined (SYSLOG_HISTORY) && defined (SYSLOG_SHOPT) ++ { "syslog_history", &syslog_history, (shopt_set_func_t *)NULL }, ++#endif + { "xpg_echo", &xpg_echo, (shopt_set_func_t *)NULL }, + { (char *)0, (int *)0, (shopt_set_func_t *)NULL } + }; +diff --git a/config-top.h b/config-top.h +index cb0e002..39cf6b5 100644 +--- a/config-top.h ++++ b/config-top.h +@@ -122,6 +122,13 @@ + # define OPENLOG_OPTS LOG_PID + #endif + ++/* Define if you want syslogging history to be controllable at runtime via a ++ shell option; if defined, the value is the default for the syslog_history ++ shopt option */ ++#if defined (SYSLOG_HISTORY) ++#define SYSLOG_SHOPT 0 ++#endif ++ + /* Define if you want to include code in shell.c to support wordexp(3) */ + /* #define WORDEXP_OPTION */ + +diff --git a/doc/bash.1 b/doc/bash.1 +index d6cee1d..9dfa0b3 100644 +--- a/doc/bash.1 ++++ b/doc/bash.1 +@@ -9889,6 +9889,9 @@ If set, the + to find the directory containing the file supplied as an argument. + This option is enabled by default. + .TP 8 ++.B syslog_history ++If set, command history is logged to syslog. ++.TP 8 + .B xpg_echo + If set, the \fBecho\fP builtin expands backslash-escape sequences + by default. diff --git a/SPECS/bash.spec b/SPECS/bash.spec index bce5680..52d1dca 100644 --- a/SPECS/bash.spec +++ b/SPECS/bash.spec @@ -7,7 +7,7 @@ Version: %{baseversion}%{patchleveltag} Name: bash Summary: The GNU Bourne Again shell -Release: 8%{?dist} +Release: 10%{?dist} License: GPLv3+ Url: https://www.gnu.org/software/bash Source0: https://ftp.gnu.org/gnu/bash/bash-%{baseversion}.tar.gz @@ -95,6 +95,10 @@ Patch131: bash-4.4-case-in-command-subst.patch Patch132: bash-4.4-coverity.patch +# 1687835 - [RFE] Add a runtime option to enable history logging to syslog +# This should be dropped while rebasing to bash-5.0 +Patch133: bash-5.0-syslog-history.patch + # 1727952 - Parsing commands break when using $$ in command substitution $(..) # https://lists.gnu.org/archive/html/bug-bash/2017-01/msg00065.html Patch134: bash-5.0-shellpid-subshell.patch @@ -143,7 +147,7 @@ autoconf # Recycles pids is neccessary. When bash's last fork's pid was X # and new fork's pid is also X, bash has to wait for this same pid. # Without Recycles pids bash will not wait. -make "CPPFLAGS=-D_GNU_SOURCE -DRECYCLES_PIDS -DDEFAULT_PATH_VALUE='\"/usr/local/bin:/usr/bin\"' `getconf LFS_CFLAGS`" %{?_smp_mflags} +make "CPPFLAGS=-D_GNU_SOURCE -DRECYCLES_PIDS -DDEFAULT_PATH_VALUE='\"/usr/local/bin:/usr/bin\"' `getconf LFS_CFLAGS` -DSYSLOG_HISTORY" %{?_smp_mflags} %install if [ -e autoconf ]; then @@ -322,10 +326,18 @@ end %{_libdir}/pkgconfig/%{name}.pc %changelog -* Wed Jul 10 2019 Siteshwar Vashisht - 4.4.19-8 +* Thu Aug 22 2019 Siteshwar Vashisht - 4.4.19-10 +- Fix runtime option to enable history logging to syslog + Related: #1687835 + +* Wed Jul 10 2019 Siteshwar Vashisht - 4.4.19-9 - Fix `$$` expansion in subshell Resolves: #1727952 +* Mon May 27 2019 Siteshwar Vashisht - 4.4.19-8 +- Add a runtime option to enable history logging to syslog + Resolves: #1687835 + * Mon Jan 14 2019 Siteshwar Vashisht - 4.4.19-7 - Bump version number Resolves: #1650059