GNU bug report logs - #67680
nohup is not giving immunity to SIGHUP

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Reported by: Bob Hepple <bob.hepple@HIDDEN>; Keywords: notabug; Done: Collin Funk <collin.funk1@HIDDEN>; Maintainer for coreutils is bug-coreutils@HIDDEN.
bug closed, send any further explanations to 67680 <at> debbugs.gnu.org and Bob Hepple <bob.hepple@HIDDEN> Request was from Collin Funk <collin.funk1@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) notabug. Request was from Collin Funk <collin.funk1@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 67680 <at> debbugs.gnu.org:


Received: (at 67680) by debbugs.gnu.org; 7 Dec 2023 15:18:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 07 10:18:56 2023
Received: from localhost ([127.0.0.1]:42761 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rBG9P-0000f2-Ty
	for submit <at> debbugs.gnu.org; Thu, 07 Dec 2023 10:18:56 -0500
Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:56581)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pixelbeat@HIDDEN>) id 1rBG9K-0000el-RB
 for 67680 <at> debbugs.gnu.org; Thu, 07 Dec 2023 10:18:54 -0500
Received: by mail-wm1-x336.google.com with SMTP id
 5b1f17b1804b1-40c039e9719so12381765e9.1
 for <67680 <at> debbugs.gnu.org>; Thu, 07 Dec 2023 07:18:38 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1701962312; x=1702567112; darn=debbugs.gnu.org;
 h=content-transfer-encoding:in-reply-to:from:references:to
 :content-language:subject:user-agent:mime-version:date:message-id
 :sender:from:to:cc:subject:date:message-id:reply-to;
 bh=OkbIuNezyfkPHVPYRnkEq3CLzIBNcEHcdhFE2qbTyFo=;
 b=X6ypsTODI3LHdWs7rd7b5xvVovzy/BleTekpgOE3dqk9w4/QyKWrfYyFIO3ec8Qs/G
 +aMTIOCkBmcbN6lAGcOqTr01y9zK4UMm5z9sggdJ2SFvjnle2J1TKvXbqv21yE7vRw2W
 xmQx4PeN7vdv8XghuukpL8F5TlokX9iYmVU3outjqXQfgWuHUlOfoATqA0Nhwtee9FDy
 A9wU0suGLKN4gj1KZXEaXj+PAkXwJox5NmPZddaxQsA9yrJ95kC9xZ/uZp7ctBdaJ1Nz
 HvfXvuSbtEo9qCpQ3eBlsHltLVYTHw+U3eGsBDg2/66cvoAtne9JPlsuqnmYxbXUQSJL
 8ycQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1701962312; x=1702567112;
 h=content-transfer-encoding:in-reply-to:from:references:to
 :content-language:subject:user-agent:mime-version:date:message-id
 :sender:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=OkbIuNezyfkPHVPYRnkEq3CLzIBNcEHcdhFE2qbTyFo=;
 b=RG8+nQLFyaiic2R+XtQBVEs5qZN9o0Ygn1X262DBbe9xxm4AAxepjFFLoEW/TlL3FB
 D0uUP08/w2kUJx8U7RdW8zeWPBuj/UIP/H9TyDskRpPxiZ80EGJZKCOe/Ai0kCuskOt3
 0KalEqVVR9OwUKCObI9lsai8JAK6IClZV4WePTbY5TdtDmz9LUIO0fTc4FqlFzUcLvqp
 VgRcjPtTQ1Kk/LOqtJ/0PDeBaeYjaiAcquk6jUgxs+pkdi097zTOUOr/k9QaOd5//UJo
 Y+3xDfFKsLbyXt5oP3RAqaJ3EBsc9TX1kIhwjHz59ZhDUIAFrflQX7Th4Lwelt3xx+N4
 FbYg==
X-Gm-Message-State: AOJu0YxBMZX87lORdGHLK+MQwk8utGwbQQ9McFH3h5Ib4+BjDpEie7LZ
 jwidTZcnu4kswLT4NUbkP9U=
X-Google-Smtp-Source: AGHT+IG6l4i+yGmDcBqwUQ3ITZ67FZtYwtnqmNr0dW934u7LctwYuZxHnYFR98URBHgZ2ecV0LnROw==
X-Received: by 2002:a05:600c:22d7:b0:40c:271a:e7f4 with SMTP id
 23-20020a05600c22d700b0040c271ae7f4mr833589wmg.140.1701962311711; 
 Thu, 07 Dec 2023 07:18:31 -0800 (PST)
Received: from [192.168.1.20]
 (95-44-90-175-dynamic.agg2.lod.rsl-rtd.eircom.net. [95.44.90.175])
 by smtp.googlemail.com with ESMTPSA id
 a5-20020a5d5085000000b00334b2272a7asm1694459wrt.2.2023.12.07.07.18.30
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 07 Dec 2023 07:18:31 -0800 (PST)
Message-ID: <3216b15a-d024-d529-5c9e-7fdb7beef90e@HIDDEN>
Date: Thu, 7 Dec 2023 15:18:29 +0000
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#67680: nohup is not giving immunity to SIGHUP
Content-Language: en-US
To: Bob Hepple <bob.hepple@HIDDEN>, 67680 <at> debbugs.gnu.org
References: <CAHzpm2hEZ8bHrNggAszGGavnXoiXi0pnkHMzgmXjMqDgsb8aGA@HIDDEN>
From: =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN>
In-Reply-To: <CAHzpm2hEZ8bHrNggAszGGavnXoiXi0pnkHMzgmXjMqDgsb8aGA@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 67680
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

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




