bug-bash
[Top][All Lists]
Advanced

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

bash sends SIGHUP to disowned children in non-interactive mode


From: ck850
Subject: bash sends SIGHUP to disowned children in non-interactive mode
Date: Wed, 28 Dec 2011 19:44:40 +0100 (CET)

   I'm experiencing some strange behaviour with bash and xterm or other
   X-terminals.
   I'm using bash in Debian stable (GNU bash, Version 4.1.5(1)-release
   (i486-pc-linux-gnu)).
   To reproduce this, write a simple script like this:
   #!/bin/bash
   (xclock &)
   sleep 15
   Then run it with xterm -e.
   xclock is not a child of xterm or bash (PPID=1) because it was invoked
   with "(xclock &)":
   F S UID        PID  PPID  C PRI  NI ADDR SZ WCHAN  STIME TTY
   TIME CMD
   0 S turin    23318     1  0  80   0 -  2292 -      17:52 pts/1
   00:00:00 xclock
   Yet xclock closes when the script exits because it receives a SIGHUP.
   Just strace the PID:
   Process 23318 attached - interrupt to quit
   restart_syscall(<... resuming interrupted call ...>) = ?
   ERESTART_RESTARTBLOCK (To be restarted)
   --- SIGHUP (Hangup) @ 0 (0) ---
   Process 23318 detached
   This should not happen or am I wrong?
   If you change the header in the script to #!/bin/tcsh or #!/bin/csh
   xclock does not receive a SIGHUP.
   Therefore I assume the problem is with bash.
   Same with disown:
   #!/bin/bash
   xclock &
   disown -a
   sleep 15
   Changeing the header to "#!/bin/bash -i" doesn't make a difference
   either.
   If I execute the script in an interactive terminal and close the
   terminal window with the "x" button after the script finished xclock
   stays open.
   No SIGHUP. Why is a HUP signal send in the other case? Any ideas? Am i
   missing something?
   regards

   SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
   kostenguenstig. Jetzt gleich testen! [1]http://f.web.de/?mc=021192

References

   1. http://f.web.de/?mc=021192


reply via email to

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