Skip to content

Commit

Permalink
unexport PROMPT_COMMAND (GH liquidprompt#450, liquidprompt#463)
Browse files Browse the repository at this point in the history
Some users have a broken .bashrc that exports PROMPT_COMMAND. In this
configuration _lp_set_prompt is in PROMPT_COMMAND when liquidprompt starts so
prompt_on puts it in LP_OLD_PROMPT_COMMAND. This leads to a infinite
recursion as _lp_set_prompt runs $LP_OLD_PROMPT_COMMAND.

To work around those broken environments we now fix the environment by
unexporting PROMPT_COMMAND.
  • Loading branch information
dolmen authored and Gerschtli committed Oct 27, 2016
1 parent 7b0eb76 commit 0aed251
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

NEXT
New features:
- Workaround broken .bashrc that export PROMPT_COMMAND (GH #450, #463):
we now unexport it on startup

1.11 2016-06-25
Bug fixes:
- OS X: sudo feature fixed
Expand Down
7 changes: 7 additions & 0 deletions liquidprompt
Original file line number Diff line number Diff line change
Expand Up @@ -1904,6 +1904,13 @@ prompt_on()
fi
fi
if $_LP_SHELL_bash; then
# Prevent some cases where the user shoots in his own foot.
# PROMPT_COMMAND is not exported by default, but some users
# incorrectly export it from their profile/bashrc (GitHub #450),
# so we preventively UNexport it.
# TODO: warn the user if it was exported
declare -g +x PROMPT_COMMAND

# Disable parameter/command expansion from PS1
shopt -u promptvars
PROMPT_COMMAND=_lp_set_prompt
Expand Down

0 comments on commit 0aed251

Please sign in to comment.