Information forwarded to bug-coreutils@HIDDEN:
bug#67680; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Dec 2023 08:13:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 07 03:13:55 2023
Received: from localhost ([127.0.0.1]:40965 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rB9W7-0007x0-0i
	for submit <at> debbugs.gnu.org; Thu, 07 Dec 2023 03:13:55 -0500
Received: from lists.gnu.org ([2001:470:142::17]:51424)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bob.hepple@HIDDEN>) id 1rB9W4-0007wk-Ru
 for submit <at> debbugs.gnu.org; Thu, 07 Dec 2023 03:13:53 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <bob.hepple@HIDDEN>)
 id 1rB9Vj-0005He-C4
 for bug-coreutils@HIDDEN; Thu, 07 Dec 2023 03:13:32 -0500
Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <bob.hepple@HIDDEN>)
 id 1rB9VU-0004Hu-SJ
 for bug-coreutils@HIDDEN; Thu, 07 Dec 2023 03:13:31 -0500
Received: by mail-ej1-x631.google.com with SMTP id
 a640c23a62f3a-a1d2f89ddabso72308166b.1
 for <bug-coreutils@HIDDEN>; Thu, 07 Dec 2023 00:13:15 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1701936793; x=1702541593; darn=gnu.org;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=8S9zAnelIGrST0qLJGs4MYVXfNrZCdw0j0CYyV1wITw=;
 b=IRGF84w3ks77KT8hdlKKoRef6G9kJn4ckDqtSX2KxECSwxj+aIUxUqp7zB6IANYJVY
 aYSp/YNGeMZ52pn3ozG99YYkMZHR3h5xumLnTRvxxz8XEb52a1a0fgbSAQmDElrsaxyG
 QxC6eojioyrFnvgUSxnpkxOn9f0cMtBMNTji9nfjNZd82m+VBjjxGupPORRcGb1DBe3j
 gA5Ame7WQktvsNtraiQ8WlXGE7AXLlnNbL/2Lbi2G6fV9k4Cai6MzuAvey56f3OeyHDu
 9Ku8unwtxqOFBuPBNAWXLtfF3Nf92cc9Ecq7WLFJQIaen+R5i2ku87AhF61wGB3nLbI5
 3bOg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1701936793; x=1702541593;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=8S9zAnelIGrST0qLJGs4MYVXfNrZCdw0j0CYyV1wITw=;
 b=pa3TizrlmJG7K6gia2j507OE8onk2r8+/0sgHc/AGoT2yIx1Bc2utEaXJ+XfrUVvJ5
 RtoXZBVoft030wIIwtbWwppF8dagx++CKbYZkjxE0GrRaJ+sbnGpvy1duP4IjH/K0yKX
 4IpKDG7nMyqwgfv8h/BvRWIJ8wX2Y4WVTLX1ir0R4bv9mc3rhFbESzZQ0lAI46BBs7Uk
 K9jiW6eYqHDEzlA9t9MRaobvJpLUiWnqwmK8U+9TKocj72Dif5Py8CPlHx8UTX8/wiIF
 16ZinfqT6oKhR5Kv/HG886WFIL3OGqwsE/6hMQNEo7cAFF3VrDnYTlg99DzDWCCfSRjL
 Uj3w==
X-Gm-Message-State: AOJu0YxHcASicXSTNj8WqG+CWC8r8VxrhSUrvSnoUgudYM6OSSHF0qOd
 p/63JPRDM7K16JwhjHJ2R5hlkXBzWN//2DiiJatQOcwIdPA=
X-Google-Smtp-Source: AGHT+IEa6hbtlS/tkFV6cAqX3TZ6KdMeN1C+WsTruoXSvQlFBTR9ygsFI2ZUKNHGgEGxlPYdbK6Ju+HsfyoJLhbzLrk=
X-Received: by 2002:a17:906:73d9:b0:9bd:a75a:5644 with SMTP id
 n25-20020a17090673d900b009bda75a5644mr1159839ejl.16.1701936792971; Thu, 07
 Dec 2023 00:13:12 -0800 (PST)
MIME-Version: 1.0
From: Bob Hepple <bob.hepple@HIDDEN>
Date: Thu, 7 Dec 2023 18:13:01 +1000
Message-ID: <CAHzpm2hEZ8bHrNggAszGGavnXoiXi0pnkHMzgmXjMqDgsb8aGA@HIDDEN>
Subject: nohup is not giving immunity to SIGHUP
To: bug-coreutils@HIDDEN
Content-Type: text/plain; charset="UTF-8"
Received-SPF: pass client-ip=2a00:1450:4864:20::631;
 envelope-from=bob.hepple@HIDDEN; helo=mail-ej1-x631.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

$ 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?




Acknowledgement sent to Bob Hepple <bob.hepple@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#67680; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 15 Dec 2025 07:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.