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

hishtory will cause pipeline execution to be particularly time-consuming. #205

Open
hongyi-zhao opened this issue Apr 19, 2024 · 1 comment

Comments

@hongyi-zhao
Copy link

If I enable hishtory in ~/.bashrc by adding the following code snippet into it:

if [ -d "$HOME/.hishtory" ] && [ -r "$HOME/.hishtory/config.sh" ]; then
  export PATH="$PATH:$HOME/.hishtory"
  source "$HOME/.hishtory/config.sh"
fi

Then, I noticed that the following simple command would be particularly time-consuming:

werner@MZ73-LM1-000:~$ time echo 1 | tail
1

real    0m1.021s
user    0m0.055s
sys     0m0.016s

If I disable hishtory, the above command will be very fast:

werner@MZ73-LM1-000:~$ time echo 1 | tail
1

real	0m0.014s
user	0m0.010s
sys	0m0.006s

What is the cause of this? Are there some bugs in hishtory that trigger this issue?

Regards,
Zhao

@hongyi-zhao
Copy link
Author

hongyi-zhao commented Apr 19, 2024

I got it. The issue reported above is triggered by bash-preexec, which in turn is called by bash-it by default, see here for the related discussion.

In my case, I use bash-it to enhance the UX of bash, so the problem occurs. If I disable the bash-preexec calling from within bash-it as discussed here like the following, the problem will be fixed:

werner@MZ73-LM1-000:~/Public/repo/github.com/bash-it/bash-it.git$ git diff
diff --git a/lib/preexec.bash b/lib/preexec.bash
index 1dbe8899..43d2d4fa 100644
--- a/lib/preexec.bash
+++ b/lib/preexec.bash
@@ -9,7 +9,7 @@
 __bp_delay_install="delayed"
 
 # shellcheck source-path=SCRIPTDIR/../vendor/github.com/rcaloras/bash-preexec
-source "${BASH_IT?}/vendor/github.com/rcaloras/bash-preexec/bash-preexec.sh"
+#source "${BASH_IT?}/vendor/github.com/rcaloras/bash-preexec/bash-preexec.sh"
 
 # Block damanaging user's `$HISTCONTROL`
 function __bp_adjust_histcontrol() { :; }
@@ -22,7 +22,7 @@ function __bp_require_not_readonly() { :; }
 : "${__bp_enable_subshells:=}" # blank
 
 # Modify `$PROMPT_COMMAND` in finalize hook
-_bash_it_library_finalize_hook+=('__bp_install_after_session_init')
+#_bash_it_library_finalize_hook+=('__bp_install_after_session_init')
 
 ## Helper functions
 function __check_precmd_conflict() {

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

1 participant