How to prevent user's dotfiles from messing with BC jobs?

I have some users who made a ~/.bashrc that does not require an interactive shell and also activates anaconda. It appears that batch connect jobs inherit environment variables from a login shell. Is there a good way for me to prevent the user’s dotfiles from being run during the setup of a BC job?

I’m assuming that it’s a bad idea for me to nuke the environment:

for c in $(set | cut -d '=' -f 1); do unset $c; done

Unfortunately no, we see this a lot too, but haven’t yet done anything to patch the stuff upstream.

That said - you likely only need to modify the PATH, resetting it back to the system default, likely before you load any modules. It’s tricky, that’s why I think we haven’t put a lot of work into it -you need legit things like the module system to modify the PATH while still protecting yourself from this type of error.

As I type this out, the actual fix likely needs to come from us - some patch that resets the PATH when invoking the appropriate commands.

PATH="/bin:/usr/bin:..." vncserver 

Given that this happens to so many of us, I think it’s worth while for me to investigate it and try to get it into 3.1.