From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: emacs-29 8bf4cdcf79: Avoid recursive process filters in lisp/jsonrpc.el (bug#60088) Date: Fri, 16 Dec 2022 14:46:42 +0000 Message-ID: References: <167118072395.30479.8819833637573037468@vcs2.savannah.gnu.org> <20221216085204.43B07C04961@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000005e8b2405eff30a7a" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33262"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Dec 16 15:47:31 2022 Return-path: Envelope-to: ged-emacs-devel@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 1p6Bzm-0008QQ-VH for ged-emacs-devel@m.gmane-mx.org; Fri, 16 Dec 2022 15:47:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6BzI-0002py-AL; Fri, 16 Dec 2022 09:47:00 -0500 Original-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 ) id 1p6BzH-0002pW-5e for emacs-devel@gnu.org; Fri, 16 Dec 2022 09:46:59 -0500 Original-Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p6BzD-0007VF-6R for emacs-devel@gnu.org; Fri, 16 Dec 2022 09:46:58 -0500 Original-Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-12c8312131fso3516691fac.4 for ; Fri, 16 Dec 2022 06:46:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=CeWaw84JL1MsqQrdZ9TM4z6iwPbivmRpH9JmPIrLZDA=; b=prnb01ccLl3Klnu/GnqAezfMW+jELWSh+/JHWdpD5rgmipbHJ7EsvA/KcXOM7nJE2q 38JzQcURLse103Bh5i+glHG/BjXnfVlYn9v8AFH376j0eDMuSvV1yx3Ms/gEQELq8B2g GTkGiKh5xlX/DfywdEWyaNiC9O7ExBGjEmP9xHc5GqU9jBtcaO6PgYg1sLKybuYd49Ri X/1Em4CUA5nj8gXcq8vwLwd7KELkM1YBhtVX1pg7IeR1/Zdc6R4qU1KeBRCdMuMCVM1g 0pPTGDX9wG5eazgtu9ZXOpNgMTY9xcWNuDHqO/GVS+k1KNN3+jjSQMUTdlS/JARe4N/L CIcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CeWaw84JL1MsqQrdZ9TM4z6iwPbivmRpH9JmPIrLZDA=; b=a6yCyF2Itmv55FzIXNrwA/miS+Ou+DX6ZfMjEBz0cb+x6RPMSMxTraAd8ntReUEwkn upQFkJetqAV1CaMWdgJz9AdmjnayMMPbOdl8diAK8sB9OL9eg/E01o6FmxOHzVqnp8CO QYCDvQLSKG6U3MBi0gu21ZbgP7xujLu0FggMQIKiYMUO9CTaUJbU0Z7hd5UL29n+Nl5F ix6rl8p4v+CTTVvE61tGvSW7eVAWkppfOg+0CEQFwIGDb+UJSDsAu4EvzU4rQD1eDV2l F3j2ZyceRds/iNyOkwLme/pDFrzdjcsS23zVfsQS0aQenU1FUiMKSEZM9+pPmbQgFq4b R7Ug== X-Gm-Message-State: AFqh2krxb03w95BYG9y4If1CY00nhT9/1mjvvB4G3Vy7gKHx3M3i1EGl vFkzKwfqtdBgrtJabkOHHrW5PN5KpArngqnTaLCZXgQh X-Google-Smtp-Source: AMrXdXuUVjjMIgk0uevR8HgxxX0Vs0Brknvmnx/Pn107UunVeuNo3uzkUnsD0fNC29AEeWbWMgqQP+0uVdr2mb2OrnM= X-Received: by 2002:a05:6870:ab08:b0:148:143f:a6b4 with SMTP id gu8-20020a056870ab0800b00148143fa6b4mr888012oab.215.1671202013611; Fri, 16 Dec 2022 06:46:53 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2001:4860:4864:20::29; envelope-from=joaotavora@gmail.com; helo=mail-oa1-x29.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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:301487 Archived-At: --0000000000005e8b2405eff30a7a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Dec 16, 2022 at 2:36 PM Stefan Monnier wrote: > > Avoid recursive process filters in lisp/jsonrpc.el (bug#60088) > > BTW, this has bitten us in various other cases, we should fix it once > and for all in the C code by marking the process as "busy" while we're > running the filters so we never run filters recursively. > [ If we ever bump into a case where recursive filters are needed, we > can then add some function to remove the "busy" mark. > Calling (accept-process-output PROC) should naturally mark PROC as > not-busy. ] I thought about that too, but I don't know what other implications it might have. If it's somehow feasible, isn't it easier to just change process-send-input to _not_ accept output? That's the only output-accepting primitive that makes sense to call from within a process filter (and that's what happened here). I can't see how sit-for is useful from within a process-filter and neither accept-process-output. Almost certainly a bug, right? So why can't we make it so that they just error when called under those circumstances? Jo=C3=A3o --0000000000005e8b2405eff30a7a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Dec 16, 2022 at 2:36 PM Stefan Monnier <monnier@iro.umontreal.ca> wrote= :

> > =C2=A0 =C2=A0 Avoid recursive process filters in lisp/js= onrpc.el (bug#60088)
>
> BTW, this has bitten us in various oth= er cases, we should fix it once
> and for all in the C code by markin= g the process as "busy" while we're
> running the filte= rs so we never run filters recursively.
> [ If we ever bump into a ca= se where recursive filters are needed, we
> =C2=A0 can then add some = function to remove the "busy" mark.
> =C2=A0 Calling (accep= t-process-output PROC) should naturally mark PROC as
> =C2=A0 not-bus= y. =C2=A0]


I thought about that too, but I don't know what o= ther implications
it might have. If it's somehow feasible, isn't= it easier to just change
process-send-input to _not_ accept output?=C2= =A0 That's the
only output-accepting primitive that makes sense to = call from
within a process filter (and that's what happened here).= =C2=A0 I can't
see how sit-for is useful from within a process-filt= er and neither
accept-process-output.=C2=A0 Almost certainly a bug, righ= t? So why
can't we make it so that they just error when called unde= r those
circumstances?

Jo=C3=A3o
--0000000000005e8b2405eff30a7a--