[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug] PROMPT_COMMAND is not executed as expected in some situations
From: |
Franklin, Jason |
Subject: |
[bug] PROMPT_COMMAND is not executed as expected in some situations |
Date: |
Wed, 15 Apr 2020 14:59:05 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2
-fdebug-prefix-map=/build/bash-orJ5jM/bash-5.0=.
-fstack-protector-strong -Wformat -Werror=format-security -Wall
-Wno-parentheses -Wno-format-security
uname output: Linux qipb7lnca 5.4.0-0.bpo.4-amd64 #1 SMP Debian
5.4.19-1~bpo10+1 (2020-03-09) x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.0
Patch Level: 16
Release Status: release
Description:
I have discovered that PROMPT_COMMAND is not executed before the
printing of PS1 in the following three situations:
(1) <C-x><C-e> is used
(2) histverify is set
(3) completion suggestions are shown
Repeat-By:
# (1) <C-x><C-e> is used
bash --norc
PROMPT_COMMAND=echo
# enter <C-x><C-e>, type out command "true" and save and quit
# note that PROMPT_COMMAND is not executed
# (2) histverify is set
bash --norc
PROMPT_COMMAND=echo
shopt -s histverify
!!
# note that PS1 is printed w/ last command, but PROMPT_COMMAND
# is not run
# (3) completion suggestions are shown
bash --norc
PROMPT_COMMAND=echo
he<Tab><Tab>
# ... completions are listed
# PS1 is printed after suggestions, but PROMPT_COMMAND is
# not run
Suggested Fix:
I tried to add code to execute PROMPT_COMMAND directly inside of
prompt_again(), but that didn't work as expected (the prompt would not
even print when I tried this).
It may be that PROMPT_COMMAND needs to be more tightly coupled to the
code that prints PS1. I thought it would be as simple as that, but I
guess not!
In any case, I hope this helps improve Bash. Thanks a ton!
--
Jason Franklin
- [bug] PROMPT_COMMAND is not executed as expected in some situations,
Franklin, Jason <=