Comments (11)
@davefx thanks for reporting. Just recognizing this now as a result of some issues with bashhub that's using bash-preexec. Believe the changes made to support subshells in 0.3.0 cause this. You can use 0.2.3 if you don't mind losing subshell support.
from bash-preexec.
@davefx Could you also post the version of bash you're using?
echo "$BASH_VERSION"
from bash-preexec.
Believe this is impacting bash versions > 4.2.46
from bash-preexec.
I've reproduced this problem with bash 4.3.42(1) and 4.3.30(1).
As some other tips:
If I execute something after the background process, bash doesn't finish .
$ (ls)& echo Hello
from bash-preexec.
Was able to boil this down to a simple code block to recreate. Still not sure the best way to handle this
# Causes login shells to logout
# Look like bash versions > 4.2.46
set -o functrace > /dev/null 2>&1
no_op() { :;}
trap 'no_op' DEBUG;
# Any command in a subshell and background
( pwd ) &
from bash-preexec.
@davefx was this occurring on a box you were ssh'd into? I can't recreate this locally regardless of the version. I can only recreate when ssh'd onto a box.
from bash-preexec.
No. This happens also locally in X terminals in my Ubuntu 16.04 system with bash 4.3.46(1)-release.
from bash-preexec.
Looks like this got mentioned to some folks on the GNU mailing list. Looking into this as a bug in bash. http://lists.gnu.org/archive/html/bug-bash/2016-09/msg00006.html
from bash-preexec.
When the DEBUG trap is set with functrace on, it causes other problems too. E.g., certain command groups piped to a pager program will get stopped (via SIGTTOU/SIGTTIN when the pager accesses the tty):
set -o functrace
trap ':' DEBUG
# The following gets stopped:
{ date; who | sort; } | more
[1]+ Stopped { date; who | sort; } | more
# But this works fine:
{ who | sort; date; } | more
In general (with functrace on and the DEBUG trap set) a group of command pipelines in the form below will get stopped:
$ { cmd_a; cmd_b | cmd_c; cmd_d; } | pager_prog
[1]+ Stopped { cmd_a; cmd_b | cmd_c; cmd_d; } | pager_prog
This happens if the first command of the group (cmd_a) is not a bash builtin AND a pipeline occurs later in the group (cmd_b | cmd_c).
(Puzzlingly, the issue does not arise if in the command group either the first command (cmd_a) is a bash builtin or if none of the later commands contains a pipe.)
from bash-preexec.
Just for reference, I originally reported this as bash bug [1] without realizing that I actually had functrace/DEBUG on, but when the bash maintainers could not reproduce it, I traced it to my preexec setup and eventually on to functrace/DEBUG [2].
[1] http://lists.gnu.org/archive/html/bug-bash/2016-09/msg00127.html
[2] http://lists.gnu.org/archive/html/bug-bash/2016-10/msg00000.html
from bash-preexec.
@adggit thanks for posting for reference! This issue is a real pain.
The good news is, preexec can now be implemented with $PS0 in bash 4.4. I'd love to add version detection to bash-preexec and install hooks to $PS0 if you're using the latest versions of Bash. Mentioned originally in #28 Would love a PR from someone on this.
from bash-preexec.
Related Issues (20)
- fc prints debug trap HOT 6
- Preexec is called when exiting bash with Ctrl-D HOT 2
- Return immediately when running in Zsh HOT 3
- [Bug] HISTCONTROL ignore* setting should be respected HOT 7
- `__bp_preexec_invoke_exec "$_"` printed when running multiple commads
- Tests fail with bats 1.5.0 HOT 7
- official way to detect whether bash-preexec is loaded HOT 2
- Line number exit outpu command ? HOT 1
- Bash 5.1 supports making PROMPT_COMMAND an array HOT 5
- ShellCheck highlights several issues with the file - Shellcheck could be disabled, or issues resolved HOT 2
- post_cmd functionality addition HOT 2
- Functions called in opposite order in midnight commander subshell HOT 2
- Some tests fail with bats 1.9 HOT 6
- preexec() does not work where as precmd() is working as intended. HOT 1
- Library Authors documentation can still lead to issues HOT 2
- preexec $1 is missing some commands HOT 1
- detailed bash log with preexec and precmd HOT 2
- Not working on Windows using Bash in MSYS2 HOT 7
- preexec doesn't work for no-op command `:`
- `bash-preexec` will cause `hishtory` to be particularly time-consuming for commands including pipeline.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bash-preexec.