GNU bug report logs - #78757
shepherd: dangling file descriptor to /dev/console

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: guix; Reported by: burban@HIDDEN; dated Wed, 11 Jun 2025 14:55:02 UTC; Maintainer for guix is bug-guix@HIDDEN.

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


Received: (at 78757) by debbugs.gnu.org; 13 Jun 2025 22:53:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 13 18:53:34 2025
Received: from localhost ([127.0.0.1]:53841 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uQDHB-0004WP-DY
	for submit <at> debbugs.gnu.org; Fri, 13 Jun 2025 18:53:34 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:40928)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1uQDH9-0004VI-Ch
 for 78757 <at> debbugs.gnu.org; Fri, 13 Jun 2025 18:53:31 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1uQDH2-0003yR-N8; Fri, 13 Jun 2025 18:53:24 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=TKTlJxEfjGA49qgUG/bIb3O9GnoOKOwXvjvJUg0Kjr4=; b=jqbtysUZ1LDm8oiRvl7g
 wBCRaeKPkM6k/Vn4d9PuX9w7thQ5He9jMRUm5Md1cglcKSMh8RtEKfd/acoBJK9z7ZuRvh5s93Ee8
 XoIOs3gU0iBOT3uo/D9SdZxmUosCzl+GXkXze5DEaAPln83QJ3zxScNL0nMjen6Irk6hIq02u4208
 SIeA9hypDqJy6HOVaNMDOlK2Nd11+6VYfYKJr3MstDWRZQobB/+EA8wIT67kJMi9IpsFfmJDxL864
 90UQVU+zDIwTFzvLwZ2zlpxzinzGOy1zwwceaAGOgsEBmu8JlvG0+8IPAL/dhXn+kVcAP8grTl3c6
 tEwnLKZNEsD/nQ==;
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: 78757 <at> debbugs.gnu.org,  burban@HIDDEN
Subject: Re: bug#78757: shepherd: dangling file descriptor to /dev/console
In-Reply-To: <87sek7pcco.fsf@HIDDEN> (burban's message of "Tue, 10 Jun
 2025 20:31:51 +0000")
References: <87sek7pcco.fsf@HIDDEN>
User-Agent: mu4e 1.12.11; emacs 29.4
X-URL: https://people.bordeaux.inria.fr/lcourtes/
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
X-Revolutionary-Date: Sextidi 26 Prairial an 233 de la =?utf-8?Q?R=C3=A9vo?=
 =?utf-8?Q?lution=2C?= jour du Jasmin
Date: Sat, 14 Jun 2025 00:47:56 +0200
Message-ID: <87zfeb5kdf.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78757
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: -3.3 (---)

Hi burban,

burban--- via Bug reports for GNU Guix <bug-guix@HIDDEN> writes:

> All shepherd children have an open file descriptor to /dev/console,
> probably because of the use of dup2 (and not dup3) in system.scm.

I checked the /proc/PID/fd directory of several of my system services on
Guix System (nscd, guix-publish, ntpd, upower-daemon) and I don=E2=80=99t s=
ee
any file descriptor pointing to /dev/console, with version 1.0.5.

You said you=E2=80=99re on Debian; which version of the Shepherd is it?

I also don=E2=80=99t see any =E2=80=98dup2=E2=80=99 call in =E2=80=98system=
.scm=E2=80=99; this takes place
rather in =E2=80=98service.scm=E2=80=99.

> The pb. disapears if I force that flag with that code before I define
> my services (context: shepherd used as init system on Debian):
> (port-for-each (lambda (x)
>                  (catch #t
> 		   (lambda ()
> 		     (when (=3D (fcntl x F_GETFD) 0)
> 		       (fcntl x F_SETFD FD_CLOEXEC)
> 		       (format #t "FD_CLOEXEC flag set on port ~a (fd: ~a)\n" x (port->=
fdes x))))
> 		   (lambda (keys . args) (format #t "fcntl error for port ~a\n" x)))
> 		 ))

=E2=80=98shepherd=E2=80=99 marks all previously-opened FDs as O_CLOEXEC upf=
ront=E2=80=94see
=E2=80=98mark-as-close-on-exec=E2=80=99 in =E2=80=98shepherd.scm=E2=80=99. =
 Those opened later are
opened with O_CLOEXEC, except for user code that explicitly omits the
O_CLOEXEC flag.

Thanks,
Ludo=E2=80=99.




Information forwarded to bug-guix@HIDDEN:
bug#78757; Package guix. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 11 Jun 2025 14:54:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 11 10:54:31 2025
Received: from localhost ([127.0.0.1]:50003 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uPMqS-00021y-MG
	for submit <at> debbugs.gnu.org; Wed, 11 Jun 2025 10:54:30 -0400
Received: from lists.gnu.org ([2001:470:142::17]:35522)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <burban@HIDDEN>) id 1uP5dh-0002k5-Ai
 for submit <at> debbugs.gnu.org; Tue, 10 Jun 2025 16:32:10 -0400
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 <burban@HIDDEN>) id 1uP5dX-00031q-IL
 for bug-guix@HIDDEN; Tue, 10 Jun 2025 16:32:00 -0400
Received: from [2a03:9da0:11:108::2] (helo=hagen2.opopop.net)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <burban@HIDDEN>) id 1uP5dV-0002U8-RH
 for bug-guix@HIDDEN; Tue, 10 Jun 2025 16:31:59 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=opopop.net; 
 s=202504;
 h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From:Sender:
 Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description:
 Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:
 In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=FyUmG4HeLuorT3qU2tMnfvrwJW/ubwrmg/eD/8gdHk4=; b=fIB5c/AyQVGzpjh9EVviaWr+gM
 rOxRaX73oc7p+I8OlT477+ofX43pfBn2M+0BvHDRJ4fPVmNfKuJQzbwlEZ+gSP/xoi7nTmRZ2r49F
 G1g/4aU++LMJygG2Qta0/rmG5zMFv43qR8Woz8f9DzJIOCBdtSRNZA2QtqvL4EUmOcvVFC9vpUWvW
 Pm25iqqz84F1VaF/y4+IZw4LRz1sUb9kA8UbhK/NQETz4SvlxvxG2ftKljfHmI4VVDGF5cW/IDQAI
 xSaKjOPwyM/aLSqt0Yu3zX5Gs9Nkj6ryw3tHsqj4UpdzztoNq/r/i+E8f7+g7+o2dKcZ0fOwE6BIZ
 QwqsksNQ==;
Received: from localhost ([127.0.0.1] helo=hagen2)
 by hagen2 with esmtps  (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
 (Exim 4.96) (envelope-from <burban@HIDDEN>) id 1uP5dO-000F4N-3B
 for bug-guix@HIDDEN; Tue, 10 Jun 2025 20:31:51 +0000
From: burban@HIDDEN
To: bug-guix@HIDDEN
Subject: shepherd: dangling file descriptor to /dev/console
Date: Tue, 10 Jun 2025 20:31:51 +0000
Message-ID: <87sek7pcco.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a03:9da0:11:108::2
 (failed)
Received-SPF: pass client-ip=2a03:9da0:11:108::2;
 envelope-from=burban@HIDDEN; helo=hagen2.opopop.net
X-Spam_score_int: -12
X-Spam_score: -1.3
X-Spam_bar: -
X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Wed, 11 Jun 2025 10:54:26 -0400
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.1 (/)


Hello,

All shepherd children have an open file descriptor to /dev/console,
probably because of the use of dup2 (and not dup3) in system.scm.

The pb. disapears if I force that flag with that code before I define
my services (context: shepherd used as init system on Debian):
(port-for-each (lambda (x)
                 (catch #t
		   (lambda ()
		     (when (= (fcntl x F_GETFD) 0)
		       (fcntl x F_SETFD FD_CLOEXEC)
		       (format #t "FD_CLOEXEC flag set on port ~a (fd: ~a)\n" x (port->fdes x))))
		   (lambda (keys . args) (format #t "fcntl error for port ~a\n" x)))
		 ))


Sincerely.

-- 

Bernard





Acknowledgement sent to burban@HIDDEN:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#78757; Package guix. 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: Fri, 13 Jun 2025 23:00:02 UTC

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