all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Gregory Heytings <gregory@heytings.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: philipk@posteo.net, michael_heerdegen@web.de,
	mail@daniel-mendler.de, rpluim@gmail.com,
	monnier@iro.umontreal.ca, 62009@debbugs.gnu.org,
	arstoffel@gmail.com
Subject: bug#62009: 29.0.60; Emacs crashes on setf symbol-name
Date: Sat, 18 Mar 2023 22:46:35 +0000	[thread overview]
Message-ID: <d3c4377ed5a14521538a@heytings.org> (raw)
In-Reply-To: <831qlvwb83.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 236 bytes --]


>
> I think being a bit vague here and talking about "dangers" should be 
> good enough, since not every such code will crash, and probably also not 
> on every platform and in every build configuration.
>

Is the attached patch okay?

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Improve-warning-about-changing-the-string-returned-b.patch --]
[-- Type: text/x-diff; name=Improve-warning-about-changing-the-string-returned-b.patch, Size: 1689 bytes --]

From 32f0fe0aa5fce7fd71f80a166676ef3e5f1e7b32 Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Sat, 18 Mar 2023 22:41:33 +0000
Subject: [PATCH] Improve warning about changing the string returned by
 symbol-name

* src/data.c (Fsymbol_name): Add warning.

* doc/lispref/symbols.texi (Creating Symbols): Improve warning.
---
 doc/lispref/symbols.texi | 5 ++---
 src/data.c               | 5 ++++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi
index 5b53cbe310a..c6a0408abd1 100644
--- a/doc/lispref/symbols.texi
+++ b/doc/lispref/symbols.texi
@@ -276,9 +276,8 @@ Creating Symbols
 @end group
 @end example
 
-@strong{Warning:} Changing the string by substituting characters does
-change the name of the symbol, but fails to update the obarray, so don't
-do it!
+@strong{Warning:} Never alter the string returned by that function.
+Doing that might make Emacs dysfunctional, and might even crash Emacs.
 @end defun
 
 @cindex uninterned symbol, and generating Lisp code
diff --git a/src/data.c b/src/data.c
index 0f1d881e00b..930d476bc3f 100644
--- a/src/data.c
+++ b/src/data.c
@@ -773,7 +773,10 @@ DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
 }
 
 DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0,
-       doc: /* Return SYMBOL's name, a string.  */)
+       doc: /* Return SYMBOL's name, a string.
+
+Warning: never alter the string returned by `symbol-name'.
+Doing that might make Emacs dysfunctional, and might even crash Emacs.  */)
   (register Lisp_Object symbol)
 {
   register Lisp_Object name;
-- 
2.39.0


  reply	other threads:[~2023-03-18 22:46 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06 19:26 bug#62009: 29.0.60; Emacs crashes on setf symbol-name Daniel Mendler
2023-03-07  4:40 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-07 15:45 ` Michael Heerdegen
2023-03-07 17:08   ` Daniel Mendler
2023-03-07 17:39     ` Eli Zaretskii
2023-03-09 21:11       ` Philip Kaludercic
2023-03-10  7:11         ` Eli Zaretskii
2023-03-10  8:45           ` Augusto Stoffel
2023-03-10  8:47             ` Augusto Stoffel
2023-03-10 11:50               ` Eli Zaretskii
2023-03-10 12:00                 ` Daniel Mendler
2023-03-10 12:35                   ` Eli Zaretskii
2023-03-10 12:45                     ` Daniel Mendler
2023-03-10 12:57                       ` Eli Zaretskii
2023-03-10 13:08                         ` Daniel Mendler
2023-03-10 15:02                           ` Eli Zaretskii
2023-03-11 15:16                     ` Gregory Heytings
2023-03-11 15:37                       ` Eli Zaretskii
2023-03-18 22:46                         ` Gregory Heytings [this message]
2023-03-19  6:03                           ` Eli Zaretskii
2023-03-19 21:20                             ` Gregory Heytings
2023-03-10 11:49             ` Eli Zaretskii
2023-03-10  9:40           ` Gregory Heytings
2023-03-10 10:31             ` Daniel Mendler
2023-03-10 10:59               ` Gregory Heytings
2023-03-10 11:09                 ` Daniel Mendler
2023-03-10 11:23                   ` Augusto Stoffel
2023-03-10 12:09                     ` Eli Zaretskii
2023-03-10 11:30                   ` Robert Pluim
2023-03-10 11:36                     ` Daniel Mendler
2023-03-10 12:13                       ` Eli Zaretskii
2023-03-10 12:24                         ` Daniel Mendler
2023-03-10 22:01                           ` Dmitry Gutov
2023-03-10 11:57                     ` Gregory Heytings
2023-03-10 12:12                     ` Eli Zaretskii
2023-03-10 13:19                       ` Robert Pluim
2023-03-11  7:07                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-13  8:07                       ` Robert Pluim
2023-03-13  8:28                         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-13 11:47                           ` Eli Zaretskii
2023-03-13 11:50                             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-13 11:46                         ` Eli Zaretskii
2023-03-10 11:59                 ` Eli Zaretskii
2023-03-10 11:53             ` Eli Zaretskii
2023-03-10 11:59               ` Gregory Heytings
2023-03-11  7:07               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-11  7:47                 ` Eli Zaretskii
2023-03-10 18:56           ` Philip Kaludercic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d3c4377ed5a14521538a@heytings.org \
    --to=gregory@heytings.org \
    --cc=62009@debbugs.gnu.org \
    --cc=arstoffel@gmail.com \
    --cc=eliz@gnu.org \
    --cc=mail@daniel-mendler.de \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    --cc=philipk@posteo.net \
    --cc=rpluim@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.