[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bash -c reads /etc/profile despite --noprofile
From: |
Trammell Hudson |
Subject: |
bash -c reads /etc/profile despite --noprofile |
Date: |
Thu, 30 Apr 2015 18:37:14 +0000 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -I. -I.. -I../include -I../lib -g -O2
uname output: Linux hsthudson.aoa.twosigma.com 3.4.86-ts2 #3 SMP Wed Apr 9
03:28:16 GMT 2014 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu
Bash Version: 4.3
Patch Level: 30
Release Status: release
Description:
User and system profile files are executed even despite the --noprofile
or --norc flag to bash since execute_env_file() does not check the
no_profile global variable.
Repeat-By:
PS1="NONE" ./bash --noprofile -c 'echo $PS1'
Should output NONE, but instead outputs whatever /etc/profile sets it to.
Fix:
--- /tmp/bash-4.3.30/shell.c 2014-01-14 13:04:32.000000000 +0000
+++ ./build/bash-4.3.30/shell.c 2015-04-30 18:25:42.282810228 +0000
@@ -1010,7 +1010,7 @@
{
char *fn;
- if (env_file && *env_file)
+ if (no_profile == 0 && env_file && *env_file)
{
fn = expand_string_unsplit_to_string (env_file, Q_DOUBLE_QUOTES);
if (fn && *fn)
--
Trammell
- bash -c reads /etc/profile despite --noprofile,
Trammell Hudson <=