Skip to content

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

@Aramgutang

Description

@Aramgutang

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions