GNU bug report logs -
#67680
nohup is not giving immunity to SIGHUP
Previous Next
To reply to this bug, email your comments to 67680 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#67680
; Package
coreutils
.
(Thu, 07 Dec 2023 08:14:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Bob Hepple <bob.hepple <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Thu, 07 Dec 2023 08:14:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
$ nohup --version
nohup (GNU coreutils) 9.3
$ uname -a
Linux achar-void 6.5.12_1 #1 SMP PREEMPT_DYNAMIC Mon Nov 20 18:31:50
UTC 2023 x86_64 GNU/Linux
This is on void, but it also behaves the same on fedora-38
I have extracted a minimal example - it looks like a stupid thing to
do but it demonstrates the problem. A full and non-stupid script is at
https://gitlab.com/wef/dotfiles/-/blob/master/bin/fzf-launcher
Nevertheless - the following commands are run from bash in a graphical
session. 'foot' is a terminal emulator - any terminal emulator can be
used - I have tried mrxvt, urxvt, alacritty.
'imv' is a simple program that opens a window. Anything else with a
.desktop file could be used, such as 'rofi' or 'xsane'.
$ foot -e bash -c "nohup gtk-launch imv &"
... fails - the program imv briefly opens a window and immediately closes
$ foot -e bash -c "nohup gtk-launch imv & sleep 3"
.... the 'imv' window shows but it is closed after 3 seconds - clearly
the program 'imv' starts but is killed by something when the script
terminates.
$ foot -e bash -c "trap '' HUP; nohup gtk-launch imv &"
... works perfectly - the 'something' that is killing imv is
apparently the HUP signal! So why does nohup not grant immunity to
HUP?
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#67680
; Package
coreutils
.
(Thu, 07 Dec 2023 15:19:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 67680 <at> debbugs.gnu.org (full text, mbox):
tag 67680 notabug
close 67680
stop
On 07/12/2023 08:13, Bob Hepple wrote:
> $ nohup --version
> nohup (GNU coreutils) 9.3
> $ uname -a
> Linux achar-void 6.5.12_1 #1 SMP PREEMPT_DYNAMIC Mon Nov 20 18:31:50
> UTC 2023 x86_64 GNU/Linux
>
> This is on void, but it also behaves the same on fedora-38
>
> I have extracted a minimal example - it looks like a stupid thing to
> do but it demonstrates the problem. A full and non-stupid script is at
>
> https://gitlab.com/wef/dotfiles/-/blob/master/bin/fzf-launcher
>
> Nevertheless - the following commands are run from bash in a graphical
> session. 'foot' is a terminal emulator - any terminal emulator can be
> used - I have tried mrxvt, urxvt, alacritty.
>
> 'imv' is a simple program that opens a window. Anything else with a
> .desktop file could be used, such as 'rofi' or 'xsane'.
>
> $ foot -e bash -c "nohup gtk-launch imv &"
> ... fails - the program imv briefly opens a window and immediately closes
>
> $ foot -e bash -c "nohup gtk-launch imv & sleep 3"
> .... the 'imv' window shows but it is closed after 3 seconds - clearly
> the program 'imv' starts but is killed by something when the script
> terminates.
>
> $ foot -e bash -c "trap '' HUP; nohup gtk-launch imv &"
> ... works perfectly - the 'something' that is killing imv is
> apparently the HUP signal! So why does nohup not grant immunity to
> HUP?
In the last case you're telling bash to ignore HUP,
so I suspect in the other case bash is causing the exit.
I'd look into `strace -e signal ...` to diagnose what's
happening exactly, and perhaps setsid(1) may be useful for your case.
thanks,
Pádraig
This bug report was last modified 362 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.