Problem in Files terminal with iTerm2 2.9 beta shell integration (Files v 1.0.9)

Questions, glitches, bugs and crashes
Locked
achekulaev
Posts: 50
Joined: Sat Jul 25, 2015 1:04 am

Problem in Files terminal with iTerm2 2.9 beta shell integration (Files v 1.0.9)

Post by achekulaev » Wed Sep 02, 2015 1:53 am

In Files terminal

Image

In regular terminal

Image
Last edited by achekulaev on Fri Sep 04, 2015 3:22 pm, edited 3 times in total.

User avatar
mike
Posts: 1060
Joined: Thu Jul 16, 2015 5:35 am
Location: Exeter, UK

Re: Weird stuff in terminals with PS1 (v 1.0.9)

Post by mike » Fri Sep 04, 2015 8:38 am

Not sure what PS1 is. Can you explain it a bit?

achekulaev
Posts: 50
Joined: Sat Jul 25, 2015 1:04 am

Re: Weird stuff in terminals with PS1 (v 1.0.9)

Post by achekulaev » Fri Sep 04, 2015 3:18 pm

$PS1 is an environment variable in bash that defines how bash prompt looks like. It can be customized in .bashrc or .bash_profile
For details see: http://www.thegeekstuff.com/2008/09/bas ... ina-jolie/

I thought that my recent customizations to this variable caused this problem in Files. But I found out it's something else.

The issue is being caused by iTerm2 shell integration introduced in iTerm2.9 beta (https://www.iterm2.com/version3.html).
Here is the customization file itself (a shell script that gets included in .bash_profile and provides some cool stuff in iTerm2) https://gist.github.com/achekulaev/c1e15a1ed39e60905a6a

You can test it by saving file from Gist as ~/.iterm2_shell_integration.bash and then including in your .bash_profile like this:

Code: Select all

test -e ${HOME}/.iterm2_shell_integration.bash && source ${HOME}/.iterm2_shell_integration.bash
You'll notice it doesn't cause problems in regular Terminal.app.
If I comment out this integration in my .bash_profile then terminal in Files doesn't show that weird stuff.

I see warnings at the beginning of that script.
Maybe they will give you some clues why this integration is causing problems in Files but not anywhere else
I'm guessing you might be overriding either "DEBUG" trap or "PROMPT_COMMAND" variable

Code: Select all

# Note: this module requires 2 bash features which you must not otherwise be
# using: the "DEBUG" trap, and the "PROMPT_COMMAND" variable.  iterm2_preexec_install
# will override these and if you override one or the other this _will_ break.

# This is known to support bash3, as well as *mostly* support bash2.05b.  It
# has been tested with the default shells on MacOS X 10.4 "Tiger", Ubuntu 5.10
# "Breezy Badger", Ubuntu 6.06 "Dapper Drake", and Ubuntu 6.10 "Edgy Eft".
p.s. I have changed topic name to reflect my investigations

User avatar
mike
Posts: 1060
Joined: Thu Jul 16, 2015 5:35 am
Location: Exeter, UK

Re: Problem in Files terminal with iTerm2 2.9 beta shell integration (Files v 1.0.9)

Post by mike » Fri Sep 11, 2015 7:59 am

achekulaev, sorry for a late reply.
Your investigations are absolutely right - Files uses "PROMPT_COMMAND" of Bash to know it's current directory and to receive signals when that path changes. Without such feedback an integration between Bash and Files would be much weaker.
This approach is somewhat based on MC's one - it uses the same mechanism.

Locked