From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#54667: 29.0.50; posix_spawn breaks emacs-gdb Date: Sun, 17 Apr 2022 20:53:26 +0200 Message-ID: References: <87fsmx80e5.fsf@gmail.com> <4d6ef0f6-8ab6-2dce-aa63-d18108fd5f21@gmail.com> <87bkxk983m.fsf@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.80.82.1.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16319"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 54667@debbugs.gnu.org, =?UTF-8?Q?G=C3=A9za?= , Herman@debbugs.gnu.org To: Robert Pluim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 17 21:27:39 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngAYd-000432-7p for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 Apr 2022 21:27:39 +0200 Original-Received: from localhost ([::1]:35000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngAYc-0001qN-26 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 Apr 2022 15:27:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34420) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngA26-0003RJ-D6 for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2022 14:54:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43329) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngA26-0005Xz-4q for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2022 14:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ngA26-0004vW-0W for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2022 14:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Apr 2022 18:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54667 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 54667-submit@debbugs.gnu.org id=B54667.165022163018920 (code B ref 54667); Sun, 17 Apr 2022 18:54:01 +0000 Original-Received: (at 54667) by debbugs.gnu.org; 17 Apr 2022 18:53:50 +0000 Original-Received: from localhost ([127.0.0.1]:37226 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ngA1f-0004ur-Ri for submit@debbugs.gnu.org; Sun, 17 Apr 2022 14:53:50 -0400 Original-Received: from mail-ej1-f44.google.com ([209.85.218.44]:38836) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ngA1d-0004uc-SO for 54667@debbugs.gnu.org; Sun, 17 Apr 2022 14:53:34 -0400 Original-Received: by mail-ej1-f44.google.com with SMTP id r13so23672416ejd.5; Sun, 17 Apr 2022 11:53:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=MR8n1sOsBVSLnH6/T6N6VrKBOMxhwJBzsNFzlVZCpck=; b=nB/JFi0DAK3Sfe9wTrpAKAop2CRWuVEEjQUg/BiBw7TO30+YlbE8rFCOludwiI5Ai/ dQGYHQqob0QBgXs/3w4SGJFyOqp3nqwue5B0qIQdbx8dcudqz3FwsbjOS0hqHMmpErSn Bc4jvL4cWU6YqSGYnj53ZUMFMFUk6QlBX2E5MkcUJrmBrej/g+h+PXB2+iz0/K4zBYH/ VslS4n6+NWgmEsLNhkVCZFhMg4Nz+KvAjZEvq1r/GAr/Pno78dmAOwHCvjge9Yunhy4t b9kSWZJEAynLVeMbgWqThJbLVoT7wAt5xjNV1jZtQKUsTt/UzN3DjmCperDnc1GRHTTb 8Uog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=MR8n1sOsBVSLnH6/T6N6VrKBOMxhwJBzsNFzlVZCpck=; b=PRBFhTb/QfuoiTaMPo9+8A9nD8mf8WTI6BnIxhRvDWOag+Qsgod0jntmzR/MwETHhd RnhrjW+/fQ6gc4xatoo610tVenhg7KyRQAJTiRJgGWSK3IGWLh62z7ag2bPr8nyMnUZm OMLV2Eua+CG0xXjQpgZkGLKx7mAJxl400VLwj710HQSwPZoLiyXn+T05mFiJiinYwwi5 B5FX6H+aSAGuU/dERCE+NL4au+HrMtJDNM9tjU5GJrVQdYQaPkjRD6JpP0oIab/x2U4f 7rFr+DCLXtqwYcx59tN2KcK8EqWaTvsBZhz8lD280zPxXlfvQCKiYrKXmSa/tfk1eBME g99A== X-Gm-Message-State: AOAM530MeeIZU5sdx6ZhiPrqXyuKpHzzpzRIcMLZpUNjPE9IHIoz61iE vM8+iOxxVPKyE/tzPcnSIhQ= X-Google-Smtp-Source: ABdhPJyGcvEci9RZ1v06XHUy+2SGfPrZ32VQGvQXI50cXNe8r2O+W4EGhHB+iX3sDLvceWBJGcPUSg== X-Received: by 2002:a17:907:1c85:b0:6e8:da11:85cb with SMTP id nb5-20020a1709071c8500b006e8da1185cbmr6356728ejc.678.1650221607796; Sun, 17 Apr 2022 11:53:27 -0700 (PDT) Original-Received: from smtpclient.apple (p57aaf107.dip0.t-ipconnect.de. [87.170.241.7]) by smtp.gmail.com with ESMTPSA id 17-20020a170906059100b006cee1bceddasm3820742ejn.130.2022.04.17.11.53.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Apr 2022 11:53:27 -0700 (PDT) In-Reply-To: <87bkxk983m.fsf@gmail.com> X-Mailer: Apple Mail (2.3696.80.82.1.1) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:230109 Archived-At: > Am 01.04.2022 um 16:44 schrieb Robert Pluim : >=20 >>>>>> On Fri, 1 Apr 2022 15:29:50 +0200, "Herman, G=C3=A9za" = said: >=20 > Herman> I can confirm that it fixes the problem. >=20 > Thanks, I=CA=BCll see if I can get around to committing it this = weekend. >=20 > Herman> For reference, here's the patch: > Herman> = https://lists.gnu.org/archive/html/emacs-devel/2022-03/msg00067.html >=20 > Herman> (Btw., according to this email thread, vfork is faster than > Herman> posix_spawn on Linux, so maybe it'd make sense to use = posix_spawn only > Herman> on non-Linux platforms?) >=20 > In emacs-28 we only use posix_spawn on macOS because its vork is > sub-optimal. I don=CA=BCt remember the rationale for switching to = using it > everywhere, it=CA=BCs undoubtedly in the archives somewhere. My reasoning back then was: 1. Using fork/vfork has a few pitfalls (can't call async-signal-unsafe = functions in the child process) that posix_spawn avoids (by not allowing = arbitrary code between fork and exec). Therefore, using posix_spawn is = simpler and more obviously correct. 2. Because posix_spawn offers less functionality than fork+exec, it = could be faster than the latter, e.g. by having it implemented in the = kernel and avoiding page table copies. 3. Since we only run CI on GNU/Linux, it's useful to have only one = codepath on all Unix-like systems so that issues that only appear on = macOS are less likely to go unnoticed. These arguments are still mostly correct, but there are some = counterpoints: 1. We need to keep the fork/vfork code path anyway since posix_spawn = doesn't allow us to correctly set up a pseudoterminal, so we still need = to deal with the pitfalls. 2. posix_spawn is indeed much faster on macOS, but not so on GNU/Linux. = (I think it's unnecessarily slowed down on GNU/Linux by what I consider = a bug in the POSIX standard.) 3. This is still true, but I'm not sure how much it matters given that = the implementations of posix_spawn are completely different on GNU/Linux = and macOS.=