- expand_string_dollar_quote: if singlequote_translations is set, there
is a chance for a use-after-free of `t'.
From a report by Grisha Levit <grishalevit@gmail.com>
+
+ 6/7
+ ---
+jobs.c,nojobs.c,jobs.h
+ - job_control_active_p: new function, returns 1 if job control is
+ currently enabled and we have given away the terminal
+
+builtins/evalstring.c
+ - should_suppress_fork: don't optimize away the fork if job control is
+ active because we need to call end_job_control and give the terminal
+ back to the original process group when this command finishes. Call
+ job_control_active_p() to check this.
+ Report from Andrew Hamon <and.ham95@gmail.com>
+
+ 6/8
+ ---
+shell.c
+ - ssh_run_startup_files: new variable, set by run_startup_files if
+ the shell decides it's being run by ssh and runs bashrc (only if
+ SSH_SOURCE_BASHRC is defined). Non-zero while the startup files
+ are being run. Not used by any other part of the shell yet.
return (startup_state == 2 && parse_and_execute_level == 1 &&
*bash_input.location.string == '\0' &&
parser_expanding_alias () == 0 &&
+ job_control_active_p () == 0 &&
should_optimize_fork (command, subshell));
}
shell_pgrp = original_pgrp;
}
+int
+job_control_active_p (void)
+{
+ return (job_control && original_pgrp != shell_pgrp && shell_pgrp == terminal_pgrp);
+}
+
/* Restart job control by closing shell tty and reinitializing. This is
called after an exec fails in an interactive shell and we do not exit. */
void
extern void ignore_tty_job_signals (void);
extern void default_tty_job_signals (void);
extern void get_original_tty_job_signals (void);
+extern int job_control_active_p (void);
extern void init_job_stats (void);
#include <ctype.h>
/* System-specific feature definitions and include files. */
-#include "rldefs.h"
#include "rlmbutil.h"
+#include "rldefs.h"
#if defined (TIOCSTAT_IN_SYS_IOCTL)
# include <sys/ioctl.h>
{
return 0;
}
+
+int
+job_control_active_p (void)
+{
+ return 0;
+}
int startup_state = 0;
int reading_shell_script = 0;
+int ssh_reading_startup_files = 0;
+
/* Special debugging helper. */
int debugging_login_shell = 0;
if (isnetconn (fileno (stdin) && shell_level < 2)
#endif
{
+ ssh_reading_startup_files = 1;
#ifdef SYS_BASHRC
# if defined (__OPENNT)
maybe_execute_file (_prefixInstallPath(SYS_BASHRC, NULL, 0), 1);
# endif
#endif
maybe_execute_file (bashrc_file, 1);
+ ssh_reading_startup_files = 0;
return;
}
}
extern int interactive, interactive_shell;
extern int startup_state;
extern int reading_shell_script;
+extern int ssh_reading_startup_files;
extern int shell_initialized;
extern int bash_argv_initialized;
extern int subshell_environment;