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

default bash environment setup only configures interactive shells #1447

Closed
dsheets opened this issue Jun 12, 2014 · 3 comments
Closed

default bash environment setup only configures interactive shells #1447

dsheets opened this issue Jun 12, 2014 · 3 comments

Comments

@dsheets
Copy link
Member

dsheets commented Jun 12, 2014

Right now, opam init -a --bash (well, not exactly, --bash doesn't exist) writes to ~/.bashrc if ~/.bash_profile doesn't exist. If the shell is unknown, ~/.profile is used.

The fundamental difference between ~/.bashrc and ~/.bash_profile/~/.profile is that the latter are run for all login shells whereas the former is run for interactive shells. The profile files usually execute ~/.bashrc but ~/.bashrc contains

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

usually near the top. Because opam appends its session configuration to the end of the interactive shell initialization, only interactive sessions are configured for opam.

This is painful when trying to use opam binaries via ssh like

ssh host "bash -l -c \"ocamlfind list\""

If ~/.bash_profile does not exist, should opam just create it? If ~/.profile exists, should opam just append its configuration to that?

Configuring for only interactive shells by default seems a little broken.

@AltGr
Copy link
Member

AltGr commented Jun 19, 2014

Agreed, it's not very convenient (whenever I try to run emacs from my window manager rather than from the shell, it'll complain about not finding ocp-indent stuff)...

However, shell startup configuration is a bit of a mess and we need to be very careful in this area: there is already some history, see #533. For example, it seems we should be very careful with adding a .bash_profile since the mere existence of this file may prevent .bash_login and .profile to be read (if I understand correctly...)

@AltGr AltGr added this to the outgoing milestone Jun 25, 2014
@AltGr AltGr closed this as completed Feb 3, 2015
@dsheets
Copy link
Member Author

dsheets commented Feb 3, 2015

Is ssh host "bash -l -c \"ocamlfind list\"" working now? Or impossible?

@AltGr
Copy link
Member

AltGr commented Feb 4, 2015

It should :)

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

3 participants