fix obscure macOS issue where the Apple locale is set to something setlocale(3) doesn't understand; don't source .bash_logout if the shell is running setuid; fix for macOS issue with pipe size throttling and here-documents

This commit is contained in:
Chet Ramey
2026-07-14 09:29:04 -04:00
parent 0e16a4e4b1
commit 03e7298d1e
24 changed files with 2806 additions and 2336 deletions
+16
View File
@@ -211,6 +211,9 @@ static int act_like_sh;
/* Non-zero if we have already expanded and sourced $ENV. */
static int sourced_env;
/* Non-zero if we have already sourced ~/.bash_logout. */
static int sourced_logout;
/* Is this shell running setuid? */
static int running_setuid;
@@ -1250,6 +1253,19 @@ run_startup_files (void)
#endif
}
void
bash_logout (void)
{
/* Run our `~/.bash_logout' file if it exists, and this is a login shell. */
if (login_shell && sourced_logout++ == 0 && subshell_environment == 0 && running_setuid == 0)
{
maybe_execute_file ("~/.bash_logout", 1);
#ifdef SYS_BASH_LOGOUT
maybe_execute_file (SYS_BASH_LOGOUT, 1);
#endif
}
}
#if defined (RESTRICTED_SHELL)
/* Return 1 if the shell should be a restricted one based on NAME or the
value of `restricted'. Don't actually do anything, just return a