-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
tentative fix to address bash problem #490 #510
Conversation
Signed-off-by: ruitianzhong <ruitian-zhong@outlook.com>
I think the implementation is better than mine. Perhaps I can close my PR.🥲 The advantage of my implementation is the ability to handle bash commands that fail due to closing the terminal.
|
Signed-off-by: ruitianzhong <ruitian-zhong@outlook.com>
Signed-off-by: ruitianzhong <ruitian-zhong@outlook.com>
I hook the function run the following command in git blame -L 57,67 builtins/exec.def
git blame -L 57,67 builtins/exit.def 726f6388 (Jari Aalto 1996-08-26 18:22:31 +0000 100) exec_builtin (list)
^726f6388 (Jari Aalto 1996-08-26 18:22:31 +0000 101) WORD_LIST *list;
^726f6388 (Jari Aalto 1996-08-26 18:22:31 +0000 102) {
^726f6388 (Jari Aalto 1996-08-26 18:22:31 +0000 103) int exit_value = EXECUTION_FAILURE;
8868edaf2 (Chet Ramey 2020-12-06 15:51:17 -0500 104) int cleanenv, login, opt, orig_job_control;
d166f0488 (Jari Aalto 1997-06-05 14:59:13 +0000 105) char *argv0, *command, **args, **env, *newname, *com2;
^726f6388 (Jari Aalto 1996-08-26 18:22:31 +0000 106)
74091dd4e (Chet Ramey 2022-09-26 11:49:46 -0400 107) cleanenv = login = orig_job_control = 0;
495aee441 (Chet Ramey 2011-11-22 19:11:26 -0500 108) exec_argv0 = argv0 = (char *)NULL;
ccc6cda31 (Jari Aalto 1996-12-23 17:02:34 +0000 109)
ccc6cda31 (Jari Aalto 1996-12-23 17:02:34 +0000 110) reset_internal_getopt ();
finally, git log --reverse
commit 726f63884db0132f01745f1fb4465e6621088ccf
Author: Jari Aalto <jari.aalto@cante.net>
Date: Mon Aug 26 18:22:31 1996 +0000
Imported from ../bash-1.14.7.tar.gz. I also provide some test case as follows: for i in {1..10}
do
echo hello
done 2: if echo hello
then echo world
fi 3: exec ls 4: exit 42
exit 1 2 # too many argument 5: ls \
exec \
/dev 6: exec \
echo hello world 7: hello(){
echo hello
}
hello 8: hello(){
echo hello
}
exit |
Signed-off-by: ruitianzhong <ruitian-zhong@outlook.com>
Signed-off-by: ruitianzhong <ruitian-zhong@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is only one remaining issue with field naming, everything else is fine.
Signed-off-by: ruitianzhong <ruitian-zhong@outlook.com>
I think it is more appropriate to change bashEvent.eventType from EventTypeOutput to EventTypeEventProcessor. Consider this situation: Bad Case:
After repeating 1024 times, the bpf map event_t will reach the maximum capacity, causing eCapture to not work. In PR#508, the above situation will be output as a timeout and will not cause a memory leak. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thanks.
Here, I try to address the problem in #490 with smaller change to the code.
The following command can be detected:
exec ls
exec ls
exit
However, the following command have problem and it can be improved.
I will try to improve this in later time. For now, it is a draft.