[MacPorts] #46019: Bash completion fails when in tmux or screen
#46019: Bash completion fails when in tmux or screen -----------------------+-------------------------------- Reporter: audvare@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.3 Keywords: | Port: -----------------------+-------------------------------- Using Terminal.app, bash-completion works without using tmux. I have `. /opt/local/etc/profile.d/bash_completion.sh` in `~/.bashrc`. Terminal.app shell is set to `/opt/local/bin/bash -l` and I have Bash installed from MacPorts. When I run `screen` or `tmux`, Bash completion stops working. Tried with no `~/.tmux.conf` and same effect. I do not have an rc for screen. Steps to reproduce: 1. `port install bash coreutils tmux bash-completion` 2. `. /opt/local/etc/profile.d/bash_completion.sh` 3. Be sure `ls --`<tab> works 4. `tmux` 5. Try `ls --`<tab> -- Ticket URL: <https://trac.macports.org/ticket/46019> MacPorts <https://www.macports.org/> Ports system for OS X
#46019: Bash completion fails when in tmux or screen ------------------------------+---------------------- Reporter: audvare@… | Owner: raimue@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.3 Resolution: | Keywords: Port: bash-completion | ------------------------------+---------------------- Changes (by larryv@…): * cc: raimue@… (removed) * owner: macports-tickets@… => raimue@… * port: => bash-completion -- Ticket URL: <https://trac.macports.org/ticket/46019#comment:1> MacPorts <https://www.macports.org/> Ports system for OS X
#46019: Bash completion fails when in tmux or screen ------------------------------+---------------------- Reporter: audvare@… | Owner: raimue@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.3 Resolution: | Keywords: Port: bash-completion | ------------------------------+---------------------- Comment (by audvare@…): So it appears tmux and screen are invoking Bash differently, or a different (the system Bash?). If I use this: {{{ sudo dscl . -change /Users/tatsh UserShell /bin/bash /opt/local/bin/bash }}} I get what I want. However, I am not so sure this is really a good idea. If I need to re-build completely, at some point I may lose a working shell and I am not sure if OS X is just going to default to another one. -- Ticket URL: <https://trac.macports.org/ticket/46019#comment:2> MacPorts <https://www.macports.org/> Ports system for OS X
#46019: Bash completion fails when in tmux or screen ------------------------------+---------------------- Reporter: audvare@… | Owner: raimue@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.3 Resolution: | Keywords: Port: bash-completion | ------------------------------+---------------------- Comment (by audvare@…): I'm semi-okay with the 'fix' for now an decided to change my shell using the `dscl` command. However, if there is a cleaner way to do this (and not symlinking /bin/bash to MacPorts' version), I am all ears. -- Ticket URL: <https://trac.macports.org/ticket/46019#comment:3> MacPorts <https://www.macports.org/> Ports system for OS X
#46019: Bash completion fails when in tmux or screen ------------------------------+---------------------- Reporter: audvare@… | Owner: raimue@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.3 Resolution: | Keywords: Port: bash-completion | ------------------------------+---------------------- Comment (by larryv@…): OS X would not default to another shell, but it wouldn’t roll over and die, either. It’s trivial to change your Terminal settings to point to a different shell, or to run a shell using `Shell > New Command…`. If you’re still not comfortable with this for some reason, you can set `default-shell` in your `.tmux.conf` to whatever you please. -- Ticket URL: <https://trac.macports.org/ticket/46019#comment:4> MacPorts <https://www.macports.org/> Ports system for OS X
#46019: Bash completion fails when in tmux or screen ------------------------------+---------------------- Reporter: audvare@… | Owner: raimue@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.3 Resolution: | Keywords: Port: bash-completion | ------------------------------+---------------------- Comment (by cal@…): No need to go all `dscl` on this; the `chsh` utility does the same job without fiddling with directory services internals. To find out whether you're getting the system bash, use `echo $BASH_VERSION`. If it's 3.x, that's your explanation for non-functional bash completion. I assume tmux and screen just invoke the `login` binary to start a session and a shell, and that starts whatever the user's default shell is, which is why you're seeing this behaviour. You might be able to change that if you configure screen or tmux to not use the login command but rather start a shell directly. -- Ticket URL: <https://trac.macports.org/ticket/46019#comment:5> MacPorts <https://www.macports.org/> Ports system for OS X
#46019: Bash completion fails when in tmux or screen ------------------------------+---------------------- Reporter: audvare@… | Owner: raimue@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.3 Resolution: | Keywords: Port: bash-completion | ------------------------------+---------------------- Comment (by raimue@…): tmux uses various ways to determine the shell to start, see the tmux(1) man page at the description of the `default-shell` option. However, also note your `.bashrc` will never be read by a login shell, as bash executed as a login shell only evaluates `.bash_profile`. It is up to your own configuration to either `source .bashrc` from within `.bash_profile`, or copy the same instructions you currently use in your `.bashrc` also to your `.bash_profile`. This is explained in detail in the section `INVOCATION` in the bash(1) man page. Unfortunately, I don't think there is much we can do about these peculiarities. Explaining all that in a note of the port would be too much information for most users. Maybe we could add some bits about `default-shell` for tmux in the additional documentation at [wiki:howto/bash-completion] and link to that from the notes. -- Ticket URL: <https://trac.macports.org/ticket/46019#comment:6> MacPorts <https://www.macports.org/> Ports system for OS X
#46019: Bash completion fails when in tmux or screen ------------------------------+---------------------- Reporter: audvare@… | Owner: raimue@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.3 Resolution: | Keywords: Port: bash-completion | ------------------------------+---------------------- Comment (by audvare@…): I opted to use tmux's `default-shell` option and that works for me. I was going to say that having a message to change the shell or noting that some changes are necessary to the port notice but updating the Wiki is good too (`default-shell`, `chsh`, etc). Resolution to this ticket, to me, is documentation. I do not know if screen has an equivalent to `default-shell`, or any others. -- Ticket URL: <https://trac.macports.org/ticket/46019#comment:7> MacPorts <https://www.macports.org/> Ports system for OS X
#46019: Bash completion fails when in tmux or screen ------------------------------+---------------------- Reporter: audvare@… | Owner: raimue@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.3 Resolution: | Keywords: Port: bash-completion | ------------------------------+---------------------- Comment (by raimue@…): For screen, you need to set `shell /opt/local/bin/bash` in your `.screenrc`. Or export `SHELL=/opt/local/bin/bash` in the environment, which is respected by both tmux and screen. -- Ticket URL: <https://trac.macports.org/ticket/46019#comment:8> MacPorts <https://www.macports.org/> Ports system for OS X
#46019: Bash completion fails when in tmux or screen ------------------------------+---------------------- Reporter: audvare@… | Owner: raimue@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.3.3 Resolution: fixed | Keywords: Port: bash-completion | ------------------------------+---------------------- Changes (by raimue@…): * status: new => closed * resolution: => fixed Comment: Documented now in the HOWTO: http://trac.macports.org/wiki/howto/bash- completion?action=diff&version=9&old_version=8 -- Ticket URL: <https://trac.macports.org/ticket/46019#comment:9> MacPorts <https://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts