GNU bug report logs - #79494
Issue with posix_spawn_file_actions_addclosefrom_np on FreeBSD 13.1+ and 14+

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: guile; Severity: wishlist; Reported by: Nikolaos Chatzikonstantinou <nchatz314@HIDDEN>; dated Tue, 23 Sep 2025 02:01:03 UTC; Maintainer for guile is bug-guile@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Nikolaos Chatzikonstantinou <nchatz314@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 23 Sep 2025 02:00:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 22 22:00:26 2025
Received: from localhost ([127.0.0.1]:37555 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v0sKM-000528-Gg
	for submit <at> debbugs.gnu.org; Mon, 22 Sep 2025 22:00:26 -0400
Received: from lists.gnu.org ([2001:470:142::17]:34616)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <nchatz314@HIDDEN>)
 id 1v0sKE-0004xE-1A
 for submit <at> debbugs.gnu.org; Mon, 22 Sep 2025 22:00:17 -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 <nchatz314@HIDDEN>)
 id 1v0sK7-0007ll-I1
 for bug-guile@HIDDEN; Mon, 22 Sep 2025 22:00:07 -0400
Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <nchatz314@HIDDEN>)
 id 1v0sJy-00074W-6p
 for bug-guile@HIDDEN; Mon, 22 Sep 2025 22:00:07 -0400
Received: by mail-pl1-x634.google.com with SMTP id
 d9443c01a7336-27d4d6b7ab5so790955ad.2
 for <bug-guile@HIDDEN>; Mon, 22 Sep 2025 18:59:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1758592793; x=1759197593; darn=gnu.org;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=X70+8PC06nOFeI4s+gcqHhWKL6BB/n5g9B6CEMeT39A=;
 b=SiTJXHRIiTit9F9F+oaeW4pv3bd7etJ+PhPGDs9w38fJaFwo6OAsTgTbVCDDwZY9La
 KwEPNxtbL2klj34IvecpXMBjuIrI4Hn9QJtCgKaOvUNu8SSpxphYO8Z0TU1WBshRdMnY
 wnGAiqzhd1Y08lk1tv4PEqFAluwt6BDDtcWXrpAn4OK8z9jzEnsBj/IRkbFiatkjKAca
 aLw1CCLsTkkodgF4t8U4+ftES6wA5SwFaCaaJ9O76dKK9DcoJLjjPHAOuLLjCF6Tto49
 jKjbM7mitBWO/vLQz4sG+bP06dTfLZhRkSUnb/HlqCgy4FzgfkELDAyDi4eaKo7uf1b9
 PkZQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1758592793; x=1759197593;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=X70+8PC06nOFeI4s+gcqHhWKL6BB/n5g9B6CEMeT39A=;
 b=d0cqQEu6uSO0GI/AOSmnBQyP+1QO2zoISsk9wwv16iI+1GdDvi60QJ/0Zxz+qE5OyI
 2yWQAZg0BTOENFggxLYN3ChgKh8vK7Bf31id9ttM0MhzJ++haZuVpaFolbijm2M9IcQO
 FfsKTsSfXiOx99F74s5YWPgpa6tZC9bHyTLgzt8EV3mDyH4m5Lk4oXxm1n4kHR88Vk3W
 Q3ajR0OW2FGecnXQQ4owGVnVFtI7Dflw4QKN/8C5wxBEZHy5UJBhdTLisjt1LLWeU5nc
 JIfL/vsJ0d1s9O+1R//zMUZashnuSprxVltUJGmSyJSxkDRFupcRCJfgqv55MO2QlLKB
 ecOQ==
X-Gm-Message-State: AOJu0YxBLnXNdlvsah+roXl+scqzHIKTe49EJUiFnPawVQvkRD2n0MHp
 /lSG7HlFsSXqyZJMSTg9UFwPeusD3+6nxCkTZXdMyIJWKfctkw7M+r2m925Ez5K9W1Lt2uatnjx
 L8VT9Yq7KlGRvaH8mXtEU8cW0PM8t6Q3vV5Pt
X-Gm-Gg: ASbGncsh+8LmlUCAMGAe6LmxduQs32kAdeRtViLIIAfqS5z/F8o9pZPOFxlujEDNeS3
 4DyT3U8bwVB1yvRpK/IYX4P1jRU4v0g44gJt51Bj+1b1yJEDneeK0gyiEulb6Suk2JwfWUUhnSq
 bJXTqdkA62Jel3ze4ProHOR6dIZefJY3wXbtf6E+9UdQicjSyXuPhbD99JePWEUBa2wPdg4o67l
 NQm
