GNU bug report logs - #62009
29.0.60; Emacs crashes on setf symbol-name

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: emacs; Reported by: Daniel Mendler <mail@HIDDEN>; dated Mon, 6 Mar 2023 19:28:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 12:24:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 07:24:20 2023
Received: from localhost ([127.0.0.1]:53972 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pabnI-0005wF-DZ
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 07:24:20 -0500
Received: from server.qxqx.de ([178.63.65.180]:38285 helo=mail.qxqx.de)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1pabnG-0005w0-P6
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 07:24:19 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de;
 s=mail1392553390; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:
 References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=jbyTXXhNVn+OLvkSRp+fZC0ay03PeXP5uN47QtAZhN0=; b=fPBrZ6QKr+Fxb1Gm+KNHrE/OiA
 tUhoQXkxyYofMiVU2ZTgW5hoj94ks1CDAnHEz8M3gumf8Epnf8kqmRc363mNxMO7+bQcdRXC40mIs
 cyCTZoovWvwveOmtqrmo6OLEuL6PDALUiwNiYm3SCnQKJdbLVBZS21FWtGWrgWmJaosk=;
Message-ID: <20b91f20-1ed8-c38f-0165-b0eb3de1ee80@HIDDEN>
Date: Fri, 10 Mar 2023 13:24:08 +0100
MIME-Version: 1.0
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
Content-Language: en-US
To: Eli Zaretskii <eliz@HIDDEN>
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN> <83a60l13p2.fsf@HIDDEN>
 <16ecbe9ea8ba9d39d058@HIDDEN>
 <a6b6eff0-1aa7-d0e7-3cd9-cc87ae76c421@HIDDEN>
 <16ecbe9ea85b22d008fd@HIDDEN>
 <43460d2c-ba80-0f2f-656c-ef0aca5667b5@HIDDEN>
 <87fsacx2qf.fsf@HIDDEN>
 <3a9f613f-baa9-2c48-f779-aaf43363a865@HIDDEN>
 <83mt4kztwe.fsf@HIDDEN>
From: Daniel Mendler <mail@HIDDEN>
In-Reply-To: <83mt4kztwe.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62009
Cc: philipk@HIDDEN, michael_heerdegen@HIDDEN, rpluim@HIDDEN,
 gregory@HIDDEN, monnier@HIDDEN, 62009 <at> debbugs.gnu.org,
 arstoffel@HIDDEN
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 (---)

On 3/10/23 13:13, Eli Zaretskii wrote:
>> Date: Fri, 10 Mar 2023 12:36:17 +0100
>> Cc: Gregory Heytings <gregory@HIDDEN>,
>>  Philip Kaludercic <philipk@HIDDEN>, michael_heerdegen@HIDDEN,
>>  monnier@HIDDEN, 62009 <at> debbugs.gnu.org, Eli Zaretskii
>>  <eliz@HIDDEN>, Augusto Stoffel <arstoffel@HIDDEN>
>> From: Daniel Mendler <mail@HIDDEN>
>>
>>>       /* Number of characters in string; MSB is used as the mark bit.  */
>>>       ptrdiff_t size;
>>>       /* If nonnegative, number of bytes in the string (which is multibyte).
>>> 	 If negative, the string is unibyte:
>>> 	 -1 for data normally allocated
>>> 	 -2 for data in rodata (C string constants)
>>> 	 -3 for data that must be immovable (used for bytecode)  */
>>>       ptrdiff_t size_byte;
>>
>> Thanks! That's good. Given that a read only flag already exists, it is
>> easy to fix the issue. We just have to make sure that the size is
>> negative for the symbol names and add a check in `aset`.
> 
> Let's not do that!

Why not? There won't be a performance cost.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 12:13:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 07:13:47 2023
Received: from localhost ([127.0.0.1]:53962 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pabd4-0005ey-PP
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 07:13:47 -0500
Received: from eggs.gnu.org ([209.51.188.92]:51716)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pabd4-0005ek-1L
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 07:13:46 -0500
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 <eliz@HIDDEN>)
 id 1pabcy-0004hg-1N; Fri, 10 Mar 2023 07:13:40 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=SQWut6f92KeOBKfZ1GrTEWhLlWQt0zsMC1qta7Vk5q8=; b=bs1UELqYjoaU
 REjIYco8BM3Hs1NgGBKziBqAwCsGkGeYwhSFnScawlYNXxemcCBpdEmvazTlrfoKWX3hgEv8RPs/r
 +vw8m4WSOtffkFWmPhcqaCLEovNs1mBCiaUN/XY1YMbG3yxGwQuWJqWKCXKgETHO9SEazNsIBBVv7
 WYd8IWGVwg35S2QeF2HDIZi9YtXwhizh2rYCfnsHLu0Wm5H7REGmJ0J/Sjm6+RWpOAOdWILNXd6Vf
 NFwosg4laLwJgt5tbDHdy5PAxVSUKXMLVLz39Yk/l1QG4lh+3BNoZeMXmJ6AVY+VSisFuDmqqr1rf
 JPlVlUy7gbaUhqu2roGBRw==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pabcx-0000b4-A8; Fri, 10 Mar 2023 07:13:39 -0500
Date: Fri, 10 Mar 2023 14:13:21 +0200
Message-Id: <83mt4kztwe.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Daniel Mendler <mail@HIDDEN>
In-Reply-To: <3a9f613f-baa9-2c48-f779-aaf43363a865@HIDDEN> (message
 from Daniel Mendler on Fri, 10 Mar 2023 12:36:17 +0100)
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN> <83a60l13p2.fsf@HIDDEN>
 <16ecbe9ea8ba9d39d058@HIDDEN>
 <a6b6eff0-1aa7-d0e7-3cd9-cc87ae76c421@HIDDEN>
 <16ecbe9ea85b22d008fd@HIDDEN>
 <43460d2c-ba80-0f2f-656c-ef0aca5667b5@HIDDEN>
 <87fsacx2qf.fsf@HIDDEN>
 <3a9f613f-baa9-2c48-f779-aaf43363a865@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62009
Cc: philipk@HIDDEN, michael_heerdegen@HIDDEN, rpluim@HIDDEN,
 gregory@HIDDEN, monnier@HIDDEN, 62009 <at> debbugs.gnu.org,
 arstoffel@HIDDEN
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 (---)

> Date: Fri, 10 Mar 2023 12:36:17 +0100
> Cc: Gregory Heytings <gregory@HIDDEN>,
>  Philip Kaludercic <philipk@HIDDEN>, michael_heerdegen@HIDDEN,
>  monnier@HIDDEN, 62009 <at> debbugs.gnu.org, Eli Zaretskii
>  <eliz@HIDDEN>, Augusto Stoffel <arstoffel@HIDDEN>
> From: Daniel Mendler <mail@HIDDEN>
> 
> >       /* Number of characters in string; MSB is used as the mark bit.  */
> >       ptrdiff_t size;
> >       /* If nonnegative, number of bytes in the string (which is multibyte).
> > 	 If negative, the string is unibyte:
> > 	 -1 for data normally allocated
> > 	 -2 for data in rodata (C string constants)
> > 	 -3 for data that must be immovable (used for bytecode)  */
> >       ptrdiff_t size_byte;
> 
> Thanks! That's good. Given that a read only flag already exists, it is
> easy to fix the issue. We just have to make sure that the size is
> negative for the symbol names and add a check in `aset`.

Let's not do that!




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 12:12:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 07:12:52 2023
Received: from localhost ([127.0.0.1]:53952 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pabcC-0005d2-2N
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 07:12:52 -0500
Received: from eggs.gnu.org ([209.51.188.92]:52748)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pabcA-0005cp-9p
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 07:12:50 -0500
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 <eliz@HIDDEN>)
 id 1pabc4-0004Ua-1h; Fri, 10 Mar 2023 07:12:44 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=QNBzr8UrA8UnEQ9S0NUSEexUZaZGH1x9eP/tvtzkgJ0=; b=lnsM9ZUkCv6C
 hVg4UXE6QbWUTtdiGu/wm1bHiKOJ+Ci7NmV6LI7Msion8wCemu0PFp7RQ3o0HwLpuGaGgyGcOv7Ty
 bf1RHq5SxPJivXAif6G1Is7AUG4oHcTNI0rRUHwQKOFRK6moL7WGq5zXw+0NiOiqW8SLSkOJ4AeNZ
 cfx86ZmkMv890x92dCEBED7IxOo44IwNZuU7YuRz5fWUYO09xqjNnOvdxZoFTjM2td6MRaG+8POIf
 Gxf3XrOSFmXS9Fmdpsmw9GRKVuAUP7ivv13t3gNdEvfw+5Q5lES/Qo/hTa/b9Mj/3V3xLeXNx3PZn
 F6679w1h9hJvqzH+Hit2wQ==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pabc3-0000O7-8u; Fri, 10 Mar 2023 07:12:43 -0500
Date: Fri, 10 Mar 2023 14:12:25 +0200
Message-Id: <83o7p0ztxy.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Robert Pluim <rpluim@HIDDEN>
In-Reply-To: <87fsacx2qf.fsf@HIDDEN> (message from Robert Pluim on Fri, 10
 Mar 2023 12:30:48 +0100)
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN>
 <83a60l13p2.fsf@HIDDEN> <16ecbe9ea8ba9d39d058@HIDDEN>
 <a6b6eff0-1aa7-d0e7-3cd9-cc87ae76c421@HIDDEN>
 <16ecbe9ea85b22d008fd@HIDDEN>
 <43460d2c-ba80-0f2f-656c-ef0aca5667b5@HIDDEN>
 <87fsacx2qf.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62009
Cc: philipk@HIDDEN, michael_heerdegen@HIDDEN, mail@HIDDEN,
 gregory@HIDDEN, monnier@HIDDEN, 62009 <at> debbugs.gnu.org,
 arstoffel@HIDDEN
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 (---)

> From: Robert Pluim <rpluim@HIDDEN>
> Cc: Gregory Heytings <gregory@HIDDEN>,  Philip Kaludercic
>  <philipk@HIDDEN>,  michael_heerdegen@HIDDEN,
>   monnier@HIDDEN,  62009 <at> debbugs.gnu.org,  Eli Zaretskii
>  <eliz@HIDDEN>,  Augusto Stoffel <arstoffel@HIDDEN>
> Date: Fri, 10 Mar 2023 12:30:48 +0100
> 
> diff --git a/src/lisp.h b/src/lisp.h
> index 1276285e2f2..80bbb047824 100644
> --- a/src/lisp.h
> +++ b/src/lisp.h
> @@ -1685,6 +1685,8 @@ SREF (Lisp_Object string, ptrdiff_t index)
>  INLINE void
>  SSET (Lisp_Object string, ptrdiff_t index, unsigned char new)
>  {
> +  if (XSTRING (string)->u.s.size_byte == -2)
> +    Fsignal (Qsetting_constant, string);

"Setting constant" is misleading.

And again, why do that at all?  It's a waste of cycles, incurred on
_everyone_, for an extremely rare use case that is explicitly
discouraged.  We are not the TSA, and should not adopt their policy of
punishing the innocent 99.99% on behalf of a handful of villains.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 12:10:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 07:10:07 2023
Received: from localhost ([127.0.0.1]:53946 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pabZX-0005Z4-FF
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 07:10:07 -0500
Received: from eggs.gnu.org ([209.51.188.92]:37940)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pabZV-0005Xu-E6
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 07:10:06 -0500
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 <eliz@HIDDEN>)
 id 1pabZP-0003XU-Bp; Fri, 10 Mar 2023 07:09:59 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=QNPwb3hS4u60incqkxSCtOp+/TwTOjyKvBbRH3hx8Tw=; b=IbX0aVOp5MPOLST13ucl
 gL1UNiN+7aVfPcFcmkiLjvBI0RQj+I9MxNMwSFEFthLZfLNEGPDbz3xQhCanhumh6BbvqOckY4o4R
 q2742w0gb9/unUpuHbJFF/2ss9G822CIDqrYWy0ALkY9RtR3qKspp8HPELbew2lSKi4X1yk0BPC7g
 Ox7gk5UsGgb9w4LtQOs1t1g1kYZxINuqOlxtEx5eoFjzE9/7A3oOZrc9+UcdLVJd+B37gpFur2snl
 6f4s2R+aTUORAhdf0oK5kWv7l7vpao4286VLXhhC4sJp30N9+lKl3vqT3/ZhrPIbKlitANy4fbI7Q
 HYYBfGpiYlYyYQ==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pabZO-0008De-ST; Fri, 10 Mar 2023 07:09:59 -0500
Date: Fri, 10 Mar 2023 14:09:41 +0200
Message-Id: <83pm9gzu2i.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
In-Reply-To: <87v8j84zp1.fsf@HIDDEN> (message from Augusto Stoffel on Fri, 
 10 Mar 2023 12:23:54 +0100)
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN>
 <83a60l13p2.fsf@HIDDEN> <16ecbe9ea8ba9d39d058@HIDDEN>
 <a6b6eff0-1aa7-d0e7-3cd9-cc87ae76c421@HIDDEN>
 <16ecbe9ea85b22d008fd@HIDDEN>
 <43460d2c-ba80-0f2f-656c-ef0aca5667b5@HIDDEN>
 <87v8j84zp1.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62009
Cc: philipk@HIDDEN, michael_heerdegen@HIDDEN, mail@HIDDEN,
 gregory@HIDDEN, monnier@HIDDEN, 62009 <at> debbugs.gnu.org
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 (---)

> From: Augusto Stoffel <arstoffel@HIDDEN>
> Cc: Gregory Heytings <gregory@HIDDEN>,  Eli Zaretskii <eliz@HIDDEN>,
>   Philip Kaludercic <philipk@HIDDEN>,  michael_heerdegen@HIDDEN,
>   monnier@HIDDEN,  62009 <at> debbugs.gnu.org
> Date: Fri, 10 Mar 2023 12:23:54 +0100
> 
> On Fri, 10 Mar 2023 at 12:09, Daniel Mendler wrote:
> 
> > On 3/10/23 11:59, Gregory Heytings wrote:
> >> That would also come with a performance overhead, as there is currently no 
> >> way to distinguist strings that are used for symbol names from other 
> >> strings.  Not to mention the added complexity in the code.
> >
> > One could check if the string is located in read-only memory. Or one
> > could add a flag bit to the string data structure (and possibly to other
> > data structures too). Freezing data structures such that they become
> > read-only is a generally useful feature. There won't be any performance
> > overhead of the check since a branch not taken is fast thanks to the
> > branch predictor.
> 
> Note also that in-place modification of strings is arbitrarily costly,
> cf. (aset "ascii" 0 ?😼).  Not to mention that it's rarely a good or
> necessary move to make, as far as programming style is concerned.

Be this tru as it may, we will not constrain what Lisp programs can
legitimately do just because we think it is "rarely a good move".
That's against our long-time policy, which is explain why something
might not be a good idea, but otherwise don't block that, letting the
unwise cope with the consequences of their unwise actions.

IOW, we encourage Lisp programmers to DTRT and not use dangerous
practices, but don't block them if they want to.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 12:00:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 07:00:45 2023
Received: from localhost ([127.0.0.1]:53916 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pabQT-0005GV-KO
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 07:00:45 -0500
Received: from server.qxqx.de ([178.63.65.180]:49465 helo=mail.qxqx.de)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1pabQQ-0005GD-Sz
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 07:00:44 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de;
 s=mail1392553390; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:
 References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Mk+E0wiRRNAzd3G290ADo1Z4FbXBwp1p3zDiR/nKCZo=; b=FtBlrWS8GM5fnNbpgyScipkJVu
 H3UUreG4Iwf46OHfpgprWL4X7rdjs3nRYJYPsguGiAFqDmbdMtafyqAMidDDFA6KnCVYJGXOiUr9w
 Psrx8WspHbanM0VPYuxQUwpP1ccKF3jB8B45g+B2De9T8qOgHjeYicqiLxFLVUYSf76k=;
Message-ID: <e6451c43-480f-4a07-9fee-084116fbe352@HIDDEN>
Date: Fri, 10 Mar 2023 13:00:34 +0100
MIME-Version: 1.0
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
To: Eli Zaretskii <eliz@HIDDEN>
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN> <83a60l13p2.fsf@HIDDEN>
 <87ilf9571k.fsf@HIDDEN> <87edpx56xm.fsf@HIDDEN>
 <83wn3ozuyn.fsf@HIDDEN>
Content-Language: en-US
From: Daniel Mendler <mail@HIDDEN>
In-Reply-To: <83wn3ozuyn.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62009
Cc: philipk@HIDDEN, michael_heerdegen@HIDDEN,
 Robert Pluim <rpluim@HIDDEN>, monnier@HIDDEN,
 62009 <at> debbugs.gnu.org, Augusto Stoffel <arstoffel@HIDDEN>
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 (---)

On 3/10/23 12:50, Eli Zaretskii wrote:
> Why bother?  Emacs is not in the business of preventing Lisp
> programmers from shooting themselves in the foot, certainly not when
> that incurs runtime overhead, even a small one.

Of course Elisp is in the business of preventing programmers from
shooting themselves in the foot, otherwise we would extend Emacs in C.
It is not only that Elisp is easier to write thanks to macros and other
conveniences, but also because it is safer!

I fully agree with you that we should not introduce a performance
regression, in particular not one which increases GC pressure badly.
Furthermore I agree that this is a minor bug which only occurs as an
edge case when some specific strings are mutated.

However the cost of fixing this bug is minor, since Elisp already
supports read-only data stuctures as pointed out by Robert. We may only
need an additional check in aset which won't introduce significant costs
thanks to the branch predictor of CPUs. As Augusto pointed out, aset on
strings can already be very costly because the string must be
reallocated. In comparison, the additional check will be free.

Daniel




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 11:59:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 06:59:58 2023
Received: from localhost ([127.0.0.1]:53911 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pabPh-0005D3-U8
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:59:58 -0500
Received: from eggs.gnu.org ([209.51.188.92]:58708)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pabPg-0005Cg-K9
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:59:57 -0500
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 <eliz@HIDDEN>)
 id 1pabPa-0000On-Jn; Fri, 10 Mar 2023 06:59:50 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=3dbOtZE0CcsU/n1JSEqulQf/qLsEWvxe3jt03Lkmw98=; b=X6UoKWf0GLjb
 YM8N4fbmGMjf0BGlSudXqjz+sn1P1piZDKmxCd8kOsCEim4WgZYIFk/pTvf/w6TRhE8pQANIK11yI
 idmTL7OYk4NdJtmQlPs1McyJDyIId9FUX289bFXbUae/n8xHKMobGbjexukLwQXFxO2TJqMmyD0VC
 9tevgIOXdDTlu39Tgoy+xlZhalGE1NiTRYuQ8LWhLriTQAYLua/4nszCVUCGGK2vO3NNJLW4fbg/H
 M1/cMxDXyHvttSNp/J6/TQR6NplYKwvxd2HhAC91D/JVTBiUP0XaR28+okJ7X+XA0KUN3lJsVaY9W
 /jDjYnkt/+ygr3QOUGhF9A==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pabPY-000848-V1; Fri, 10 Mar 2023 06:59:50 -0500
Date: Fri, 10 Mar 2023 13:59:28 +0200
Message-Id: <83sfeczujj.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Gregory Heytings <gregory@HIDDEN>
In-Reply-To: <16ecbe9ea85b22d008fd@HIDDEN> (message from Gregory
 Heytings on Fri, 10 Mar 2023 10:59:03 +0000)
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN> <83a60l13p2.fsf@HIDDEN>
 <16ecbe9ea8ba9d39d058@HIDDEN>
 <a6b6eff0-1aa7-d0e7-3cd9-cc87ae76c421@HIDDEN>
 <16ecbe9ea85b22d008fd@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62009
Cc: philipk@HIDDEN, michael_heerdegen@HIDDEN, mail@HIDDEN,
 monnier@HIDDEN, 62009 <at> debbugs.gnu.org, arstoffel@HIDDEN
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 (---)

> Date: Fri, 10 Mar 2023 10:59:03 +0000
> From: Gregory Heytings <gregory@HIDDEN>
> cc: Eli Zaretskii <eliz@HIDDEN>, Philip Kaludercic <philipk@HIDDEN>, 
>     michael_heerdegen@HIDDEN, monnier@HIDDEN, 62009 <at> debbugs.gnu.org, 
>     Augusto Stoffel <arstoffel@HIDDEN>
> 
> > Creating a string is not a good idea since it will lead to an 
> > unacceptably large performance overhead.
> 
> Is "symbol-name" a function that is used in performance-critical code? 

Yes, it is.  Just grep for it.  We even call it from C quite a few
times.  And processing is just one aspect of that; memory and GC is
another, not less important.

> And did you actually measure that performance overhead before concluding 
> that it it "unacceptably large"?

Anything greater than zero is unacceptably large from where I stand,
when the other side of the balance is the use case against which this
protects.

> > Raising an exception upon modification would be the best approach.
> 
> That would also come with a performance overhead, as there is currently no 
> way to distinguist strings that are used for symbol names from other 
> strings.  Not to mention the added complexity in the code.

Which is why we should do neither.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 11:59:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 06:59:57 2023
Received: from localhost ([127.0.0.1]:53909 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pabPh-0005D0-Ma
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:59:57 -0500
Received: from heytings.org ([95.142.160.155]:34082)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1pabPg-0005Co-1D
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:59:56 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1678449595;
 bh=ZSzS8OI8cKLhZefvn0uCNvCnkmCij2kh0dlB8Cd2SUY=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=7DL72jzCoN2NPztbMeWKNX3W84qXzTasdehfKRqybxMauyGwM3ngz+GT1Qdu3GU+Q
 3TQUNnqsMNsmU6D4VTI/AGYdVIYM1KsYFBSww6M7fE7tftRNumrOii44UVT32Jx/4u
 VIW00Zu66DXBcTewNbsryS3S8O6xnc/RIQBLTUguJFVQCclRyNi3cuXAksxSdEIeMm
 3V5fAG/VsRyiL7PGUO1Np57UQD6ZLnLEG2cRv/AefyC5yzH6D2R3IEyQMRnUn34jZT
 ps2fZW4bk4F/v1cisEPMKF1eLU5P/gDY4JnKfBQ8VxAJx5H8nDOVvDIXTDLLZOFQWa
 cXIFdEeScY4aA==
Date: Fri, 10 Mar 2023 11:59:54 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
In-Reply-To: <83v8j8zutj.fsf@HIDDEN>
Message-ID: <16ecbe9ea800de5b4089@HIDDEN>
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN> <83a60l13p2.fsf@HIDDEN>
 <16ecbe9ea8ba9d39d058@HIDDEN> <83v8j8zutj.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 62009
Cc: michael_heerdegen@HIDDEN, mail@HIDDEN, philipk@HIDDEN,
 monnier@HIDDEN, 62009 <at> debbugs.gnu.org
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: -1.0 (-)


>
> No, we will NOT increase GC pressure in Emacs just because someone could 
> do a silly and nonsensical thing.  No way.
>

I agree with you that this is not really a bug, so doing nothing is fine 
for me, too.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 11:57:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 06:57:46 2023
Received: from localhost ([127.0.0.1]:53903 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pabNa-00058g-67
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:57:46 -0500
Received: from heytings.org ([95.142.160.155]:34062)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1pabNY-00058Y-L9
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:57:45 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1678449463;
 bh=cIIan/0C4PVWB+EtfiDUaK8BwjHHnavUgYXoii8dSpM=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=gbxON/Ql2gcATBPKZgGclvL+y5dVMCibTeopec5SpjpxiZM24RPwuSQiWWdXsyZPm
 HU6f2QoswDNVO0s7TOAadmU99wCA6xlz+IJtA8wIzcGOrKiZRZgdSZXebIN2jw8/qa
 +R+Z/f3+nqNvRBvk5wSGaSRJTeuFUcLRT3F3CAKkPlyfXhHm9NbzA448WII5NwYuio
 uxMWaqXHTyaq5euA+eQBgLE3atk2VlwB+e+pnjfws8AzplS+6/R8QS3+8IBR4E3lDa
 4+GvytWh04ZTPb6G6uNEXKRhRV3KFpnli6/rgviPIbKfGcBdla7DVXxgQDtVgGIQs7
 WyiKL3EfCMFNw==
Date: Fri, 10 Mar 2023 11:57:43 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Robert Pluim <rpluim@HIDDEN>
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
In-Reply-To: <87fsacx2qf.fsf@HIDDEN>
Message-ID: <16ecbe9ea8d500fa1a07@HIDDEN>
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN> <83a60l13p2.fsf@HIDDEN>
 <16ecbe9ea8ba9d39d058@HIDDEN>
 <a6b6eff0-1aa7-d0e7-3cd9-cc87ae76c421@HIDDEN>
 <16ecbe9ea85b22d008fd@HIDDEN>
 <43460d2c-ba80-0f2f-656c-ef0aca5667b5@HIDDEN>
 <87fsacx2qf.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=us-ascii
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 62009
Cc: Philip Kaludercic <philipk@HIDDEN>, michael_heerdegen@HIDDEN,
 Daniel Mendler <mail@HIDDEN>, monnier@HIDDEN,
 62009 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Augusto Stoffel <arstoffel@HIDDEN>
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: -1.0 (-)


>
> diff --git a/src/lisp.h b/src/lisp.h
> index 1276285e2f2..80bbb047824 100644
> --- a/src/lisp.h
> +++ b/src/lisp.h
> @@ -1685,6 +1685,8 @@ SREF (Lisp_Object string, ptrdiff_t index)
> INLINE void
> SSET (Lisp_Object string, ptrdiff_t index, unsigned char new)
> {
> +  if (XSTRING (string)->u.s.size_byte == -2)
> +    Fsignal (Qsetting_constant, string);
>   SDATA (string)[index] = new;
> }
> INLINE ptrdiff_t
>

That flag is useful only for the first part of the bug: setting the symbol 
name of a function defined in C.  It does not prevent changing symbol 
names in general, e.g. (aset (symbol-name 'find-file) 1 ?o).





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 11:53:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 06:53:56 2023
Received: from localhost ([127.0.0.1]:53894 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pabJs-00051L-5u
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:53:56 -0500
Received: from eggs.gnu.org ([209.51.188.92]:49262)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pabJq-000513-PQ
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:53:55 -0500
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 <eliz@HIDDEN>)
 id 1pabJl-0007nd-E5; Fri, 10 Mar 2023 06:53:49 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=TJQNXvdVYwB/4dP35p3VJjea35FxnuNyraErWyWSKiQ=; b=I9G7AFwKEvgW
 yD4l/P7yvToUDdwIFGEw7yGSuASHVJzp7baXTValXv6eYvjegAs1fy11SjmpnHLlMojc4EfiVG3Gw
 CvR6hFv314b9ZvXItNxnE63tG2erGSYNu8mtKUreUKf9aug95jp0iBTkBNFwkTIqnOYF27j/DKnVN
 YlwPSRbHSdNcdwRcrFXzJq1YCYfrAUOQhb/p2G8YktPayRucsrfwOf8SR5I0X02NaMVC8YASzzVHt
 4zlXFgnTXOc1GMZZkf4M9YNjnF5U5DGaq1bXsOjfA3O8/BADpL97Fnew37YUI7InPLsDFA63/hhbb
 IJqCDBqMCIGohj2sYsctzA==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pabJk-0002gN-Pd; Fri, 10 Mar 2023 06:53:49 -0500
Date: Fri, 10 Mar 2023 13:53:28 +0200
Message-Id: <83v8j8zutj.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Gregory Heytings <gregory@HIDDEN>
In-Reply-To: <16ecbe9ea8ba9d39d058@HIDDEN> (message from Gregory
 Heytings on Fri, 10 Mar 2023 09:40:31 +0000)
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN> <83a60l13p2.fsf@HIDDEN>
 <16ecbe9ea8ba9d39d058@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62009
Cc: michael_heerdegen@HIDDEN, mail@HIDDEN, philipk@HIDDEN,
 monnier@HIDDEN, 62009 <at> debbugs.gnu.org
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 (---)

> Date: Fri, 10 Mar 2023 09:40:31 +0000
> From: Gregory Heytings <gregory@HIDDEN>
> cc: Philip Kaludercic <philipk@HIDDEN>, michael_heerdegen@HIDDEN, 
>     mail@HIDDEN, monnier@HIDDEN, 62009 <at> debbugs.gnu.org
> 
> 
> Instead of raising a signal, I suggest:
> 
> diff --git a/src/data.c b/src/data.c
> index 0f1d881e00b..76867d6787e 100644
> --- a/src/data.c
> +++ b/src/data.c
> @@ -780,7 +780,7 @@ DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 
> 1, 0,
> 
>     CHECK_SYMBOL (symbol);
>     name = SYMBOL_NAME (symbol);
> -  return name;
> +  return build_string (SSDATA (name));
>   }
> 
>   DEFUN ("bare-symbol", Fbare_symbol, Sbare_symbol, 1, 1, 0,

No, we will NOT increase GC pressure in Emacs just because someone
could do a silly and nonsensical thing.  No way.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 11:50:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 06:50:53 2023
Received: from localhost ([127.0.0.1]:53888 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pabGv-0004vM-HZ
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:50:53 -0500
Received: from eggs.gnu.org ([209.51.188.92]:57314)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pabGt-0004v9-Uo
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:50:52 -0500
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 <eliz@HIDDEN>)
 id 1pabGo-0007IA-DP; Fri, 10 Mar 2023 06:50:46 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=B1HDLo80qcOktVGj1UKF/mhiP/HGWZ/a0MZyqG0oiis=; b=qEL7Y0OdCPQW
 /3unPzXW632tcH9x6qN+l/HDqOMKuLAy5qDEh6wgRPSVZKOHEzuQuTonQY+c50ZW4ydEuUnfh7hdg
 5RcxF0HmiOszTP4XgAiBki/K8CjfklogIlXhGFjMMvef8nBqLxkMz4k/0uhCP9mxubQyVwE3/DG6p
 zp5NN5ZpYRb0cZ8u4A3hd6XDI2LhqNdcw4+y0E8ZxLZFsPoUY2r9A9COg8+29kriqcFU19Jf8i5JF
 4ZLiO4QcVz4kNWWkM1JjbSQ4xMVhWMkOkwkoREm/aVkkFZyQ2K7DqMwc3jVDD84PY+5nJcQfIvODc
 VKanJNxBwQE6dHY0OGAuWQ==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pabGj-0002FN-J7; Fri, 10 Mar 2023 06:50:45 -0500
Date: Fri, 10 Mar 2023 13:50:24 +0200
Message-Id: <83wn3ozuyn.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
In-Reply-To: <87edpx56xm.fsf@HIDDEN> (message from Augusto Stoffel on Fri, 
 10 Mar 2023 09:47:33 +0100)
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN>
 <83a60l13p2.fsf@HIDDEN> <87ilf9571k.fsf@HIDDEN>
 <87edpx56xm.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62009
Cc: michael_heerdegen@HIDDEN, mail@HIDDEN, philipk@HIDDEN,
 monnier@HIDDEN, 62009 <at> debbugs.gnu.org
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 (---)

> From: Augusto Stoffel <arstoffel@HIDDEN>
> Cc: Philip Kaludercic <philipk@HIDDEN>,  michael_heerdegen@HIDDEN,
>   mail@HIDDEN,  monnier@HIDDEN,  62009 <at> debbugs.gnu.org
> Date: Fri, 10 Mar 2023 09:47:33 +0100
> 
> On Fri, 10 Mar 2023 at 09:45, Augusto Stoffel wrote:
> 
> > On Fri, 10 Mar 2023 at 09:11, Eli Zaretskii wrote:
> >
> >>> Is it not possible to detect this before the illegal memory access, and
> >>> raise a signal in Emacs Lisp?
> >>
> >> It won't be easy, if at all possible.  And I'm not sure we even want
> >> to do that.  What would be the purpose of supporting such a use of
> >> Emacs?
> >
> > What is the purpose of supporting mutation of symbol names in general?
> >
> >   (aset (symbol-name 'find-file) 1 ?o)
> >   (fboundp 'find-file)
> >   => nil
> >
> > This one doesn't crash Emacs, but wreaks havoc, maybe in even worse
> > ways.
> 
> (To clarify, I think this of course should raise a signal.)

Why bother?  Emacs is not in the business of preventing Lisp
programmers from shooting themselves in the foot, certainly not when
that incurs runtime overhead, even a small one.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 11:49:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 06:49:32 2023
Received: from localhost ([127.0.0.1]:53882 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pabFc-0004sW-3e
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:49:32 -0500
Received: from eggs.gnu.org ([209.51.188.92]:32990)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pabFa-0004sF-Dr
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:49:30 -0500
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 <eliz@HIDDEN>)
 id 1pabFT-0006ma-Og; Fri, 10 Mar 2023 06:49:23 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=2t1X6GvDj2QV49uwcTjHTFv48CO4HBs9UjwU/h1KEtI=; b=l56Re7/u9kVZ
 qFs6fxaqRHHrq26JJNa4YzQpXcAsBwKza0ljatXFptou0s8Z9AHcwNUdDQfmmTftClkAL7QwOU7GQ
 ja/tDZJHayT2urKA0CSivYX2eA+kOnbUSaGOOL0blzkVBeDOj6CP453hXLAkcxIkivHc1zyR4z75q
 jnH9ytRKcDWTTIlSgX0o4M5B3a/clc37M/0gfGmbx8N/Zbqk1be8wcb7MbexXYbsQVTY+6cJaxG1+
 L1hUtJa5jpYHdfywRQxT+Kqs7p7lYdF5lyClJcQL3ktFVBjRupoiY11s7HorFwbG8Mpx8aQ2uv/JZ
 0/PHewDuC79nF7urKGP2fA==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pabFT-00020N-7E; Fri, 10 Mar 2023 06:49:23 -0500
Date: Fri, 10 Mar 2023 13:49:04 +0200
Message-Id: <83y1o4zv0v.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
In-Reply-To: <87ilf9571k.fsf@HIDDEN> (message from Augusto Stoffel on Fri, 
 10 Mar 2023 09:45:11 +0100)
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN>
 <83a60l13p2.fsf@HIDDEN> <87ilf9571k.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62009
Cc: michael_heerdegen@HIDDEN, mail@HIDDEN, philipk@HIDDEN,
 monnier@HIDDEN, 62009 <at> debbugs.gnu.org
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 (---)

> From: Augusto Stoffel <arstoffel@HIDDEN>
> Cc: Philip Kaludercic <philipk@HIDDEN>,  michael_heerdegen@HIDDEN,
>   mail@HIDDEN,  monnier@HIDDEN,  62009 <at> debbugs.gnu.org
> Date: Fri, 10 Mar 2023 09:45:11 +0100
> 
> On Fri, 10 Mar 2023 at 09:11, Eli Zaretskii wrote:
> 
> >> Is it not possible to detect this before the illegal memory access, and
> >> raise a signal in Emacs Lisp?
> >
> > It won't be easy, if at all possible.  And I'm not sure we even want
> > to do that.  What would be the purpose of supporting such a use of
> > Emacs?
> 
> What is the purpose of supporting mutation of symbol names in general?

We don't.  Whoever does this is on their own.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 11:36:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 06:36:29 2023
Received: from localhost ([127.0.0.1]:53864 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pab2z-0004OT-28
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:36:29 -0500
Received: from server.qxqx.de ([178.63.65.180]:53847 helo=mail.qxqx.de)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1pab2x-0004O8-70
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:36:27 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de;
 s=mail1392553390; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:
 References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=GnYHqRI1SDwqJyNelNdWFM55hN+/qbDqWXuNGeo1ZOc=; b=JQhizzC/Bg4432u8VUZDLtz5Vv
 vgZHp5vvhRgOCDm6ek1WUZidsjnaUFe5vUDI6CtL1JQpYXkh3xaquNNCemOFU4NowfAjATl9Fj+92
 yVoNoTz78SYy7Y8ipBr4TpJ45qKcL91qATgSGdNbP+65uv4GYwAo8IEldVsTK46n4S3o=;
Message-ID: <3a9f613f-baa9-2c48-f779-aaf43363a865@HIDDEN>
Date: Fri, 10 Mar 2023 12:36:17 +0100
MIME-Version: 1.0
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
Content-Language: en-US
To: Robert Pluim <rpluim@HIDDEN>
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN> <83a60l13p2.fsf@HIDDEN>
 <16ecbe9ea8ba9d39d058@HIDDEN>
 <a6b6eff0-1aa7-d0e7-3cd9-cc87ae76c421@HIDDEN>
 <16ecbe9ea85b22d008fd@HIDDEN>
 <43460d2c-ba80-0f2f-656c-ef0aca5667b5@HIDDEN>
 <87fsacx2qf.fsf@HIDDEN>
From: Daniel Mendler <mail@HIDDEN>
In-Reply-To: <87fsacx2qf.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62009
Cc: Philip Kaludercic <philipk@HIDDEN>, michael_heerdegen@HIDDEN,
 Gregory Heytings <gregory@HIDDEN>, monnier@HIDDEN,
 62009 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Augusto Stoffel <arstoffel@HIDDEN>
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 (---)

On 3/10/23 12:30, Robert Pluim wrote:
>>>>>> On Fri, 10 Mar 2023 12:09:59 +0100, Daniel Mendler <mail@HIDDEN> said:
> 
>     Daniel> One could check if the string is located in read-only memory. Or one
>     Daniel> could add a flag bit to the string data structure (and possibly to other
>     Daniel> data structures too). Freezing data structures such that they become
>     Daniel> read-only is a generally useful feature. There won't be any performance
>     Daniel> overhead of the check since a branch not taken is fast thanks to the
>     Daniel> branch predictor.
> 
> We already have such a flag:
> 
>       /* Number of characters in string; MSB is used as the mark bit.  */
>       ptrdiff_t size;
>       /* If nonnegative, number of bytes in the string (which is multibyte).
> 	 If negative, the string is unibyte:
> 	 -1 for data normally allocated
> 	 -2 for data in rodata (C string constants)
> 	 -3 for data that must be immovable (used for bytecode)  */
>       ptrdiff_t size_byte;

Thanks! That's good. Given that a read only flag already exists, it is
easy to fix the issue. We just have to make sure that the size is
negative for the symbol names and add a check in `aset`.

Daniel




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 11:30:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 06:30:59 2023
Received: from localhost ([127.0.0.1]:53846 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1paaxf-0004CB-3s
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:30:59 -0500
Received: from mail-wr1-f41.google.com ([209.85.221.41]:47082)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rpluim@HIDDEN>) id 1paaxb-0004Bw-RF
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:30:58 -0500
Received: by mail-wr1-f41.google.com with SMTP id bw19so4702419wrb.13
 for <62009 <at> debbugs.gnu.org>; Fri, 10 Mar 2023 03:30:55 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20210112; t=1678447850;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=LKRB7/twUIIQLZCOIZWS0GZt6C1dC5i/lt9hkVdcGj0=;
 b=gK2kx2mqo/1KSeVa5iygzuLkJ9IAzDTVVT7qemg51/aPbce09uuOOk0EcTJW8vVk41
 PMiCOhM5Ysk3r5TvUAUVRYMYM8Wmd/R6haEi10ha/m5CAyVjgZoXw5LYPke13Jwi2cHh
 hRTs6X6a4b2wohjWkFUiozhWyFkBJnWQa83HzvG20vUKzU7CukZzQdmG7Vrr+R5flARf
 LcZvrkN/tbenRdXBUz9mcSAyGqk5CNLiHCtuaDjgBL6Rial/oMKNIS/HHdj63KBLrx0I
 Qry3FXXLoH5JD4OHlMmX6zQKID9OVLjqnj0SI7XGiT3+UrSgKAyVO+kGioMQXGqafafj
 WwEA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1678447850;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=LKRB7/twUIIQLZCOIZWS0GZt6C1dC5i/lt9hkVdcGj0=;
 b=dIfX7LS6+Lb17WO3f0/ZFUqgMzRfD/h5vSBhJmgsAuYenwnl69akXCsdMaxof/4TKI
 L2I7uvQxlYmhtioktUhum+eagxZ97yUTxWoCBeaJOpLm0Al7+dqKCoNeAfVmEFHzlrtk
 y8quta36Sgll4aHFNqZPgze8paYtzdP5rcMOG/nmgS2yDWDjrlJfLQZUFeOU64dN4Rtm
 RkRGzwrjXoLYDDJcbY3mxVUiBZh+4rObU1VohVNyC17Czc8smcUYe2MURn99Da2XHy48
 wWkou0TDds/J6bxMjkKGR2cl5tPYK/UMUVtZk09EZfV6Egynz+2QyLY/LJWufAojwsl+
 Se+A==
X-Gm-Message-State: AO0yUKVurs6sjMQIn7EssNYU/CyQI5mgm2WX8Uk3CN0lSmWQ1Pd5epxO
 rOxKDe9qopL0p3t8owvakHg=
X-Google-Smtp-Source: AK7set/VQkm3DJR4ODbo2cYAgMpoth0lLVKXSbQjXAShElG9BNBZS9h6Z+i0HL8lDKJAhWO1agWoRQ==
X-Received: by 2002:a5d:66ce:0:b0:2c7:8f73:7700 with SMTP id
 k14-20020a5d66ce000000b002c78f737700mr16785711wrw.39.1678447849607; 
 Fri, 10 Mar 2023 03:30:49 -0800 (PST)
Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id
 y12-20020adffa4c000000b002c5706f7c6dsm1937152wrr.94.2023.03.10.03.30.48
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 10 Mar 2023 03:30:49 -0800 (PST)
From: Robert Pluim <rpluim@HIDDEN>
To: Daniel Mendler <mail@HIDDEN>
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
In-Reply-To: <43460d2c-ba80-0f2f-656c-ef0aca5667b5@HIDDEN> (Daniel
 Mendler's message of "Fri, 10 Mar 2023 12:09:59 +0100")
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN>
 <83a60l13p2.fsf@HIDDEN> <16ecbe9ea8ba9d39d058@HIDDEN>
 <a6b6eff0-1aa7-d0e7-3cd9-cc87ae76c421@HIDDEN>
 <16ecbe9ea85b22d008fd@HIDDEN>
 <43460d2c-ba80-0f2f-656c-ef0aca5667b5@HIDDEN>
Date: Fri, 10 Mar 2023 12:30:48 +0100
Message-ID: <87fsacx2qf.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62009
Cc: Philip Kaludercic <philipk@HIDDEN>, michael_heerdegen@HIDDEN,
 Gregory Heytings <gregory@HIDDEN>, monnier@HIDDEN,
 62009 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Augusto Stoffel <arstoffel@HIDDEN>
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: -1.0 (-)

>>>>> On Fri, 10 Mar 2023 12:09:59 +0100, Daniel Mendler <mail@HIDDEN> said:

    Daniel> One could check if the string is located in read-only memory. Or one
    Daniel> could add a flag bit to the string data structure (and possibly to other
    Daniel> data structures too). Freezing data structures such that they become
    Daniel> read-only is a generally useful feature. There won't be any performance
    Daniel> overhead of the check since a branch not taken is fast thanks to the
    Daniel> branch predictor.

We already have such a flag:

      /* Number of characters in string; MSB is used as the mark bit.  */
      ptrdiff_t size;
      /* If nonnegative, number of bytes in the string (which is multibyte).
	 If negative, the string is unibyte:
	 -1 for data normally allocated
	 -2 for data in rodata (C string constants)
	 -3 for data that must be immovable (used for bytecode)  */
      ptrdiff_t size_byte;

Try this:

diff --git a/src/lisp.h b/src/lisp.h
index 1276285e2f2..80bbb047824 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1685,6 +1685,8 @@ SREF (Lisp_Object string, ptrdiff_t index)
 INLINE void
 SSET (Lisp_Object string, ptrdiff_t index, unsigned char new)
 {
+  if (XSTRING (string)->u.s.size_byte == -2)
+    Fsignal (Qsetting_constant, string);
   SDATA (string)[index] = new;
 }
 INLINE ptrdiff_t

Robert
-- 




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 11:24:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 06:24:05 2023
Received: from localhost ([127.0.0.1]:53832 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1paaqz-0003mt-0U
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:24:05 -0500
Received: from mail-ed1-f46.google.com ([209.85.208.46]:43551)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1paaqx-0003mJ-9D
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:24:03 -0500
Received: by mail-ed1-f46.google.com with SMTP id x3so19021095edb.10
 for <62009 <at> debbugs.gnu.org>; Fri, 10 Mar 2023 03:24:03 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20210112; t=1678447437;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=S/hKncmTanA2DZZqQd6TizZDScLjczxPvXz/BQhYNR8=;
 b=pEjrbGepD+UIfAJ5kY+0PIzjPnzPkSu5AhSq400rhyWx/2UbioJruFMgciVfgtp087
 QeWtkc738CSilzLF3NuBb/ivF1U+bCVd9gdtI7SjMPE9z6OTJew5FQGjpeSySUl3REN8
 Dnx+/myYFgVsy8Pyi3Z5nHIU2s6ip3soIlaqBmddwt5uqDf/WFybMHe9k3B6AU5T8khG
 T23U3wal3dkg8ckXfrHJU+3xOaKdIhDLdZo62ZDbMGzPnay6YQabtOpG0RE6GLcEjmpo
 eziVa9cUwInjCFmnX/Vcv9dfSoGTciXlAAPBB/rELsvoXWZop2Ai0H4YMuVQLt+E4Ek8
 EvGQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1678447437;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=S/hKncmTanA2DZZqQd6TizZDScLjczxPvXz/BQhYNR8=;
 b=5QBQldw/b3m79ciRLE2XHwwrV0yu+5mxL6c5uMsjM/zuqm1NLoPfyetVL4Rh1DFVUh
 udgFt1x+HXa6gpXF2DMBsuMc0pwByMaurenCS+zke6j0hVpVZ5tUeewB8PLJgWPG1OTT
 R0n2RQw3fwnbztDoGC8/xQcV6P61F5mbCZGrxIfaKUfmT8kJddB7+Q2nab1IIuNDTYEP
 zTTXUtirRsflzgett5mNa5UX74Y7TBsHx2DppEn2pQs//2XewcckNF+hOxt7JpQBGw7f
 o7ct0ExBjMQxCfLO6vnoTo5mWoyZF0XAKCsx5tF+u7ytG5USiIG6x9yzHSRDT5CMrNWl
 HAOw==
X-Gm-Message-State: AO0yUKV8y4sPvFPRge9XiWaRf7Ee4mgHzwgppIMz7nmsB330rGhjul7o
 cgwMVtvbexiIWaViPaCrEDSF3BwpEaf8xA==
X-Google-Smtp-Source: AK7set8FuOZ1vxgvFdKwvcRu9hCcd/ydDVY2RuMTpzZBVTpXi+YGrTIEQEGD5ZQc3XHXaWtCbi89Nw==
X-Received: by 2002:a17:906:398a:b0:88d:d700:fe15 with SMTP id
 h10-20020a170906398a00b0088dd700fe15mr25273399eje.0.1678447436810; 
 Fri, 10 Mar 2023 03:23:56 -0800 (PST)
Received: from ars3 ([2a02:8109:8ac0:56d0::8b3a])
 by smtp.gmail.com with ESMTPSA id
 qc18-20020a170906d8b200b008d9c518a318sm852805ejb.142.2023.03.10.03.23.55
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 10 Mar 2023 03:23:56 -0800 (PST)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: Daniel Mendler <mail@HIDDEN>
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
In-Reply-To: <43460d2c-ba80-0f2f-656c-ef0aca5667b5@HIDDEN> (Daniel
 Mendler's message of "Fri, 10 Mar 2023 12:09:59 +0100")
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN>
 <83a60l13p2.fsf@HIDDEN> <16ecbe9ea8ba9d39d058@HIDDEN>
 <a6b6eff0-1aa7-d0e7-3cd9-cc87ae76c421@HIDDEN>
 <16ecbe9ea85b22d008fd@HIDDEN>
 <43460d2c-ba80-0f2f-656c-ef0aca5667b5@HIDDEN>
Date: Fri, 10 Mar 2023 12:23:54 +0100
Message-ID: <87v8j84zp1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62009
Cc: Philip Kaludercic <philipk@HIDDEN>, michael_heerdegen@HIDDEN,
 Gregory Heytings <gregory@HIDDEN>, monnier@HIDDEN,
 62009 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>
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: -1.0 (-)

On Fri, 10 Mar 2023 at 12:09, Daniel Mendler wrote:

> On 3/10/23 11:59, Gregory Heytings wrote:
>> That would also come with a performance overhead, as there is currently =
no=20
>> way to distinguist strings that are used for symbol names from other=20
>> strings.  Not to mention the added complexity in the code.
>
> One could check if the string is located in read-only memory. Or one
> could add a flag bit to the string data structure (and possibly to other
> data structures too). Freezing data structures such that they become
> read-only is a generally useful feature. There won't be any performance
> overhead of the check since a branch not taken is fast thanks to the
> branch predictor.

Note also that in-place modification of strings is arbitrarily costly,
cf. (aset "ascii" 0 ?=F0=9F=98=BC).  Not to mention that it's rarely a good=
 or
necessary move to make, as far as programming style is concerned.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 11:10:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 06:10:10 2023
Received: from localhost ([127.0.0.1]:53799 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1paadW-0003NL-KN
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:10:10 -0500
Received: from server.qxqx.de ([178.63.65.180]:55721 helo=mail.qxqx.de)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1paadU-0003N4-SJ
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 06:10:09 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de;
 s=mail1392553390; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:
 References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=RW9wvMKL6iZ555hLtij0V/3l014uS/3myP1ojNmJoG0=; b=w5ZQ0W0NwCvKokqpYNaoSU4Qe/
 VXcdATlUZUTPzGLz7idjBKHgBRPkL3TsNe/O7pUav2HHfCDNWx1hPOZvKf1/RD7XVmrg7UugPQw4C
 vhxDZwFXL8vJdKDtIj/N0xdSdGwYvN2T63mKZpMyteBMlaVnXBAqwsQD+ABuPLrkP18M=;
Message-ID: <43460d2c-ba80-0f2f-656c-ef0aca5667b5@HIDDEN>
Date: Fri, 10 Mar 2023 12:09:59 +0100
MIME-Version: 1.0
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
To: Gregory Heytings <gregory@HIDDEN>
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN> <83a60l13p2.fsf@HIDDEN>
 <16ecbe9ea8ba9d39d058@HIDDEN>
 <a6b6eff0-1aa7-d0e7-3cd9-cc87ae76c421@HIDDEN>
 <16ecbe9ea85b22d008fd@HIDDEN>
Content-Language: en-US
From: Daniel Mendler <mail@HIDDEN>
In-Reply-To: <16ecbe9ea85b22d008fd@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62009
Cc: Philip Kaludercic <philipk@HIDDEN>, michael_heerdegen@HIDDEN,
 monnier@HIDDEN, 62009 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Augusto Stoffel <arstoffel@HIDDEN>
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 (---)

On 3/10/23 11:59, Gregory Heytings wrote:
> Is "symbol-name" a function that is used in performance-critical code? 
> And did you actually measure that performance overhead before concluding 
> that it it "unacceptably large"?  According to my measurements, creating a 
> string from a symbol name costs about 100 CPU cycles.

Yes, of course, for example completion. It would add cost all over the
place in many packages. Also note the added GC pressure. It is not a
good idea to change symbol-name now to allocate strings.

>> Raising an exception upon modification would be the best approach.
>>
> 
> That would also come with a performance overhead, as there is currently no 
> way to distinguist strings that are used for symbol names from other 
> strings.  Not to mention the added complexity in the code.

One could check if the string is located in read-only memory. Or one
could add a flag bit to the string data structure (and possibly to other
data structures too). Freezing data structures such that they become
read-only is a generally useful feature. There won't be any performance
overhead of the check since a branch not taken is fast thanks to the
branch predictor.

Daniel




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 10:59:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 05:59:08 2023
Received: from localhost ([127.0.0.1]:53795 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1paaSp-00036A-Pf
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 05:59:08 -0500
Received: from heytings.org ([95.142.160.155]:33946)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1paaSm-000360-PU
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 05:59:05 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1678445943;
 bh=eKzxqHXdVyOcXkCF8K+BvWA9bjF5g82NavgfphwU7ZM=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=b1HzvHq76K+xZDQJc9x3PLGe4i99zL56w5wuUpa1HKLIc5le25cg1d5221QNPo/JB
 sRvXv7PChZE6pcy0vBZaSkj/q6Sm2Yoz+eUqSoZO6wkVGWLKC/4hRGkGT4CTDK3nGI
 s/sWowgS9VqFS8+ZnIW3kWHEFj0OpIbO1MbkOt9Yb5zBUjvisIxSs7ma6tH1p2nfzE
 BQXF80aCHrdjWE6ng7y5E4iTi7UNpdDsFP02/3t4Voao4ETHH5y0AEuwaY6ZFsNjV1
 y6YxQaiEBLnvcErwDu0oU58isy5VT4DH1JG2825fBNAkz6JLVkbP6um2RV2M6VrIsq
 e5f/+RnwxWMgA==
Date: Fri, 10 Mar 2023 10:59:03 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Daniel Mendler <mail@HIDDEN>
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
In-Reply-To: <a6b6eff0-1aa7-d0e7-3cd9-cc87ae76c421@HIDDEN>
Message-ID: <16ecbe9ea85b22d008fd@HIDDEN>
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN> <83a60l13p2.fsf@HIDDEN>
 <16ecbe9ea8ba9d39d058@HIDDEN>
 <a6b6eff0-1aa7-d0e7-3cd9-cc87ae76c421@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=us-ascii
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 62009
Cc: Philip Kaludercic <philipk@HIDDEN>, michael_heerdegen@HIDDEN,
 monnier@HIDDEN, 62009 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Augusto Stoffel <arstoffel@HIDDEN>
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: -1.0 (-)


>
> Creating a string is not a good idea since it will lead to an 
> unacceptably large performance overhead.
>

Is "symbol-name" a function that is used in performance-critical code? 
And did you actually measure that performance overhead before concluding 
that it it "unacceptably large"?  According to my measurements, creating a 
string from a symbol name costs about 100 CPU cycles.

>
> Raising an exception upon modification would be the best approach.
>

That would also come with a performance overhead, as there is currently no 
way to distinguist strings that are used for symbol names from other 
strings.  Not to mention the added complexity in the code.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 10:31:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 05:31:34 2023
Received: from localhost ([127.0.0.1]:53750 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1paa2A-0002Km-CV
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 05:31:34 -0500
Received: from server.qxqx.de ([178.63.65.180]:45569 helo=mail.qxqx.de)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1paa28-0002KI-AT
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 05:31:33 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de;
 s=mail1392553390; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:
 References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Kh0e4KS/SjdEc0f9tCR+yXKoRd8VG/Pf9eLXIY4YNGE=; b=SamtiodEelkGpsOcPrFR3swiCB
 rWdMG4vkSKqA5h+/LOwq+AAS/NtxU/PFmfBeaF27lMfYGRg84L2YqoKztCG6ThLE+DRtGdSxt/1dw
 Qlu1HWa5ibpMMm2UXgInAq6PgXN90PBevzsjGuTa2z0hz7/qgUOacIrs7sCVarMdDq/A=;
Message-ID: <a6b6eff0-1aa7-d0e7-3cd9-cc87ae76c421@HIDDEN>
Date: Fri, 10 Mar 2023 11:31:22 +0100
MIME-Version: 1.0
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
To: Gregory Heytings <gregory@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN> <83a60l13p2.fsf@HIDDEN>
 <16ecbe9ea8ba9d39d058@HIDDEN>
Content-Language: en-US
From: Daniel Mendler <mail@HIDDEN>
In-Reply-To: <16ecbe9ea8ba9d39d058@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62009
Cc: michael_heerdegen@HIDDEN, Philip Kaludercic <philipk@HIDDEN>,
 Augusto Stoffel <arstoffel@HIDDEN>, monnier@HIDDEN,
 62009 <at> debbugs.gnu.org
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 (---)

On 3/10/23 10:40, Gregory Heytings wrote:
> Instead of raising a signal, I suggest:
> 
> diff --git a/src/data.c b/src/data.c
> index 0f1d881e00b..76867d6787e 100644
> --- a/src/data.c
> +++ b/src/data.c
> @@ -780,7 +780,7 @@ DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 
> 1, 0,
> 
>     CHECK_SYMBOL (symbol);
>     name = SYMBOL_NAME (symbol);
> -  return name;
> +  return build_string (SSDATA (name));
>   }
> 
>   DEFUN ("bare-symbol", Fbare_symbol, Sbare_symbol, 1, 1, 0,

Creating a string is not a good idea since it will lead to an
unacceptably large performance overhead. Raising an exception upon
modification would be the best approach.

Daniel




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 09:40:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 04:40:35 2023
Received: from localhost ([127.0.0.1]:53709 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1paZEp-0000rw-99
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 04:40:35 -0500
Received: from heytings.org ([95.142.160.155]:33838)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1paZEn-0000rm-9F
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 04:40:33 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1678441231;
 bh=gXAdIRMCzMmLr53hkpsWcwsOoK76/lHi/c+WkOfYjCM=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=1iLarJM1Y2S4G74D+yolHVijqSjBe0gUFX2vJEvLWH1fZqLvmOsO5d8YF/tLa9ACN
 H08NtuyzX0DbedV86hD/G27s42Va4FYWcuJ1IepGcD9b4ZGnf+iJ4vw6Tc4+MHeFko
 hCnlrlFFY0LvJdkLVxSOpcCMpSzpHkymjtVn4DtcFgIAnnHoNssSXIMWZiCoz1UIAL
 3MZRCx0OqGr/xZNZ/WiZcvXnfBYEjz4WjSx66JXlqF6Ji1912+AVUyKE06Rz5qWs5V
 6+sn+LNX31bK1xUvmbDbvqVvF+NPzEUNtzMGOG8+1w0D+6tfqpmeUx4RlwellSyAWI
 Mn4gBJ7A0b/Cw==
Date: Fri, 10 Mar 2023 09:40:31 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
In-Reply-To: <83a60l13p2.fsf@HIDDEN>
Message-ID: <16ecbe9ea8ba9d39d058@HIDDEN>
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN> <83a60l13p2.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 62009
Cc: michael_heerdegen@HIDDEN, mail@HIDDEN,
 Philip Kaludercic <philipk@HIDDEN>, monnier@HIDDEN,
 62009 <at> debbugs.gnu.org
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: -1.0 (-)


>>> AFAICT, they _are_ frozen.  These names are in read-only memory, where 
>>> you cannot write.  That's why Emacs crashes, AFAIU: the code is trying 
>>> to write to protected memory.
>>>
>>> Just don't do that, cause it's gonna hurt...
>>
>> Is it not possible to detect this before the illegal memory access, and 
>> raise a signal in Emacs Lisp?
>
> It won't be easy, if at all possible.  And I'm not sure we even want to 
> do that.  What would be the purpose of supporting such a use of Emacs?
>

Instead of raising a signal, I suggest:

diff --git a/src/data.c b/src/data.c
index 0f1d881e00b..76867d6787e 100644
--- a/src/data.c
+++ b/src/data.c
@@ -780,7 +780,7 @@ DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 
1, 0,

    CHECK_SYMBOL (symbol);
    name = SYMBOL_NAME (symbol);
-  return name;
+  return build_string (SSDATA (name));
  }

  DEFUN ("bare-symbol", Fbare_symbol, Sbare_symbol, 1, 1, 0,





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 08:47:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 03:47:44 2023
Received: from localhost ([127.0.0.1]:53663 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1paYPg-0007tv-Iu
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 03:47:44 -0500
Received: from mail-ed1-f49.google.com ([209.85.208.49]:33448)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1paYPe-0007tK-1h
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 03:47:43 -0500
Received: by mail-ed1-f49.google.com with SMTP id a25so17665216edb.0
 for <62009 <at> debbugs.gnu.org>; Fri, 10 Mar 2023 00:47:41 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20210112; t=1678438056;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=V2CK2T8vr9fmbaecarxwVXiXP+tdt+JZNEKzEMoTLBE=;
 b=TV73SV9hDzHCqPHmGBjevJqEBc1SdwoRLA4cjNbg5LcKSyA51qdRnhNsAPtbm08w6r
 +xU7Tr8rejs+vSxzxCMhKlAnk4vWXtU5S5hf9LlEqGJ53UkUpCTKdeBWeVaNTHCKiXX/
 U9c9fgSOZK1EMcM5vlX8WgPaU7Wj3hPFpgNld9qlLPEzQoAjL5Aa0CkT/mM8E9JrrPrK
 vfMK0HRjZWTyWBZnRj/w2hJE2ZXvCTQT9PdHPmAy8AkpTvqo7JA9q+SnVwwbsfsWMzHb
 g2xEkfsRIR/h1XkPTSfOw6uwUWsJG/b6azjxemXvDbNqa/rWToAeKzGPVXed4jTXM4sP
 P11w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1678438056;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=V2CK2T8vr9fmbaecarxwVXiXP+tdt+JZNEKzEMoTLBE=;
 b=jsm3MEX3n55DjuGH+ZERox9u8fXRqq5jBHv+JEvNLG7hjnwPdN1bWi7Di+eTp6gl5y
 YwJsz4T9jgilkSG9aeiUgODr9Q/QbD52chsT8PDGsqIYzemqu1M8rTDu8i9+fHSX9PN8
 2g6t6iVY70c0cedGc7zHEyF9pbTDUq9CKILQPK7uCa9Rn6iubLUjWkGDJO56650TXvb8
 af7LfCd6a726KAWC3F98uOjDQJ2+pLXPTD5HAIv6Xtd2lOuT5Ro2qEtjuvO0YyHJUUn5
 tSGVVp/CpSgra1s2q+Mfak9Q3xqG0YQFV1LBv9GhDVoVjpjBLYviJ/1xcjxBS6slmNuZ
 5RsA==
X-Gm-Message-State: AO0yUKVRY6sBz6wZrrWtoahk1+8UgKRqSbNg9ipjd6Y39/PWQHVIlnjI
 po0iLIQZldt/ly8LvE9zvG2hzZ/Mexw14A==
X-Google-Smtp-Source: AK7set/zTiOq1N8sGBtPTYuz0yJqs1IH0aW1lQWl7Kon/cPJXU0tWsFvAGY35yiQZEj8CT5kUORg5Q==
X-Received: by 2002:a17:906:6b1a:b0:8b1:7ab0:a462 with SMTP id
 q26-20020a1709066b1a00b008b17ab0a462mr23371597ejr.7.1678438055844; 
 Fri, 10 Mar 2023 00:47:35 -0800 (PST)
Received: from ars3 ([2a02:8109:8ac0:56d0::8b3a])
 by smtp.gmail.com with ESMTPSA id
 m21-20020a170906161500b008b17662e1f7sm697049ejd.53.2023.03.10.00.47.35
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 10 Mar 2023 00:47:35 -0800 (PST)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
In-Reply-To: <87ilf9571k.fsf@HIDDEN> (Augusto Stoffel's message of "Fri, 10
 Mar 2023 09:45:11 +0100")
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN>
 <83a60l13p2.fsf@HIDDEN> <87ilf9571k.fsf@HIDDEN>
Date: Fri, 10 Mar 2023 09:47:33 +0100
Message-ID: <87edpx56xm.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62009
Cc: michael_heerdegen@HIDDEN, mail@HIDDEN,
 Philip Kaludercic <philipk@HIDDEN>, monnier@HIDDEN,
 62009 <at> debbugs.gnu.org
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: -1.0 (-)

On Fri, 10 Mar 2023 at 09:45, Augusto Stoffel wrote:

> On Fri, 10 Mar 2023 at 09:11, Eli Zaretskii wrote:
>
>>> Is it not possible to detect this before the illegal memory access, and
>>> raise a signal in Emacs Lisp?
>>
>> It won't be easy, if at all possible.  And I'm not sure we even want
>> to do that.  What would be the purpose of supporting such a use of
>> Emacs?
>
> What is the purpose of supporting mutation of symbol names in general?
>
>   (aset (symbol-name 'find-file) 1 ?o)
>   (fboundp 'find-file)
>   => nil
>
> This one doesn't crash Emacs, but wreaks havoc, maybe in even worse
> ways.

(To clarify, I think this of course should raise a signal.)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 08:45:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 03:45:21 2023
Received: from localhost ([127.0.0.1]:53659 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1paYNN-0007py-4V
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 03:45:21 -0500
Received: from mail-ed1-f52.google.com ([209.85.208.52]:45902)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1paYNL-0007pi-Qj
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 03:45:20 -0500
Received: by mail-ed1-f52.google.com with SMTP id cy23so17352949edb.12
 for <62009 <at> debbugs.gnu.org>; Fri, 10 Mar 2023 00:45:19 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20210112; t=1678437913;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=eKIyC/tg6LBbTNkzgSmTRdu+SPX8XY8u246q2AM5XGo=;
 b=TXXiQyVcBSulfHv9Qe0cLbYdNkArQEoGEAHYX+U0Yr9l06Pkg5ffqLyvGlSFhpoWOT
 z3StAOtrS2SAQYVZ8hQGXSqKBYB+0JiUctahHGz9ZOuXIz/667jeYz7+tSKomwxVkesp
 rUwCFqD8Ubqu2spSW8Ss5PMQUGxrlwedlW3hTXLmuR5NkmaKuYPKlbgo07dd8fRX4yxc
 HqeqIr6S1rsqOCUz3PnYOukz2PPs5omCWt6n0iPHlRyzO7K3vbO915IZS2q59mbqKyck
 iUjqiEHQNUN+louvKTIsz3iPcHYMnTxPiveGUMbv8J6h98uvq6waJtIsq3K+4l74pJ2t
 zVHg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1678437913;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=eKIyC/tg6LBbTNkzgSmTRdu+SPX8XY8u246q2AM5XGo=;
 b=XqDHhzkIU7tcWlBTC3SEDVNppQ8G+allpWwgvrcPLVmQAAjkpPxlBuCwh93d+wyCxg
 /jCgIXMlNblX2ra+WJHgYgvnJvSY8evyixBZ1Z9mIEmwMLaSthKeLpb6Mduf/EmxMRzk
 V/cuz04mI6VbJQtA0tFhxInaKGwkI2ZD615qcp+HFyeXvEQ3ZUgelZsY6vTy6wCX6gQB
 72YCyHTRKSYIMjO4YFfQcGshgoYfZZGYUPktgqYdwHhsxRaLRHeYHa5MaNDIJPGzkYII
 Y7BmKXqGAfX7mBMFAtbvyTlZPbxHTmATcR+5nLBMz0ml/e7+bK4aqyUtQmhYHusjwG7b
 E+9A==
X-Gm-Message-State: AO0yUKXxwCFLvlTRB5wsNf65u80uagncoMl+vnjJR0vflOdvrJSpxyyN
 TbHCAfojpgffghXMkDB99R9OWoPiyAh1zA==
X-Google-Smtp-Source: AK7set+k4VyPxOJBfPy/p/H+jazbFnDTmvNsZMAmcEg/5jIp507IajaE5CFh8IHoD0sZuD/w6/+VBg==
X-Received: by 2002:a17:907:3f90:b0:878:711d:9310 with SMTP id
 hr16-20020a1709073f9000b00878711d9310mr27469903ejc.1.1678437913586; 
 Fri, 10 Mar 2023 00:45:13 -0800 (PST)
Received: from ars3 ([2a02:8109:8ac0:56d0::8b3a])
 by smtp.gmail.com with ESMTPSA id
 q26-20020a17090676da00b008b69aa62efcsm685413ejn.62.2023.03.10.00.45.12
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 10 Mar 2023 00:45:13 -0800 (PST)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
In-Reply-To: <83a60l13p2.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 10 Mar
 2023 09:11:05 +0200")
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN>
 <83a60l13p2.fsf@HIDDEN>
Date: Fri, 10 Mar 2023 09:45:11 +0100
Message-ID: <87ilf9571k.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62009
Cc: michael_heerdegen@HIDDEN, mail@HIDDEN,
 Philip Kaludercic <philipk@HIDDEN>, monnier@HIDDEN,
 62009 <at> debbugs.gnu.org
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: -1.0 (-)

On Fri, 10 Mar 2023 at 09:11, Eli Zaretskii wrote:

>> Is it not possible to detect this before the illegal memory access, and
>> raise a signal in Emacs Lisp?
>
> It won't be easy, if at all possible.  And I'm not sure we even want
> to do that.  What would be the purpose of supporting such a use of
> Emacs?

What is the purpose of supporting mutation of symbol names in general?

  (aset (symbol-name 'find-file) 1 ?o)
  (fboundp 'find-file)
  => nil

This one doesn't crash Emacs, but wreaks havoc, maybe in even worse
ways.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 10 Mar 2023 07:11:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 02:11:32 2023
Received: from localhost ([127.0.0.1]:53532 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1paWuZ-0005Uw-Nw
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 02:11:32 -0500
Received: from eggs.gnu.org ([209.51.188.92]:54788)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1paWuX-0005Ui-UK
 for 62009 <at> debbugs.gnu.org; Fri, 10 Mar 2023 02:11:30 -0500
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 <eliz@HIDDEN>)
 id 1paWuR-00019l-Rz; Fri, 10 Mar 2023 02:11:23 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=7HWhfYNmGeEBxXDOcUmUmtdTUempUT7fQh5EkF5zKiE=; b=aixqg3dwvGd6
 akFUX3zMFFTJpdcXFEUiAxzZx7tT/QkdwzQr0Xs5ksMFAzQfBlR++U7YLgr6yUdYdPXhEULYr9jIf
 V457EXMxZoijNWCACROpAVwDFnS736Ynq1gJyL6u3uXGy4w7D5E9+XPfrN7b7WY0bKANwIN/LdPQF
 JBjI7UygLovNSg/l9nD0GEXSHB5f2Pj40WS/AIsrKMaGbhzG0uo8IGt+18FIVMC82iaYatXZ+YvGm
 rFFPF3iVGkshDpp9QncHqHnDNnTiZXXXROPgVJwQDX2xDSc46GcowPgHZwRqNZ/5ClIyPEPk+8uhr
 0S/BYyqdQLjQ4LGPwea0xQ==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1paWuR-0000g2-6D; Fri, 10 Mar 2023 02:11:23 -0500
Date: Fri, 10 Mar 2023 09:11:05 +0200
Message-Id: <83a60l13p2.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
In-Reply-To: <87v8j9zl3i.fsf@HIDDEN> (message from Philip Kaludercic on
 Thu, 09 Mar 2023 21:11:13 +0000)
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN> <87v8j9zl3i.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62009
Cc: michael_heerdegen@HIDDEN, mail@HIDDEN, monnier@HIDDEN,
 62009 <at> debbugs.gnu.org
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 (---)

> From: Philip Kaludercic <philipk@HIDDEN>
> Cc: Daniel Mendler <mail@HIDDEN>,  michael_heerdegen@HIDDEN,
>   monnier@HIDDEN,  62009 <at> debbugs.gnu.org
> Date: Thu, 09 Mar 2023 21:11:13 +0000
> 
> > AFAICT, they _are_ frozen.  These names are in read-only memory, where
> > you cannot write.  That's why Emacs crashes, AFAIU: the code is trying
> > to write to protected memory.
> >
> > Just don't do that, cause it's gonna hurt...
> 
> Is it not possible to detect this before the illegal memory access, and
> raise a signal in Emacs Lisp?

It won't be easy, if at all possible.  And I'm not sure we even want
to do that.  What would be the purpose of supporting such a use of
Emacs?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 9 Mar 2023 21:11:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 09 16:11:24 2023
Received: from localhost ([127.0.0.1]:53207 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1paNXn-0005dY-Ox
	for submit <at> debbugs.gnu.org; Thu, 09 Mar 2023 16:11:24 -0500
Received: from mout01.posteo.de ([185.67.36.65]:54767)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1paNXl-0005dK-1t
 for 62009 <at> debbugs.gnu.org; Thu, 09 Mar 2023 16:11:21 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 898C42401F5
 for <62009 <at> debbugs.gnu.org>; Thu,  9 Mar 2023 22:11:15 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1678396275; bh=OTRXVVUkSa3AyZEiVnO3ik8nOJh+ywgiJbLz8SgyTqY=;
 h=From:To:Cc:Subject:Date:From;
 b=pjCnhRFJ/bL4VxXZ5V22MCpNwo/GLpNvG8CKJm5OaQsr/SoBWLaKdagOfTW+7MEEk
 ZadNFSlHTCbs3xyA3pLxYnemxbH8/hrC/Zm+6bIvqM3GTJp6Y52mhruQrbgHFMxhMw
 YGcgUa4mENDspBNAjSfzHiLJjk6FLFzlqxcSTPMg6/CKs8CM8toTfo1UIn3lkyj24S
 tdLQXrznV114aETgkBFtvRo7hkXLDB3TZUxidcoQYkm7WiJa2i0TqJBAdeZ06t1FX+
 7WI1swm2MXKDaFw+TB7z5NNrSvf7lIIeiPVMppt3e4Cp1FgbluxFD5P5T2Jv0xDhY2
 s9NwZApDJsJAA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4PXhgP67xKz9rxQ;
 Thu,  9 Mar 2023 22:11:13 +0100 (CET)
From: Philip Kaludercic <philipk@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
In-Reply-To: <83bkl45ul4.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 07 Mar
 2023 19:39:51 +0200")
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
 <83bkl45ul4.fsf@HIDDEN>
Date: Thu, 09 Mar 2023 21:11:13 +0000
Message-ID: <87v8j9zl3i.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62009
Cc: michael_heerdegen@HIDDEN, Daniel Mendler <mail@HIDDEN>,
 monnier@HIDDEN, 62009 <at> debbugs.gnu.org
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 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> Cc: Stefan Monnier <monnier@HIDDEN>, 62009 <at> debbugs.gnu.org
>> Date: Tue, 7 Mar 2023 18:08:43 +0100
>> From: Daniel Mendler <mail@HIDDEN>
>> 
>> On 3/7/23 16:45, Michael Heerdegen wrote:
>> > Daniel Mendler <mail@HIDDEN> writes:
>> > 
>> >> Execute the following in the scratch buffer:
>> >>
>> >> (setf (aref (symbol-name 'car) 1) ?o)
>> >>
>> >> Emacs crashes with a segmentation fault. Is this a well-known issue? I
>> >> could reproduce the problem on Emacs 27 and 29. Should there be some
>> >> mechanism to protect the strings of symbols?
>> >
>> > Maybe the outcome was something like that we can't protect everybody in
>> > every case from shooting in the own foot, I don't recall.
>> 
>> Maybe it would be possible to introduce a flag which marks strings as
>> "frozen"? Then we could ensure that no mutations of such frozen string
>> happen.
>
> AFAICT, they _are_ frozen.  These names are in read-only memory, where
> you cannot write.  That's why Emacs crashes, AFAIU: the code is trying
> to write to protected memory.
>
> Just don't do that, cause it's gonna hurt...

Is it not possible to detect this before the illegal memory access, and
raise a signal in Emacs Lisp?

-- 
Philip Kaludercic




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 7 Mar 2023 17:40:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 07 12:40:05 2023
Received: from localhost ([127.0.0.1]:47134 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pZbID-0004Zr-Dv
	for submit <at> debbugs.gnu.org; Tue, 07 Mar 2023 12:40:05 -0500
Received: from eggs.gnu.org ([209.51.188.92]:51206)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pZbIB-0004ZF-Sm
 for 62009 <at> debbugs.gnu.org; Tue, 07 Mar 2023 12:40:04 -0500
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 <eliz@HIDDEN>)
 id 1pZbI4-0004FP-NW; Tue, 07 Mar 2023 12:39:56 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=b+P/SDT7Oa+qFe0kRCQggr+uvA4l/Dzh2CG3WUqXEPs=; b=bIB8/Z8AADpW
 LPmBQGPqGEi3jK6PKVOWG/2p6ZSs6DiEi2jwFQyvldWG9fsnuVNQknkWNPI+zMoskjyFiNBXhXIHF
 acHRiWZgxX7d3S39H3Z5uwBW/bzLtJozuQLXbHmxOYnF579XUQOUNLwlVmdQcKwWCa9zjbL89BH3i
 OZmSKe3NkH5P2rq6Vix0Sr8Iw3o9V7+7Z7ux94wuyjk98a0bpn7vBYapn7FbpK2VE7NeUgzC3uaCJ
 P+Z/aAHIefJ5nIh97NEcwpIwh3MyQ67e9yUztpSWP+0+a1uW5BWjeeHsUoByRI6otxEzjkpOXSBXe
 PXULhRcvsv/oHdOMJFVnAw==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pZbI4-0006Ep-2d; Tue, 07 Mar 2023 12:39:56 -0500
Date: Tue, 07 Mar 2023 19:39:51 +0200
Message-Id: <83bkl45ul4.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Daniel Mendler <mail@HIDDEN>
In-Reply-To: <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN> (message
 from Daniel Mendler on Tue, 7 Mar 2023 18:08:43 +0100)
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
 <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62009
Cc: michael_heerdegen@HIDDEN, monnier@HIDDEN, 62009 <at> debbugs.gnu.org
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 (---)

> Cc: Stefan Monnier <monnier@HIDDEN>, 62009 <at> debbugs.gnu.org
> Date: Tue, 7 Mar 2023 18:08:43 +0100
> From: Daniel Mendler <mail@HIDDEN>
> 
> On 3/7/23 16:45, Michael Heerdegen wrote:
> > Daniel Mendler <mail@HIDDEN> writes:
> > 
> >> Execute the following in the scratch buffer:
> >>
> >> (setf (aref (symbol-name 'car) 1) ?o)
> >>
> >> Emacs crashes with a segmentation fault. Is this a well-known issue? I
> >> could reproduce the problem on Emacs 27 and 29. Should there be some
> >> mechanism to protect the strings of symbols?
> >
> > Maybe the outcome was something like that we can't protect everybody in
> > every case from shooting in the own foot, I don't recall.
> 
> Maybe it would be possible to introduce a flag which marks strings as
> "frozen"? Then we could ensure that no mutations of such frozen string
> happen.

AFAICT, they _are_ frozen.  These names are in read-only memory, where
you cannot write.  That's why Emacs crashes, AFAIU: the code is trying
to write to protected memory.

Just don't do that, cause it's gonna hurt...




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 7 Mar 2023 17:08:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 07 12:08:55 2023
Received: from localhost ([127.0.0.1]:47103 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pZao3-0003oZ-K1
	for submit <at> debbugs.gnu.org; Tue, 07 Mar 2023 12:08:55 -0500
Received: from server.qxqx.de ([178.63.65.180]:39263 helo=mail.qxqx.de)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1pZao1-0003oJ-46
 for 62009 <at> debbugs.gnu.org; Tue, 07 Mar 2023 12:08:53 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de;
 s=mail1392553390; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:
 References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=qCoOtqwmp4RuJYbRhDgajB3nwcD4vQq3RMKaoiSWQNw=; b=e7yF3kPhfJB1nYcsg8jYncG4bY
 G1n02y6Uqu1lS2tgQss19rzedJEYHsGX3dBsh2yFMEHtXD0FtxWd/UsPNBIdR7XT8XXlCxNc8g5Zz
 igZeCdk+KLHiPcVRT/bOYu74SX/zop6rC9e4oD6JohhYL6qaG8L/dgboQHwvLpPLZlr8=;
Message-ID: <9fcf05e8-506c-6566-e214-2ecf3194b85e@HIDDEN>
Date: Tue, 7 Mar 2023 18:08:43 +0100
MIME-Version: 1.0
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
References: <87o7p5of4n.fsf@HIDDEN> <871qm01s6n.fsf@HIDDEN>
Content-Language: en-US
From: Daniel Mendler <mail@HIDDEN>
In-Reply-To: <871qm01s6n.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62009
Cc: Stefan Monnier <monnier@HIDDEN>, 62009 <at> debbugs.gnu.org
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 (---)

On 3/7/23 16:45, Michael Heerdegen wrote:
> Daniel Mendler <mail@HIDDEN> writes:
> 
>> Execute the following in the scratch buffer:
>>
>> (setf (aref (symbol-name 'car) 1) ?o)
>>
>> Emacs crashes with a segmentation fault. Is this a well-known issue? I
>> could reproduce the problem on Emacs 27 and 29. Should there be some
>> mechanism to protect the strings of symbols?
>
> Maybe the outcome was something like that we can't protect everybody in
> every case from shooting in the own foot, I don't recall.

Maybe it would be possible to introduce a flag which marks strings as
"frozen"? Then we could ensure that no mutations of such frozen string
happen. Freezing strings (vectors or pairs) may be generally useful
beyond preventing such issues.

Daniel




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 7 Mar 2023 15:45:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 07 10:45:47 2023
Received: from localhost ([127.0.0.1]:47004 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pZZVb-0001F6-2L
	for submit <at> debbugs.gnu.org; Tue, 07 Mar 2023 10:45:47 -0500
Received: from mout.web.de ([217.72.192.78]:42789)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1pZZVY-0000xM-Ur
 for 62009 <at> debbugs.gnu.org; Tue, 07 Mar 2023 10:45:46 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1678203921; i=michael_heerdegen@HIDDEN;
 bh=IQar7FuXhP7eGL+vSQIBDPHD3pZP0at3tc9PmPeiI9c=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=LjehA0BJ+2nqG4AcdhgUdu4BdpLijhs09c1Kka+yiEEoPzkTjX5HyE23Is/IwdLGM
 t3DHBmYuKnEEKr7jEIqomWT7LdMhthKMmE+Wmq2mYqu7EAjsxtFER1SWf2hB4dJaOl
 bCH+2oQUpQPGa4lRKqCigkFxaPdV+Po4s6JCF0Na2Sm3V6lKVLSvVSODfBoAjK9egl
 Tjd4dSTYMCNwq48K9vk5yn0preu6k0uPm0PUzXEBmt+75evDeWFA+UqYOevyEEpnjw
 A+z+g54LmwXMT5cNRClDeusC32jGqCV/gp+KX+r7PbS1+YTLhOZgv2mngkCuA4fEZr
 3KF7aE0MMWvGA==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([178.14.74.115]) by smtp.web.de (mrweb106
 [213.165.67.124]) with ESMTPSA (Nemesis) id 1M6YJ1-1pfs5p3vcP-006n0D; Tue, 07
 Mar 2023 16:45:20 +0100
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Daniel Mendler <mail@HIDDEN>
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
In-Reply-To: <87o7p5of4n.fsf@HIDDEN> (Daniel Mendler's message of
 "Mon, 06 Mar 2023 20:26:32 +0100")
References: <87o7p5of4n.fsf@HIDDEN>
Date: Tue, 07 Mar 2023 16:45:20 +0100
Message-ID: <871qm01s6n.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:82862vlL2GPIoWuMD9DLoUk0iOzkqFcHFwVXrlZgsAB6WXCQXo/
 +hHFV+SY7N0tSmahFZoO6DKdlIRGEkBjWILEl+jAEsz+jNIkEHnoOhVKU9b1UxV9BW7JI90
 v+8cle4/ZsASD23kY9UFcp3QmJrAKwtFjW+2uQQ+YtY0oeo2tnRLGSp8oUBKvitXz5+3sNl
 VkzI+MdC8ap7C42j3Gw5A==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:CzevP43tX+Q=;9vVxntVNl0Uz4bqpwISj5WG9uPt
 JlGiP1BDuKXChuYoIMMludVcxi1Nt+kPrgKmmeepDumPc4Nf7DOpedMzupiMHiCAhzY9c9vRE
 ST5x63EhAzCgGgjTvYCpSY1aVCGx0L+lTS2beRbM7A8kJ3UNzaVEwYeGI9Wvdbdsxi1zpiGAt
 vdXg6do263d+KYnqo08IVekrFFKaiPX1ntpmHcgnFEQ/Yse3gYn1bMNIYYzQduL9nUtulFfbO
 338yM/JJqngHMrebM3Vda0u+BslJawy6PWXW4nvthoDSlr1NL4jhL8msikV+3Nz2wEcCjVetf
 4ZEdd9G0wzTHLk4vUda/EVBEoItn0ZZLbXV6xHmkq1jD4F4p0GDRCqhahvqrOWXuYagwMnlI4
 GZaUWDeVlrN1y+0ggVR71NOBOWoGqbzSUIpjkVH92IEbwLkBCF/IKOlL7wvk6lJ/WdON6jkRO
 vsm8GnrymyDQetbHDTdL01LjveGtotsBmucJjvmm3o41bF0If1xtd4nMNNqiGKyQfWScnvV/y
 mYmy+dd5YgHz7AOojlyONjfP5H/u+Jy/6XaZkGTIJiGDz5A3nDLRdMO8k5xNRBxpIC/x9ws9q
 F/2K//4Pi5avfD3XHi8q0WF/GQ9Kc7q3n132wWugKmYJsL4i9sfiGxlchQ+g/NH9KQpkWB24w
 Kv78g6jQOz/6Wgei6Kzm5xHPJFHCPtUAJ2odMZWiokddBbxizhduTxus5Rzy9W9cVDX2J8R99
 /J7gr2TWFn0u7H8+C/t4pRfHFv6cFJ+jrOg7pVgXb5wrtt5wsbFvEJKafWCPNvfKGQXnI4ehl
 NwaJv1fRRPWs3/cOL8+WkJwT9tx1LK+XofFaqhftEdLnK8NM4cUCdkf36smohpdx1TL5JjeFp
 VqxEIryuJo+arP5vtQzUl0uIhO7icMMSejx7AKjk0tpoWr391j7bgm+k2UAV+4KH+Rz7nK/Gz
 Y2tTbCj+//AW6K3GRETo8GizfYo=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 62009
Cc: 62009 <at> debbugs.gnu.org
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: -1.7 (-)

Daniel Mendler <mail@HIDDEN> writes:

> Execute the following in the scratch buffer:
>
> (setf (aref (symbol-name 'car) 1) ?o)
>
> Emacs crashes with a segmentation fault. Is this a well-known issue? I
> could reproduce the problem on Emacs 27 and 29. Should there be some
> mechanism to protect the strings of symbols?

I vaguely remember this has been discussed some time ago, but I don't
find a bug report about it.  Maybe it had been on emacs-dev.

Maybe the outcome was something like that we can't protect everybody in
every case from shooting in the own foot, I don't recall.

Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at 62009) by debbugs.gnu.org; 7 Mar 2023 14:19:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 07 09:19:47 2023
Received: from localhost ([127.0.0.1]:44927 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pZYAM-0004rF-Qm
	for submit <at> debbugs.gnu.org; Tue, 07 Mar 2023 09:19:47 -0500
Received: from netyu.xyz ([152.44.41.246]:53698 helo=mail.netyu.xyz)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ruijie@HIDDEN>) id 1pZYAK-0004r5-KA
 for 62009 <at> debbugs.gnu.org; Tue, 07 Mar 2023 09:19:45 -0500
Received: from fw.net.yu.netyu.xyz (<unknown> [222.248.4.98])
 by netyu.xyz (OpenSMTPD) with ESMTPSA id 8ae80f05
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); 
 Tue, 7 Mar 2023 14:19:42 +0000 (UTC)
References: <87o7p5of4n.fsf@HIDDEN>
User-agent: mu4e 1.8.14; emacs 30.0.50
From: Ruijie Yu <ruijie@HIDDEN>
To: Daniel Mendler <mail@HIDDEN>
Subject: Re: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
Date: Tue, 07 Mar 2023 12:40:06 +0800
In-reply-to: <87o7p5of4n.fsf@HIDDEN>
Message-ID: <sdv8rg8sky3.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 1.1 (+)
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:  Daniel Mendler <mail@HIDDEN> writes: > Execute
 the following in the scratch buffer: > > (setf (aref (symbol-name 'car) 1)
 ?o) > > Emacs crashes with a segmentation fault. Is this a well-known issue?
 I > could reproduce the problem on Ema [...] 
 Content analysis details:   (1.1 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 1.1 DATE_IN_PAST_06_12     Date: is 6 to 12 hours before Received: date
 0.0 FROM_SUSPICIOUS_NTLD   From abused NTLD
X-Debbugs-Envelope-To: 62009
Cc: 62009 <at> debbugs.gnu.org
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: 1.1 (+)
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:  Daniel Mendler <mail@HIDDEN> writes: > Execute
   the following in the scratch buffer: > > (setf (aref (symbol-name 'car) 1)
    ?o) > > Emacs crashes with a segmentation fault. Is this a well-known issue?
    I > could reproduce the problem on Ema [...] 
 
 Content analysis details:   (1.1 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
  1.1 DATE_IN_PAST_06_12     Date: is 6 to 12 hours before Received: date
  0.0 FROM_SUSPICIOUS_NTLD   From abused NTLD
  1.0 BULK_RE_SUSP_NTLD      Precedence bulk and RE: from a suspicious TLD
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

--=-=-=
Content-Type: text/plain


Daniel Mendler <mail@HIDDEN> writes:

> Execute the following in the scratch buffer:
>
> (setf (aref (symbol-name 'car) 1) ?o)
>
> Emacs crashes with a segmentation fault. Is this a well-known issue? I
> could reproduce the problem on Emacs 27 and 29. Should there be some
> mechanism to protect the strings of symbols?
>
> I found the snippet on reddit:
> https://old.reddit.com/r/emacs/comments/11ix6yu/ive_found_what_ive_been_looking_for/jb4ah5v/

Can't access reddit, but can reproduce in recent master (6fb8a4dff7ef).

To test, first put this file under emacs.git/src/:


--=-=-=
Content-Type: text/plain
Content-Disposition: attachment; filename=test.el

(defun foo (symbol)
  (message "[1] %S" (symbol-name symbol))
  (setf (aref (symbol-name symbol) 1) ?x)
  (message "[2] %S" (symbol-name symbol)))

--=-=-=
Content-Type: text/plain


    $ make; cd src

Then do the following for each symbol:
                - setf
                - find-file
                - with-current-buffer
                - buffer-file-name

    $ ./emacs -Q -batch -l test.el -eval '(foo (quote setf))'
    [1] "setf"
    [2] "sxtf"

    $ ./emacs -Q -batch -l test.el -eval '(foo (quote find-file))'
    [1] "find-file"
    [2] "fxnd-file"

And these below below: aref, null, car, cdr, save-current-buffer

    $ ./emacs -Q -batch -l test.el -eval '(foo (quote aref))'
    [1] "aref"
    Fatal error 11: Segmentation fault
    Backtrace:
    ...

My observation is that symbols "introduced" via C defuns and defmacros
exhibit this problem, whereas those introduced via Elisp defuns and
defmacros do not.  No symbols introduced via defvars exhibit this
problem, as shown above with buffer-file-name.

Seeing that it is a segfault, maybe the setf is trying to modify
readonly memory produced by the C defuns and defmacros?  If that is the
case, *if* we allow such modifications, we should make the memory
readwrite; *otherwise* maybe we should no-op, warn, or err in setf and
friends when we see readonly memory blocks?

With this collection of GDB commands:


--=-=-=
Content-Type: text/plain
Content-Disposition: attachment; filename=debug.gdb

set debuginfod enabled off
run
bt
exit

--=-=-=
Content-Type: text/plain


And this GDB command line option:

    $ gdb -x debug.gdb --batch --args ./emacs -Q -batch -l ../test.el -eval '(foo (quote car))' > car.backtrace

I get the backtrace (attached below) for setf + symbol-name + 'car as
reported by OP.


--=-=-=
Content-Type: text/plain
Content-Disposition: attachment; filename=car.backtrace

SIGINT is used by the debugger.
Are you sure you want to change it? (y or n) [answered Y; input not from terminal]
DISPLAY = :0
TERM = xterm-256color
Breakpoint 1 at 0x4e2ab: file emacs.c, line 426.
Breakpoint 2 at 0x142970: file xterm.c, line 26474.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
Faset (array=XIL(0x7ffff1d10adc), idx=make_fixnum(1), newelt=make_fixnum(120)) at /opt/src/emacs/base/62009-setf-symbol-name/src/lisp.h:1671
1671      return XSTRING (string)->u.s.data;
#0  Faset (array=XIL(0x7ffff1d10adc), idx=make_fixnum(1), newelt=make_fixnum(120)) at /opt/src/emacs/base/62009-setf-symbol-name/src/lisp.h:1671
#1  0x000055555576f431 in eval_sub (form=<optimized out>) at eval.c:2506
#2  0x000055555577132d in Fprogn (body=XIL(0)) at eval.c:436
#3  FletX (args=<optimized out>) at eval.c:958
#4  0x000055555576f198 in eval_sub (form=<optimized out>) at eval.c:2451
#5  0x00005555557701ed in Fprogn (body=XIL(0x7ffff24d25d3)) at eval.c:436
#6  funcall_lambda (fun=<optimized out>, fun@entry=XIL(0x7ffff24d5b13), nargs=nargs@entry=1, arg_vector=arg_vector@entry=0x7fffffffd9e0) at eval.c:3235
#7  0x000055555577095c in apply_lambda (fun=fun@entry=XIL(0x7ffff24d5b13), args=<optimized out>, count=count@entry=...) at eval.c:3105
#8  0x000055555576eea6 in eval_sub (form=form@entry=XIL(0x7ffff24d5cf3)) at eval.c:2590
#9  0x0000555555771a8f in Feval (form=XIL(0x7ffff24d5cf3), lexical=<optimized out>) at eval.c:2363
#10 0x00005555557b5882 in exec_byte_code (fun=<optimized out>, args_template=<optimized out>, nargs=<optimized out>, args=<optimized out>) at bytecode.c:809
#11 0x000055555577095c in apply_lambda (fun=fun@entry=XIL(0x7ffff19dc085), args=<optimized out>, count=count@entry=...) at eval.c:3105
#12 0x000055555576eea6 in eval_sub (form=form@entry=XIL(0x7ffff1e13773)) at eval.c:2590
#13 0x0000555555771a8f in Feval (form=XIL(0x7ffff1e13773), lexical=<optimized out>) at eval.c:2363
#14 0x0000555555769cf7 in internal_condition_case (bfun=bfun@entry=0x5555556da3b0 <top_level_2>, handlers=handlers@entry=XIL(0x90), hfun=hfun@entry=0x5555556e1990 <cmd_error>) at eval.c:1474
#15 0x00005555556dad36 in top_level_1 (ignore=ignore@entry=XIL(0)) at keyboard.c:1141
#16 0x0000555555769c51 in internal_catch (tag=tag@entry=XIL(0x103e0), func=func@entry=0x5555556dad10 <top_level_1>, arg=arg@entry=XIL(0)) at eval.c:1197
#17 0x00005555556da32f in command_loop () at keyboard.c:1101
#18 0x00005555556e1512 in recursive_edit_1 () at keyboard.c:711
#19 0x00005555556e18a0 in Frecursive_edit () at keyboard.c:794
#20 0x00005555555ab49f in main (argc=7, argv=0x7fffffffe0a8) at emacs.c:2530

Lisp Backtrace:
"aset" (0xffffd790)
"let*" (0xffffd8c0)
"foo" (0xffffd9e0)
"eval" (0xf05ff1c0)
"command-line-1" (0xf05ff0b8)
"command-line" (0xf05ff040)
"normal-top-level" (0xffffdbd0)
A debugging session is active.

    Inferior 1 [process 1106482] will be killed.

Quit anyway? (y or n) [answered Y; input not from terminal]

--=-=-=
Content-Type: text/plain


HTH.

--
Best,


RY

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 6 Mar 2023 19:27:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 06 14:27:03 2023
Received: from localhost ([127.0.0.1]:43670 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pZGUB-0001LP-AK
	for submit <at> debbugs.gnu.org; Mon, 06 Mar 2023 14:27:03 -0500
Received: from lists.gnu.org ([209.51.188.17]:57792)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1pZGU9-0001Kz-3u
 for submit <at> debbugs.gnu.org; Mon, 06 Mar 2023 14:27:01 -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 <mail@HIDDEN>)
 id 1pZGU6-0003VI-Oc
 for bug-gnu-emacs@HIDDEN; Mon, 06 Mar 2023 14:26:59 -0500
Received: from server.qxqx.de ([2a01:4f8:121:346::180] helo=mail.qxqx.de)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <mail@HIDDEN>)
 id 1pZGU4-0005zJ-5F
 for bug-gnu-emacs@HIDDEN; Mon, 06 Mar 2023 14:26:58 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de;
 s=mail1392553390; 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=ApFsH2+SjZZO7stR2Bs4xTFPy4fywFG86CO9KuUMmIY=; b=oWwG+rfF+FjWqCAsmvXFmwptiO
 M/gnElyVLWsAJwf68WiECN7nvmXk0DYmiAP1p1Hqr7oEV1/ykIOkrlBUG54JesoLBj+NLUflN20HA
 DmiLD3w4Gj8MUhhC72YU/4LpwgkMp6s51x1gUYMxDGS1MLQWRwFEVBzuU1daKwz2oKsY=;
From: Daniel Mendler <mail@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.0.60; Emacs crashes on setf symbol-name
Date: Mon, 06 Mar 2023 20:26:32 +0100
Message-ID: <87o7p5of4n.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2a01:4f8:121:346::180;
 envelope-from=mail@HIDDEN; helo=mail.qxqx.de
X-Spam_score_int: -41
X-Spam_score: -4.2
X-Spam_bar: ----
X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
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: -2.4 (--)

Execute the following in the scratch buffer:

(setf (aref (symbol-name 'car) 1) ?o)

Emacs crashes with a segmentation fault. Is this a well-known issue? I
could reproduce the problem on Emacs 27 and 29. Should there be some
mechanism to protect the strings of symbols?

I found the snippet on reddit:
https://old.reddit.com/r/emacs/comments/11ix6yu/ive_found_what_ive_been_looking_for/jb4ah5v/




Acknowledgement sent to Daniel Mendler <mail@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#62009; Package emacs. 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, 10 Mar 2023 12:30:02 UTC

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