bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: catch signals after calling execve()


From: Roman Rakus
Subject: Re: catch signals after calling execve()
Date: Tue, 16 Sep 2008 14:57:41 +0200
User-agent: Thunderbird 2.0.0.16 (X11/20080723)

Chet Ramey wrote:
After changing catching signals in bash - added CATCH_SIGNALS () macro -
we aren't catching them after calling execve(). This short patch fix it:
diff -up bash-3.2/execute_cmd.c.execve_catch_signal bash-3.2/execute_cmd.c
--- bash-3.2/execute_cmd.c.execve_catch_signal  2008-09-15
12:20:18.000000000 +0200
+++ bash-3.2/execute_cmd.c      2008-09-15 12:20:55.000000000 +0200
@@ -3943,6 +3943,7 @@ shell_execve (command, args, env)
  SETOSTYPE (0);               /* Some systems use for USG/POSIX
semantics */
  execve (command, args, env);
  i = errno;                   /* error from execve() */
+  CATCH_SIGNALS ();
  SETOSTYPE (1);
I'm sorry. I didn't explain what is the problem.
The problem is, when bash tries to run any process by calling execve() from slow (maybe not only slow) hardware (for example mounted NFS). Driver of this hardware says kernel, that it needs to wait and kernel is waiting until signal handling is done. Probably I'm not saying it clearly.
Take a look at http://uwsg.iu.edu/hypermail/linux/kernel/0104.0/0743.html

OK, but what does CATCH_SIGNALS do, and where did you add it?

Chet

Aaah... so sorry, I'm bit confused. CATCH_SIGNALS is only on RHEL-4 system. There is similar macro in quit.h called CHECK_TERMSIG. So the patch is:
diff -up bash-3.2/execute_cmd.c.execve_catch_signals bash-3.2/execute_cmd.c
--- bash-3.2/execute_cmd.c.execve_catch_signals 2008-09-16 14:28:25.000000000 +0200
+++ bash-3.2/execute_cmd.c      2008-09-16 14:52:14.000000000 +0200
@@ -99,6 +99,8 @@ extern int errno;
#  include "bashhist.h"
#endif

+#include "quit.h"
+
extern int posixly_correct;
extern int breaking, continuing, loop_level;
extern int expand_aliases;
@@ -3943,6 +3945,7 @@ shell_execve (command, args, env)
SETOSTYPE (0); /* Some systems use for USG/POSIX semantics */
  execve (command, args, env);
  i = errno;                   /* error from execve() */
+  CHECK_TERMSIG;
  SETOSTYPE (1);

  /* If we get to this point, then start checking out the file.

RR




reply via email to

[Prev in Thread] Current Thread [Next in Thread]