X-Google-Smtp-Source: AGHT+IELxrlvcVu+Z5kUnglUQto261t79k5s0e8RHswKD9quA1xsEoelRHJeyiYkIM5MY3dE7UFKKOGLxJreJB4ZTHs=
X-Received: by 2002:a17:902:e750:b0:25c:b543:2da7 with SMTP id
 d9443c01a7336-27cc157260bmr9571475ad.9.1758592792920; Mon, 22 Sep 2025
 18:59:52 -0700 (PDT)
MIME-Version: 1.0
From: Nikolaos Chatzikonstantinou <nchatz314@HIDDEN>
Date: Mon, 22 Sep 2025 21:59:42 -0400
X-Gm-Features: AS18NWD86gWS305f6Pj2L22LAw5Da6loOeaw9DQb-FAm738yeKHMCCN9KrlDV2U
Message-ID: <CAAQmekd82mA11-ob1BOOQZ8KLcHnNALEsKVXfsf4wLLPMJzxVQ@HIDDEN>
Subject: Issue with posix_spawn_file_actions_addclosefrom_np on FreeBSD 13.1+
 and 14+
To: bug-guile@HIDDEN
Content-Type: text/plain; charset="UTF-8"
Received-SPF: pass client-ip=2607:f8b0:4864:20::634;
 envelope-from=nchatz314@HIDDEN; helo=mail-pl1-x634.google.com
X-Spam_score_int: -13
X-Spam_score: -1.4
X-Spam_bar: -
X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1,
 DKIM_SIGNED=0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Hello list, I would like to summarize an issue [1] that first
 came up on the FreeBSD bugzilla for Guile 3.0.10. It's a segfault due to
 the incorrect mixing of two separate APIs for Posix spawn. As Tobias Kortkamp
 clarifies there, the gnulib rpl_posix_spawn*() functions are picked up by
 Guile's autotools. However, posix_spawn_file_actions_addclosefrom_np() does
 not have a gnulib implementatio [...] 
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends
 in digit (nchatz314[at]gmail.com)
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (nchatz314[at]gmail.com)
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org]
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.2 (/)

Hello list,

I would like to summarize an issue [1] that first came up on the
FreeBSD bugzilla for Guile 3.0.10. It's a segfault due to the
incorrect mixing of two separate APIs for Posix spawn.

As Tobias Kortkamp clarifies there, the gnulib rpl_posix_spawn*()
functions are picked up by Guile's autotools. However,
posix_spawn_file_actions_addclosefrom_np() does not have a gnulib
implementation. On the other hand, Guile's configure.ac detects the
function as available on FreeBSD 13 (because FreeBSD 13.1 implemented
it [2]). There is only one place where all of this matters,
libguile/posix.c, and I want to explain how.

AC_CHECK_FUNCS in configure.ac is processed by autoheader(1) which
sets up a macro HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSEFROM_NP when it
can successfully load a test program with that function. The macro is
renamed in libguile/posix.c to HAVE_ADDCLOSEFROM (for brevity
probably):

  #ifdef HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSEFROM_NP
  # define HAVE_ADDCLOSEFROM 1
  #endif

Then it is used in 2 places in that file:

a) A fallback function close_inherited_fds() is defined if
   posix_spawn_file_actions_addclosefrom_np() is missing.
b) Inside do_spawn, if posix_spawn_file_actions_addclosefrom_np()
   exists it is used, otherwise the fallback function is used.

It is at b) where the segfault occurs: gnulib has a "fallback" spawn
implementation that is incompatible with
posix_spawn_file_actions_addclosefrom_np but compatible with
close_inherited_fds(). Nevertheless, currently on FreeBSD 14, the
gnulib implementation is used with the native
posix_spawn_file_actions_addclosefrom_np() which causes a segfault.

Further discussion on the issue [3,4] and the PR that attempts to fix
some of it. [5] Ideally we want to use native functions on FreeBSD
instead of gnulib's. currently the patch in [5] is avoiding use of
posix_spawn_file_actions_addclosefrom_np() on any platform where
HAVE_POSIX_SPAWN is not defined.

1. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282534
2. https://cgit.freebsd.org/src/commit/?id=a18ddf775744f31a844fd01fbe90207f7c5e706d
3. https://logs.guix.gnu.org/guile/2025-09-22.log
4. https://logs.guix.gnu.org/guile/2025-09-23.log
5. https://codeberg.org/guile/guile/pulls/17




Acknowledgement sent to Nikolaos Chatzikonstantinou <nchatz314@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guile@HIDDEN. Full text available.
Report forwarded to bug-guile@HIDDEN:
bug#79494; Package guile. 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: Tue, 23 Sep 2025 04:45:06 UTC

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