Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running bash with --norc and --noprofile in bash.sh creates more problems than it solves #15

Open
Aramgutang opened this issue May 2, 2018 · 1 comment

Comments

@Aramgutang
Copy link
Member

The call to bash --norc --noprofile here is a bit of half-measure that gives us worst of both worlds:

exec bash --norc --noprofile

Even though .bashrc and .bash_profile aren't loaded, any environment variables that were already set by them using export will still persist, so it's not really doing much to prevent "clashing with our paths". Specifically, the PATH value is persisted.

In my case, when running locally, this keeps all my variables, but removes useful things like alias ll="ls -la" and bind 'set completion-map-case on'. Most importantly, I have a custom PROMPT_COMMAND set to a local function, and while the PROMPT_COMMAND variable persists, the local function it refers to doesn't, so I get annoying errors after any command I run.

The proper way of running in a clean environment is env -i. This discards everything previously set by export. However, it comes with caveats of its own. It can't be used in bash.sh, because it will discard all the variables set by the previous links in the script chain, so it needs to be run at the very start of the entrypoint. But even that will end up discarding environment variables set by Docker Cloud, most importantly TRANSCRYPT_PASSWORD.

So in conclusion, I'd like for this line to be removed, and am seeking arguments to the contrary here.

@mrmachine
Copy link
Collaborator

@Aramgutang I don't remember the conflict that prompted that change, but I'd love it if we could enter a subshell of the same type and config as go.sh is launched with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants