GNU bug report logs - #75784
Typo "unreadeable" in print.c; was exposed to Lisp

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; Severity: minor; Reported by: Pip Cet <pipcet@HIDDEN>; dated Thu, 23 Jan 2025 12:22:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'minor' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at 75784) by debbugs.gnu.org; 24 Jan 2025 23:39:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 24 18:39:13 2025
Received: from localhost ([127.0.0.1]:47598 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tbTGa-0002Mi-PV
	for submit <at> debbugs.gnu.org; Fri, 24 Jan 2025 18:39:13 -0500
Received: from mail-10628.protonmail.ch ([79.135.106.28]:41701)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <pipcet@HIDDEN>)
 id 1tbTGX-0002MJ-D6
 for 75784 <at> debbugs.gnu.org; Fri, 24 Jan 2025 18:39:10 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;
 s=protonmail3; t=1737761942; x=1738021142;
 bh=2HWRY7Ung+KN5PNfl+718kPYw0df6/GD083lIj8lsGI=;
 h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References:
 Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:
 Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post;
 b=DGiUXtb/eOY5HxNH5IW0n2H9AhCie4AwHsfdzC0LGcAvmD+rgdYd7jyGcBTVxN1Ec
 KeSSBcN0FMU+mFg1hwZEgXf5e++s4hgAYGg3uzM+XIKcviK87P+NA9QGdpcN59Lkf7
 uvCCDYkJluGHrVtiEPp9AOJlBSA9g8FKXyFeNI/pVTgRSvipPSOmKK2oOXwsNLrl9p
 TzSOE917Jctr8pqr27+sq+mwZFHSkBkGkhsUaNl2AKxzDsuyIjIZynOnjCKxjkeCKI
 Gbz4X5AUin1RnWZjDzU7+FYl6U84vHV4k4sEVy8oozf/6ezuxTPLADA9SdyK8UQ3k4
 vN3TlsKsvhElg==
Date: Fri, 24 Jan 2025 23:38:55 +0000
To: Stefan Kangas <stefankangas@HIDDEN>
From: Pip Cet <pipcet@HIDDEN>
Subject: Re: bug#75784: Typo "unreadeable" in print.c; was exposed to Lisp
Message-ID: <87ed0rvl31.fsf@HIDDEN>
In-Reply-To: <CADwFkm=aZB96_iSfyuxoVB-+Xgxvdhm2FJZ5k1QuqyAx1R0egg@HIDDEN>
References: <87y0z167r1.fsf@HIDDEN>
 <CADwFkmm51L6PNq65TE8oy_YYYn1SQndGVjaW3dL_RPwSezFphg@HIDDEN>
 <875xm4z4bm.fsf@HIDDEN>
 <CADwFkmmcNRFmACmwtsFZcZvtaG5LANEa8o5cNKT6-JW0XRXORA@HIDDEN>
 <87r04sw1tj.fsf@HIDDEN>
 <CADwFkm=aZB96_iSfyuxoVB-+Xgxvdhm2FJZ5k1QuqyAx1R0egg@HIDDEN>
Feedback-ID: 112775352:user:proton
X-Pm-Message-ID: 03003f4e7b7bb3080b59413c246734e6d50f7084
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: 75784
Cc: 75784 <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 (-)

"Stefan Kangas" <stefankangas@HIDDEN> writes:

> Pip Cet <pipcet@HIDDEN> writes:
>
>> Sorry. I meant to mention that I ran out of time for adding comments,
>> then I ran out of time for mentioning I'd run out of time.
>
> :-)
>
>>>> +=09=09  add_to_log ("Obsolete symbol `unreadeable-function' used.  Us=
e `unreadable-function' instead.");
>>
>> BTW: add-to-log here, or message?  While my reasons for using the former
>> were that I was confused, I think this is most likely going to happen in
>> a noninteractive program, where messages might be used to generate its
>> output.
>
> While add_to_log is probably enough to notify users, maybe message is
> indeed better because it's harder to miss.  So I'd probably lean towards
> the latter, but I have no strong opinion.
>
>>>> +      CHECK_LIST_END (overrides, original_overrides);
>>
>> This should signal if 'overrides' isn't a proper, finite, non-dotted lis=
t.
>>
>> (Lisp doesn't have "infinite" (non-circular) lists, but I tend to use
>> that term for a list that is modified from a Lisp callback while we walk
>> it, and keeps adding new cons cells so we never see the end of it.
>>
>> I've yet to find a way this causes a bug, but it's a scenario that would
>> give me great personal satisfaction to fix it.  However, it'd be a
>> strange bug, because calling Lisp means we should have a way to quit.)
>
> No objection to fixing this, assuming that we can do it cleanly.

Oh, sorry, I wasn't clear: usually, growing a list from Lisp while it's
being scanned doesn't cause bugs: an infloop, maybe, but a quittable one
because it's Lisp.  A bug would be something like C code checking a
list's length, then calling a predicate (such as a sort predicate) which
then extends the list, and assuming that the list length was limited so
overrunning its buffer.

Found one!  Well, two:

(let ((l (make-list 1000 nil))) (mapconcat (lambda (x) (ntake 1 l)) l))

(let ((s (string ?a 1000))) (mapconcat (lambda (x) (aset s 0 1000) (string =
x)) s))

My first impulse is to change as little as possible to prevent crashes.
A trivial mapconcat can handle many cases in which our mapconcat fails
or produces unexpected results.  That's okay.  Don't modify the sequence
and you'll be fine.

I still have to check that the old, more forgiving behavior for lists
isn't relied upon anywhere.

From 1eb35efa41da5dd00f1c824c6b396c89bf4f0ca8 Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet@HIDDEN>
Subject: [PATCH] Fix crashes in mapconcat etc. (bug#TBD)

This doesn't attempt to catch all cases in which the mapping function
modifies the sequence, only those which would cause crashes.

* src/fns.c (mapcar1): Error if we detect seq to have been modified by
fn.
---
 src/fns.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/fns.c b/src/fns.c
index 081ed2b9f51..ce09e8c086c 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -3385,7 +3385,7 @@ mapcar1 (EMACS_INT leni, Lisp_Object *vals, Lisp_Obje=
ct fn, Lisp_Object seq)
       for (ptrdiff_t i =3D 0; i < leni; i++)
 =09{
 =09  if (! CONSP (tail))
-=09    return i;
+=09    error ("list modified by mapping function");
 =09  Lisp_Object dummy =3D calln (fn, XCAR (tail));
 =09  if (vals)
 =09    vals[i] =3D dummy;
@@ -3403,11 +3403,14 @@ mapcar1 (EMACS_INT leni, Lisp_Object *vals, Lisp_Ob=
ject fn, Lisp_Object seq)
     }
   else if (STRINGP (seq))
     {
+      ptrdiff_t i =3D 0;
       ptrdiff_t i_byte =3D 0;
=20
-      for (ptrdiff_t i =3D 0; i < leni;)
+      while (i_byte < SBYTES (seq))
 =09{
 =09  ptrdiff_t i_before =3D i;
+=09  if (! CHAR_HEAD_P (SREF (seq, i_byte)))
+=09    error ("string modified by mapping function");
 =09  int c =3D fetch_string_char_advance (seq, &i, &i_byte);
 =09  Lisp_Object dummy =3D calln (fn, make_fixnum (c));
 =09  if (vals)
--=20
2.47.1





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

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


Received: (at 75784) by debbugs.gnu.org; 24 Jan 2025 21:59:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 24 16:59:41 2025
Received: from localhost ([127.0.0.1]:47295 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tbRiH-0002pN-EA
	for submit <at> debbugs.gnu.org; Fri, 24 Jan 2025 16:59:41 -0500
Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]:49549)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1tbRiF-0002p8-Na
 for 75784 <at> debbugs.gnu.org; Fri, 24 Jan 2025 16:59:40 -0500
Received: by mail-ed1-x534.google.com with SMTP id
 4fb4d7f45d1cf-5da135d3162so4069816a12.3
 for <75784 <at> debbugs.gnu.org>; Fri, 24 Jan 2025 13:59:39 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1737755973; x=1738360773; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=u2fJsPReAhMZDQ/ptGMJE67D9FU6/bU1w1vsCVvVp3g=;
 b=M7XawVfnQKi3PQ64AqaNCx/zkHuFUQEL7Qbtn0FjUInKh6Cu0TOQlYcKMyrYs9+5KP
 LnT+zV9TatI7DE0pvJyWsDR1/0e3dL3Rvv8CEI+TawSbl+gOw/igAiEC6SQWbOdJ+Bxz
 YufPQmmy4paK2iccHvtHzXQ9XaBZ28V8wq4uup3Ha/VTMaE9OTn6nF+qRKyTyHP7A5/3
 gx/hzME1CKkbttVl/2r739mYGzJ1GuOnfOzMvDEBJbX3Q9JgAZfd4yjFe4kTN841W/6l
 gfcuyvVHt9mcRPlYjDA4Jt7CMrAtvNWufBUlCbEZLmY6jEP/p8quZRXdt1dV04nBws6c
 57mA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1737755973; x=1738360773;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=u2fJsPReAhMZDQ/ptGMJE67D9FU6/bU1w1vsCVvVp3g=;
 b=OFwajEFnkJxOwXHPuyftBKB99NdKRiN+rEpyGBp3x9rWntVpA1xI7YqZpHsla9aY78
 +cSpk6fjiC2AQosf1O1emWpUylRchoaZwpp3klzRuQptBzLBm99rC67R+UchBOi77qUQ
 kJLFvMFdRsB/t+lGKCfPbHM5A82OYgP/KtGVm16WV99VLssvFC7AJMyEhWm5/9NBB0TU
 hQ5Z/fTr116RNg2sJa+mouhpHf05UTZoz2BEDW6vnml1fJhvf7Kd0nWMWISEHojynofa
 3UIJJ6iIUyJfVqqKJrOJJMr/gtUNe35jhysf2fC+nSlfwpKbZY1SvG+35lnv5lKWtibe
 0sSQ==
X-Gm-Message-State: AOJu0YxhYeyiGZrozqsTs8KkKn9FkHEN+UJ0g4sszdRp7BqulTubg+nI
 1Fmxd+TtMTWQB71ENkUKyMg0i7di3KNzgxchnHj7MshzfSLPW09xHcfjU92++i2AnnovHn7Nsaj
 TSa5tH/WO9p1mjQc7wSfMYuM2MmA=
X-Gm-Gg: ASbGncvF2hQqEf36Ch0bTTuBnvgCrGVtS1eS9nJkWdqUV88UFmVym+LxH+6Uf5aApOk
 KNAHfblWfy8iV/punH5BCq7w47Oic4oS3hjuiqT7O3LnjjeGwA0t4V4l/NNnltjI=
X-Google-Smtp-Source: AGHT+IGxUJqUuv0dCGNG7Cpqps6bPn2elaPwQUjrX7b88dS1ijtfZ6NuHMWfF0n8RoHoStotERaxu6SZq2Xi89KM9D0=
X-Received: by 2002:a05:6402:3495:b0:5d0:81af:4a43 with SMTP id
 4fb4d7f45d1cf-5db7d0eab19mr30065639a12.0.1737755973308; Fri, 24 Jan 2025
 13:59:33 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Fri, 24 Jan 2025 15:59:32 -0600
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <87r04sw1tj.fsf@HIDDEN>
References: <87y0z167r1.fsf@HIDDEN>
 <CADwFkmm51L6PNq65TE8oy_YYYn1SQndGVjaW3dL_RPwSezFphg@HIDDEN>
 <875xm4z4bm.fsf@HIDDEN>
 <CADwFkmmcNRFmACmwtsFZcZvtaG5LANEa8o5cNKT6-JW0XRXORA@HIDDEN>
 <87r04sw1tj.fsf@HIDDEN>
MIME-Version: 1.0
Date: Fri, 24 Jan 2025 15:59:32 -0600
X-Gm-Features: AWEUYZknEvjlT36PgrorSr8RDMJX8wOQTkUN3A5H0W97gyDrw1qxd8hishrcpWM
Message-ID: <CADwFkm=aZB96_iSfyuxoVB-+Xgxvdhm2FJZ5k1QuqyAx1R0egg@HIDDEN>
Subject: Re: bug#75784: Typo "unreadeable" in print.c; was exposed to Lisp
To: Pip Cet <pipcet@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 75784
Cc: 75784 <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 (-)

Pip Cet <pipcet@HIDDEN> writes:

> Sorry. I meant to mention that I ran out of time for adding comments,
> then I ran out of time for mentioning I'd run out of time.

:-)

>>> +		  add_to_log ("Obsolete symbol `unreadeable-function' used.  Use `unreadable-function' instead.");
>
> BTW: add-to-log here, or message?  While my reasons for using the former
> were that I was confused, I think this is most likely going to happen in
> a noninteractive program, where messages might be used to generate its
> output.

While add_to_log is probably enough to notify users, maybe message is
indeed better because it's harder to miss.  So I'd probably lean towards
the latter, but I have no strong opinion.

>>> +      CHECK_LIST_END (overrides, original_overrides);
>
> This should signal if 'overrides' isn't a proper, finite, non-dotted list.
>
> (Lisp doesn't have "infinite" (non-circular) lists, but I tend to use
> that term for a list that is modified from a Lisp callback while we walk
> it, and keeps adding new cons cells so we never see the end of it.
>
> I've yet to find a way this causes a bug, but it's a scenario that would
> give me great personal satisfaction to fix it.  However, it'd be a
> strange bug, because calling Lisp means we should have a way to quit.)

No objection to fixing this, assuming that we can do it cleanly.




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

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


Received: (at 75784) by debbugs.gnu.org; 24 Jan 2025 17:37:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 24 12:37:41 2025
Received: from localhost ([127.0.0.1]:46938 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tbNci-00043q-Rg
	for submit <at> debbugs.gnu.org; Fri, 24 Jan 2025 12:37:41 -0500
Received: from mail-10631.protonmail.ch ([79.135.106.31]:22521)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <pipcet@HIDDEN>)
 id 1tbNcg-00043W-7X
 for 75784 <at> debbugs.gnu.org; Fri, 24 Jan 2025 12:37:39 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;
 s=protonmail3; t=1737740250; x=1737999450;
 bh=tzj+oE8M307yU/rbHnndu4QZoBgISDx2Y834FctyOFc=;
 h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References:
 Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:
 Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post;
 b=mryozbhZTd8xDnxYPp3nMU7a4IiJk7RjtWvzOXfXhXGgFjUabFrE7zdooDJdfvHKW
 8oQeKvIvQsBYbF9bTR0yAv5cztgCOQXDqgV/hfEXQMS8UmWALa/ryX2T5blY6KnvMo
 rsQyFgAOpSV7lk51gbAy/oW6blHzXr9sCqvVSUusmWRJZEfX6oyFrwmKMf/GtUSWzI
 Eq2CfWu1drVGGC2m7Pu975hMxh1uUaw0X+kbjalxgy852gcr6QxYXr1CpnTxtWa8M1
 4tXzscseBmIzcZ2M6U1kt1XM5B+FPgNBq0eLD+RS1LRASUeRwfMsdWqCifW1TURthp
 P3xPbJua0TzIw==
Date: Fri, 24 Jan 2025 17:37:24 +0000
To: Stefan Kangas <stefankangas@HIDDEN>
From: Pip Cet <pipcet@HIDDEN>
Subject: Re: bug#75784: Typo "unreadeable" in print.c; was exposed to Lisp
Message-ID: <87r04sw1tj.fsf@HIDDEN>
In-Reply-To: <CADwFkmmcNRFmACmwtsFZcZvtaG5LANEa8o5cNKT6-JW0XRXORA@HIDDEN>
References: <87y0z167r1.fsf@HIDDEN>
 <CADwFkmm51L6PNq65TE8oy_YYYn1SQndGVjaW3dL_RPwSezFphg@HIDDEN>
 <875xm4z4bm.fsf@HIDDEN>
 <CADwFkmmcNRFmACmwtsFZcZvtaG5LANEa8o5cNKT6-JW0XRXORA@HIDDEN>
Feedback-ID: 112775352:user:proton
X-Pm-Message-ID: 3745219e9e085f8f404a606912620bcfc389fd78
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: 75784
Cc: 75784 <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 (-)

"Stefan Kangas" <stefankangas@HIDDEN> writes:

> Pip Cet <pipcet@HIDDEN> writes:
>
>> "Stefan Kangas" <stefankangas@HIDDEN> writes:
>>
>> Here's a better patch.  While this goes overboard and fixes the case
>> that Vprint_variable_mapping has become invalid, I'm not sure this can
>> happen: Fassq can quit, but the Lisp backtrace won't expose its
>> arguments to the debugger, it seems.  I'd like to err on the side of
>> caution and double-check that this mapping is still valid in case
>> someone somehow exposes it to Lisp.
>>
>> Note that specbind currently insists on a BARE_SYMBOL.  We'll have to
>> check all callers to make sure they never pass a symbol-with-position!
>
> I guess we could also patch specbind.  Not very pretty, overall.

I tried crashing this, but haven't been successful so far: I don't see
how byte-compile sanitizes its constants so they're no longer
symbols-with-positions, but it appears to do so.

(Maybe by accident: whenever we reach code touched by certain
contributors, all symbols with positions are normalized :-) )

>> Tested only very briefly.
>>
>> From 879714122b1de7852be898a7940ed85aefde6e2e Mon Sep 17 00:00:00 2001
>> From: Pip Cet <pipcet@HIDDEN>
>> Subject: [PATCH] Fix typo (and bugs) in prin1's overrides code (bug#7575=
4)
>>
>> Vprint_variable_mapping may have been exposed to Lisp via the
>> backtrace if there was a previous quit in the Fassq call, requiring us
>> to check it still has the intended format.
>>
>> * src/print.c (print_create_variable_mapping): Add correct spelling
>> "unreadable-function" as an alternative to "unreadeable-function".
>> (print_bind_overrides): Preserve original argument for error case. Use
>> FOR_EACH_TAIL, fixing infloop.  Warn about obsolete symbol.  Guard
>> against invalid Vprint_variable_mapping.
>> ---
>>  src/print.c | 25 +++++++++++++++++--------
>>  1 file changed, 17 insertions(+), 8 deletions(-)
>>
>> diff --git a/src/print.c b/src/print.c
>> index 43698f309b1..0da2baa6e09 100644
>> --- a/src/print.c
>> +++ b/src/print.c
>> @@ -676,6 +676,8 @@ print_create_variable_mapping (void)
>>  =09   intern ("print-escape-multibyte"), Qnil),
>>      list3 (intern ("charset-text-property"),
>>  =09   intern ("print-charset-text-property"), Qnil),
>> +    list3 (intern ("unreadable-function"),
>> +=09   intern ("print-unreadable-function"), Qnil),
>>      list3 (intern ("unreadeable-function"),
>>  =09   intern ("print-unreadable-function"), Qnil),
>
> Please add a comment saying why we are keeping the typo, and that
> it should be deleted at some point.

Sorry. I meant to mention that I ran out of time for adding comments,
then I ran out of time for mentioning I'd run out of time.

>>      list3 (intern ("gensym"), intern ("print-gensym"), Qnil),
>> @@ -698,11 +700,10 @@ print_bind_overrides (Lisp_Object overrides)
>>
>>    if (EQ (overrides, Qt))
>>      print_bind_all_defaults ();
>> -  else if (!CONSP (overrides))
>> -    xsignal (Qwrong_type_argument, Qconsp);
>
> FOR_EACH_TAIL won't raise a signal, AFAICT.  Do we really want to stop

FOR_EACH_TAIL signals for a circular list, leaves its argument a cons
for a real list, and leaves its argument as a non-cons for a dotted
list.

I hope.

While there are things that are subject to change about its behavior,
this much we can rely on.  We shouldn't rely on circular_list being
called with the beginning of a cycle, or as soon as possible; it'll get
called eventually.

> signaling for the wrong argument?  And similarly below.
>
>>    else
>>      {
>> -      while (!NILP (overrides))
>> +      Lisp_Object original_overrides =3D overrides;
>> +      FOR_EACH_TAIL (overrides)
>>  =09{
>>  =09  Lisp_Object setting =3D XCAR (overrides);
>>  =09  if (EQ (setting, Qt))
>> @@ -714,15 +715,23 @@ print_bind_overrides (Lisp_Object overrides)
>>  =09      Lisp_Object key =3D XCAR (setting),
>>  =09=09value =3D XCDR (setting);
>>  =09      Lisp_Object map =3D Fassq (key, Vprint_variable_mapping);
>> +=09      static bool warned;
>> +=09      if (!warned && SYMBOLP (key) &&
>> +=09=09  strcmp (SSDATA (SYMBOL_NAME (key)),
>> +=09=09=09  "unreadeable-function") =3D=3D 0)
>> +=09=09{
>> +=09=09  warned =3D true;
>> +=09=09  add_to_log ("Obsolete symbol `unreadeable-function' used.  Use =
`unreadable-function' instead.");
>> +=09=09}

BTW: add-to-log here, or message?  While my reasons for using the former
were that I was confused, I think this is most likely going to happen in
a noninteractive program, where messages might be used to generate its
output.

> Nice. I don't think we want to end the message with a period though,
> according to our conventions, do we?
>
> I'd suggest:
>
> =09=09  add_to_log ("\
> Obsolete symbol `unreadeable-function'; use `unreadable-function' instead=
");
>
> Using "\ trades one kind of ugly for another, so it's up to you which
> you find less grating.  I have no real opinion.

Thanks! I agree completely, and thank you for watching out for details
like this; details are important.

>> +      CHECK_LIST_END (overrides, original_overrides);

This should signal if 'overrides' isn't a proper, finite, non-dotted list.

(Lisp doesn't have "infinite" (non-circular) lists, but I tend to use
that term for a list that is modified from a Lisp callback while we walk
it, and keeps adding new cons cells so we never see the end of it.

I've yet to find a way this causes a bug, but it's a scenario that would
give me great personal satisfaction to fix it.  However, it'd be a
strange bug, because calling Lisp means we should have a way to quit.)

Pip





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

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


Received: (at 75784) by debbugs.gnu.org; 24 Jan 2025 16:52:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 24 11:52:20 2025
Received: from localhost ([127.0.0.1]:46808 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tbMup-0001nL-PO
	for submit <at> debbugs.gnu.org; Fri, 24 Jan 2025 11:52:20 -0500
Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]:45185)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1tbMun-0001n2-7I
 for 75784 <at> debbugs.gnu.org; Fri, 24 Jan 2025 11:52:18 -0500
Received: by mail-ej1-x62c.google.com with SMTP id
 a640c23a62f3a-aab925654d9so426057766b.2
 for <75784 <at> debbugs.gnu.org>; Fri, 24 Jan 2025 08:52:17 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1737737531; x=1738342331; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=QcCYMwA0If2E3KYAj27laZix4qdfly7vxE8ZnrSGU2A=;
 b=f6DI0RqvAPvcQlUm81+lIUbRr1zq1PCfTJgCza5zfRWn2reyOIwvucOkqlUZ1twbtV
 d+7TXh4zh1UbivfB+DGClUb5HUvURQ11oXSyvsAjdFOlu0oiMXuSasgZFTu8IkLvf9Ig
 GeGoqKAsGiOyiZlT8psScgFVeqjYFKj44diqilCj3LFcr+PsPm4FIfo/Sk9tsNmRAkrb
 1vx5gRsHuFIH1uOPXCHcyz6DqPrTGmtSL4j+qOD2o0E1hNxt2NlbOUkD2jJF7ZGgIDt0
 33YTy+HVcDxiFIv5lIOwTWslRDs/GKS/ANChzF9O1G12FaCITMpPV9iEgYYjqYqMLOpj
 hP8A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1737737531; x=1738342331;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=QcCYMwA0If2E3KYAj27laZix4qdfly7vxE8ZnrSGU2A=;
 b=u/h3apaAE5pqn8Pn3/T51RcLLqIR+CPnF7oSIC3o6h0aZERPre2t4CRA1ctN2ZWxn0
 2RRnnMHX7OJqk09b/pTm/YfKbga3g0j8mUQuEGt5avgp2t1/Ws9/nBV3RlxNg73Lb/ZW
 +3eOK1QJkR7uzn+i7EDnymNY0Wth4NlFKe1PFVdC06wuf/1NlrT4I30ttpRZlcQplMp5
 OHD2iwQs4lkDTL0yL1yawkLEOhOZ4A8mrQpYkKEOcuA7t3AtaiTbyZAWVRj59Rb4oZXP
 zjIXeOQz2IU5zwaalVKGAAFZXvg13bdMPaPbRCRXvBZzN9iDbaOg9zT3yuxHrXF65iaE
 FKKQ==
X-Gm-Message-State: AOJu0YzWbXqfKuYbuHxhVlYLv9PyvycLptjiihrBbwHoXI/5evGf3X6Q
 uK9ljWbxffDaXVtGnnCj+AgQDk/6LA0htCl32o9orIvMkTrSvOAWSGwBDcirGO5QNX8c7kj9Jk4
 vJoaHGWTKBbg3XMhL+9bEQFVhHF4=
X-Gm-Gg: ASbGncsypLo9dLmPfmJnrFusZGyzrHapzhT1z7nZhdutjSQ1MTJi6/tecVQb9BpDYix
 6SikUr/yEiPUgr+FexT6tu4gC4fUE/EFIRg1o3YPe9Sgkm37ySz5IO4XWg2x43l6zK/+QWUYuzA
 ==
X-Google-Smtp-Source: AGHT+IEhdiDtuv1pyhlgghFXOTxik+LZzJ8sLVgTBQ/6uDkNxKOHWkI/wQoFAqpSAoXNX2KhTxHHy4EndmlTMgLivD8=
X-Received: by 2002:a17:907:7e92:b0:aa6:8096:204d with SMTP id
 a640c23a62f3a-ab38b1e1f37mr2729910766b.3.1737737530758; Fri, 24 Jan 2025
 08:52:10 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Fri, 24 Jan 2025 10:52:10 -0600
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <875xm4z4bm.fsf@HIDDEN>
References: <87y0z167r1.fsf@HIDDEN>
 <CADwFkmm51L6PNq65TE8oy_YYYn1SQndGVjaW3dL_RPwSezFphg@HIDDEN>
 <875xm4z4bm.fsf@HIDDEN>
MIME-Version: 1.0
Date: Fri, 24 Jan 2025 10:52:10 -0600
X-Gm-Features: AWEUYZnFWIOYyMO3p92Qpvn1Qwap9ZJJbxK8LJmmu65OQ5pYjrsvApK8GmL9lWA
Message-ID: <CADwFkmmcNRFmACmwtsFZcZvtaG5LANEa8o5cNKT6-JW0XRXORA@HIDDEN>
Subject: Re: bug#75784: Typo "unreadeable" in print.c; was exposed to Lisp
To: Pip Cet <pipcet@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 75784
Cc: 75784 <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 (-)

Pip Cet <pipcet@HIDDEN> writes:

> "Stefan Kangas" <stefankangas@HIDDEN> writes:
>
>> Do we have a way to add an obsoletion warning to both names?
>
> I'm sorry: why both names?  The new name should be permanent, unless we
> decide to move to a different name entirely to get rid of the typo (this
> is what happened with kdb-macro-redisplay, IIRC).

Sorry, that was a typo.  I meant the old name only.

> While we could check for an obsoletion property on the symbol in
> question in print_bind_overrides, it's very likely that if anyone
> actually uses this code, they use it in an automated loop, so the
> warning would need rate-limiting as well.  My suggestion is to print the
> warning just once, increasing the risk it'll be missed but saving us
> having to write a rate-limiting facility for Emacs which, if I
> understand the context directly, cannot use Lisp.

Printing it once is what we usually do in similar circumstances, sounds
good.

Pip Cet <pipcet@HIDDEN> writes:

> Here's a better patch.  While this goes overboard and fixes the case
> that Vprint_variable_mapping has become invalid, I'm not sure this can
> happen: Fassq can quit, but the Lisp backtrace won't expose its
> arguments to the debugger, it seems.  I'd like to err on the side of
> caution and double-check that this mapping is still valid in case
> someone somehow exposes it to Lisp.
>
> Note that specbind currently insists on a BARE_SYMBOL.  We'll have to
> check all callers to make sure they never pass a symbol-with-position!

I guess we could also patch specbind.  Not very pretty, overall.

> Tested only very briefly.
>
> From 879714122b1de7852be898a7940ed85aefde6e2e Mon Sep 17 00:00:00 2001
> From: Pip Cet <pipcet@HIDDEN>
> Subject: [PATCH] Fix typo (and bugs) in prin1's overrides code (bug#75754)
>
> Vprint_variable_mapping may have been exposed to Lisp via the
> backtrace if there was a previous quit in the Fassq call, requiring us
> to check it still has the intended format.
>
> * src/print.c (print_create_variable_mapping): Add correct spelling
> "unreadable-function" as an alternative to "unreadeable-function".
> (print_bind_overrides): Preserve original argument for error case. Use
> FOR_EACH_TAIL, fixing infloop.  Warn about obsolete symbol.  Guard
> against invalid Vprint_variable_mapping.
> ---
>  src/print.c | 25 +++++++++++++++++--------
>  1 file changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/src/print.c b/src/print.c
> index 43698f309b1..0da2baa6e09 100644
> --- a/src/print.c
> +++ b/src/print.c
> @@ -676,6 +676,8 @@ print_create_variable_mapping (void)
>  	   intern ("print-escape-multibyte"), Qnil),
>      list3 (intern ("charset-text-property"),
>  	   intern ("print-charset-text-property"), Qnil),
> +    list3 (intern ("unreadable-function"),
> +	   intern ("print-unreadable-function"), Qnil),
>      list3 (intern ("unreadeable-function"),
>  	   intern ("print-unreadable-function"), Qnil),

Please add a comment saying why we are keeping the typo, and that
it should be deleted at some point.

>      list3 (intern ("gensym"), intern ("print-gensym"), Qnil),
> @@ -698,11 +700,10 @@ print_bind_overrides (Lisp_Object overrides)
>
>    if (EQ (overrides, Qt))
>      print_bind_all_defaults ();
> -  else if (!CONSP (overrides))
> -    xsignal (Qwrong_type_argument, Qconsp);

FOR_EACH_TAIL won't raise a signal, AFAICT.  Do we really want to stop
signaling for the wrong argument?  And similarly below.

>    else
>      {
> -      while (!NILP (overrides))
> +      Lisp_Object original_overrides = overrides;
> +      FOR_EACH_TAIL (overrides)
>  	{
>  	  Lisp_Object setting = XCAR (overrides);
>  	  if (EQ (setting, Qt))
> @@ -714,15 +715,23 @@ print_bind_overrides (Lisp_Object overrides)
>  	      Lisp_Object key = XCAR (setting),
>  		value = XCDR (setting);
>  	      Lisp_Object map = Fassq (key, Vprint_variable_mapping);
> +	      static bool warned;
> +	      if (!warned && SYMBOLP (key) &&
> +		  strcmp (SSDATA (SYMBOL_NAME (key)),
> +			  "unreadeable-function") == 0)
> +		{
> +		  warned = true;
> +		  add_to_log ("Obsolete symbol `unreadeable-function' used.  Use `unreadable-function' instead.");
> +		}

Nice. I don't think we want to end the message with a period though,
according to our conventions, do we?

I'd suggest:

		  add_to_log ("\
Obsolete symbol `unreadeable-function'; use `unreadable-function' instead");

Using "\ trades one kind of ugly for another, so it's up to you which
you find less grating.  I have no real opinion.

>  	      if (NILP (map))
>  		xsignal2 (Qwrong_type_argument, Qsymbolp, map);
> -	      specbind (XCAR (XCDR (map)), value);
> +	      Lisp_Object bare_symbol =
> +		maybe_remove_pos_from_symbol (Fcar (XCDR (map)));
> +	      CHECK_SYMBOL (bare_symbol);
> +	      specbind (bare_symbol, value);
>  	    }
> -
> -	  if (!NILP (XCDR (overrides)) && !CONSP (XCDR (overrides)))
> -	    xsignal (Qwrong_type_argument, Qconsp);
> -	  overrides = XCDR (overrides);
>  	}
> +      CHECK_LIST_END (overrides, original_overrides);
>      }
>  }
>
> --
> 2.47.1




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

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


Received: (at 75784) by debbugs.gnu.org; 24 Jan 2025 14:27:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 24 09:27:21 2025
Received: from localhost ([127.0.0.1]:44307 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tbKeW-0002jW-PB
	for submit <at> debbugs.gnu.org; Fri, 24 Jan 2025 09:27:21 -0500
Received: from mail-40133.protonmail.ch ([185.70.40.133]:44031)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <pipcet@HIDDEN>)
 id 1tbKeS-0002jD-Hx
 for 75784 <at> debbugs.gnu.org; Fri, 24 Jan 2025 09:27:17 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;
 s=protonmail3; t=1737728828; x=1737988028;
 bh=0Zz5aZs5MNMGX+/NEtFutRoM1vRTbhUkRSFxumAVAJA=;
 h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References:
 Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:
 Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post;
 b=lSFvyoptoyx6E4WOkxnGjHDM/gqVDYe9UPXqJxk2i4b+ivnqvfQeJoAea1Nj8+Axm
 lKuDDRoMpA4T/kH0Sj1ZcnMvGKOS/O8IVVrIk2g5lLIlWR3tjXzav+ZvbHB4d1ib/Q
 70FWTPuCvk8NVsW/0vtknY5PZBA8/Oh5wDtu5Dosyo0uDLVTjt+vt7fUpBHZf8jgVp
 pIK4CHWLYwXumDXwtCSEmVale7N8FqXbYm5HfybQPeWGRCr9L7gG+kQpF52hZuSs32
 QiUnxjfabVT0G2vgMQPBkMaiwKyBfWzya36UXAC6sckH3gAn1d6JmnB7DVEpZFP8xu
 VPhfxJiHhRbQg==
Date: Fri, 24 Jan 2025 14:27:04 +0000
To: Stefan Kangas <stefankangas@HIDDEN>
From: Pip Cet <pipcet@HIDDEN>
Subject: Re: bug#75784: Typo "unreadeable" in print.c; was exposed to Lisp
Message-ID: <87zfjgxp77.fsf@HIDDEN>
In-Reply-To: <875xm4z4bm.fsf@HIDDEN>
References: <87y0z167r1.fsf@HIDDEN>
 <CADwFkmm51L6PNq65TE8oy_YYYn1SQndGVjaW3dL_RPwSezFphg@HIDDEN>
 <875xm4z4bm.fsf@HIDDEN>
Feedback-ID: 112775352:user:proton
X-Pm-Message-ID: af70991de5227853bc8139ede4f51f1ad5ad3c36
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: 75784
Cc: 75784 <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 (-)

"Pip Cet" <pipcet@HIDDEN> writes:

> Pip Cet <pipcet@HIDDEN> writes:
>
>> "Stefan Kangas" <stefankangas@HIDDEN> writes:
>>
>> I'm sorry: why both names?  The new name should be permanent, unless we
>> decide to move to a different name entirely to get rid of the typo (this
>> is what happened with kdb-macro-redisplay, IIRC).
>>
>>> Would you like to suggest a patch?
>>
>> diff --git a/src/print.c b/src/print.c
>
> Here's a better patch.  While this goes overboard and fixes the case
> that Vprint_variable_mapping has become invalid, I'm not sure this can
> happen: Fassq can quit, but the Lisp backtrace won't expose its
> arguments to the debugger, it seems.  I'd like to err on the side of
> caution and double-check that this mapping is still valid in case
> someone somehow exposes it to Lisp.
>
> Note that specbind currently insists on a BARE_SYMBOL.  We'll have to
> check all callers to make sure they never pass a symbol-with-position!

Now done.  All but one call safe.

Proposed patch to fix what is very likely a nasty crashable bug in the
byte compiler:

From 9c70bd663a2045db92ed01ffedca23748f492d50 Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet@HIDDEN>
Subject: [PATCH] DO NOT COMMIT: Fix likely (but unproven) specbind bug in
 bytecode runner (bug#75784)

* src/bytecode.c (exec_byte_code): Ensure position is removed from
symbol taken from constant vector.  Check it is a symbol if
BYTE_CODE_SAFE.
---
 src/bytecode.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/bytecode.c b/src/bytecode.c
index d62d7d067b1..7516431cb96 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -734,8 +734,15 @@ #define DEFINE(name, value) [name] =3D &&insn_ ## name=
,
 =09CASE (Bvarbind5):
 =09  op -=3D Bvarbind;
 =09varbind:
-=09  /* Specbind can signal and thus GC.  */
-=09  specbind (vectorp[op], POP);
+=09  {
+=09    Lisp_Object symbol =3D vectorp[op];
+=09    symbol =3D maybe_remove_pos_from_symbol (symbol);
+#if BYTE_CODE_SAFE
+=09    CHECK_SYMBOL (symbol);
+#endif
+=09    /* Specbind can signal and thus GC.  */
+=09    specbind (symbol, POP);
+=09  }
 =09  NEXT;
=20
 =09CASE (Bcall6):
--=20
2.47.1

Marked as DO NOT COMMIT because this needs more thought.  Might have to
be applied with -n as this makes the first line "too long".

Will confirm and file separate bug report if crashable.

Pip





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

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


Received: (at 75784) by debbugs.gnu.org; 24 Jan 2025 14:15:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 24 09:15:31 2025
Received: from localhost ([127.0.0.1]:44273 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tbKT1-000267-HU
	for submit <at> debbugs.gnu.org; Fri, 24 Jan 2025 09:15:31 -0500
Received: from mail-4316.protonmail.ch ([185.70.43.16]:12023)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <pipcet@HIDDEN>)
 id 1tbKSs-00020M-Hq
 for 75784 <at> debbugs.gnu.org; Fri, 24 Jan 2025 09:15:25 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;
 s=protonmail3; t=1737728111; x=1737987311;
 bh=wO+myFiicSmv+lk5kFU97EKv1heU1kpoTO2pS342ZYk=;
 h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References:
 Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:
 Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post;
 b=JJthQpNnfhgItvcBEDaPYV0/oK1I39LDAOdpf5+DJq1In3uaWH66BID9ph3D3OuFo
 R5ZPzXyKGPr89pQdXdtwpt876rwKgFkuVJDyurT+TDneHOIXr8JXNXrXckbqsSNSGT
 wfiNeoqWcMnwu2wJXAuQ/sZcYjbdHvpxYZh+iQMjHztAaCSYv3o5zTnbH8L6mjuSND
 XIhBk6JSpC3VSFHhLsaX2hunxUYeTA8Fu9llGY+pg3vVm8fsGWAz9hB3KXa5haqB/e
 Egk6RoRbjqmEhwOI7SZJSK0zgpE8yH1lR8hVzj/12mUcpaTJhPsh/CukV5yOwZO9Nu
 kFHBhyojASXeQ==
Date: Fri, 24 Jan 2025 14:15:06 +0000
To: Stefan Kangas <stefankangas@HIDDEN>
From: Pip Cet <pipcet@HIDDEN>
Subject: Re: bug#75784: Typo "unreadeable" in print.c; was exposed to Lisp
Message-ID: <875xm4z4bm.fsf@HIDDEN>
In-Reply-To: <CADwFkmm51L6PNq65TE8oy_YYYn1SQndGVjaW3dL_RPwSezFphg@HIDDEN>
References: <87y0z167r1.fsf@HIDDEN>
 <CADwFkmm51L6PNq65TE8oy_YYYn1SQndGVjaW3dL_RPwSezFphg@HIDDEN>
Feedback-ID: 112775352:user:proton
X-Pm-Message-ID: 8f8d149445dad0ed9003f307da2bb982b7e90274
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: 75784
Cc: 75784 <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 (-)

Pip Cet <pipcet@HIDDEN> writes:

> "Stefan Kangas" <stefankangas@HIDDEN> writes:
>
> I'm sorry: why both names?  The new name should be permanent, unless we
> decide to move to a different name entirely to get rid of the typo (this
> is what happened with kdb-macro-redisplay, IIRC).
>
>> Would you like to suggest a patch?
>
> diff --git a/src/print.c b/src/print.c

Here's a better patch.  While this goes overboard and fixes the case
that Vprint_variable_mapping has become invalid, I'm not sure this can
happen: Fassq can quit, but the Lisp backtrace won't expose its
arguments to the debugger, it seems.  I'd like to err on the side of
caution and double-check that this mapping is still valid in case
someone somehow exposes it to Lisp.

Note that specbind currently insists on a BARE_SYMBOL.  We'll have to
check all callers to make sure they never pass a symbol-with-position!

Tested only very briefly.

From 879714122b1de7852be898a7940ed85aefde6e2e Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet@HIDDEN>
Subject: [PATCH] Fix typo (and bugs) in prin1's overrides code (bug#75754)

Vprint_variable_mapping may have been exposed to Lisp via the
backtrace if there was a previous quit in the Fassq call, requiring us
to check it still has the intended format.

* src/print.c (print_create_variable_mapping): Add correct spelling
"unreadable-function" as an alternative to "unreadeable-function".
(print_bind_overrides): Preserve original argument for error case. Use
FOR_EACH_TAIL, fixing infloop.  Warn about obsolete symbol.  Guard
against invalid Vprint_variable_mapping.
---
 src/print.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/print.c b/src/print.c
index 43698f309b1..0da2baa6e09 100644
--- a/src/print.c
+++ b/src/print.c
@@ -676,6 +676,8 @@ print_create_variable_mapping (void)
 =09   intern ("print-escape-multibyte"), Qnil),
     list3 (intern ("charset-text-property"),
 =09   intern ("print-charset-text-property"), Qnil),
+    list3 (intern ("unreadable-function"),
+=09   intern ("print-unreadable-function"), Qnil),
     list3 (intern ("unreadeable-function"),
 =09   intern ("print-unreadable-function"), Qnil),
     list3 (intern ("gensym"), intern ("print-gensym"), Qnil),
@@ -698,11 +700,10 @@ print_bind_overrides (Lisp_Object overrides)
=20
   if (EQ (overrides, Qt))
     print_bind_all_defaults ();
-  else if (!CONSP (overrides))
-    xsignal (Qwrong_type_argument, Qconsp);
   else
     {
-      while (!NILP (overrides))
+      Lisp_Object original_overrides =3D overrides;
+      FOR_EACH_TAIL (overrides)
 =09{
 =09  Lisp_Object setting =3D XCAR (overrides);
 =09  if (EQ (setting, Qt))
@@ -714,15 +715,23 @@ print_bind_overrides (Lisp_Object overrides)
 =09      Lisp_Object key =3D XCAR (setting),
 =09=09value =3D XCDR (setting);
 =09      Lisp_Object map =3D Fassq (key, Vprint_variable_mapping);
+=09      static bool warned;
+=09      if (!warned && SYMBOLP (key) &&
+=09=09  strcmp (SSDATA (SYMBOL_NAME (key)),
+=09=09=09  "unreadeable-function") =3D=3D 0)
+=09=09{
+=09=09  warned =3D true;
+=09=09  add_to_log ("Obsolete symbol `unreadeable-function' used.  Use `un=
readable-function' instead.");
+=09=09}
 =09      if (NILP (map))
 =09=09xsignal2 (Qwrong_type_argument, Qsymbolp, map);
-=09      specbind (XCAR (XCDR (map)), value);
+=09      Lisp_Object bare_symbol =3D
+=09=09maybe_remove_pos_from_symbol (Fcar (XCDR (map)));
+=09      CHECK_SYMBOL (bare_symbol);
+=09      specbind (bare_symbol, value);
 =09    }
-
-=09  if (!NILP (XCDR (overrides)) && !CONSP (XCDR (overrides)))
-=09    xsignal (Qwrong_type_argument, Qconsp);
-=09  overrides =3D XCDR (overrides);
 =09}
+      CHECK_LIST_END (overrides, original_overrides);
     }
 }
=20
--=20
2.47.1





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

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


Received: (at 75784) by debbugs.gnu.org; 24 Jan 2025 13:50:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 24 08:50:36 2025
Received: from localhost ([127.0.0.1]:44216 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tbK4y-0000xJ-8u
	for submit <at> debbugs.gnu.org; Fri, 24 Jan 2025 08:50:36 -0500
Received: from mail-10630.protonmail.ch ([79.135.106.30]:12575)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <pipcet@HIDDEN>)
 id 1tbK4u-0000x0-V3
 for 75784 <at> debbugs.gnu.org; Fri, 24 Jan 2025 08:50:34 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;
 s=protonmail3; t=1737726625; x=1737985825;
 bh=3oOt7pwejI+Zt3p3ciU3xv7jXbfKUh1VsygmNAldgzc=;
 h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References:
 Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:
 Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post;
 b=HQFILV+UuUrc/vnRxayyHEkyBP3BcSd4ta8ymGwLTB0dkD30T/M+zgqOJ8yZkDSb1
 dUV2TSzysfKrJjTi6ZQXLHcZhPsdcnyYzJN8sB2f2xS5AdsIMksLsjKVFS0AE+AyKM
 8wfryDS02HbUIBy0lvhBka6h3ICps9zp2ZpB95h8k/GJBu/vsoyNb6aR12RvnacOoI
 DzSOY+cnRUXcvAbRnn7Opq7gfRyaYVSh9fA2JGLv8M6gnxqr/qtL9ZW2lRVoshJ14g
 HGLecNYaQkCSKb2gsqHeMeavgkQGaM9+/kubww67zzSdP/TtL84KIzKTkbTj0FaOeK
 9ijUf0+M30nVw==
Date: Fri, 24 Jan 2025 13:50:20 +0000
To: Stefan Kangas <stefankangas@HIDDEN>
From: Pip Cet <pipcet@HIDDEN>
Subject: Re: bug#75784: Typo "unreadeable" in print.c; was exposed to Lisp
Message-ID: <87ed0sz5gw.fsf@HIDDEN>
In-Reply-To: <CADwFkmm51L6PNq65TE8oy_YYYn1SQndGVjaW3dL_RPwSezFphg@HIDDEN>
References: <87y0z167r1.fsf@HIDDEN>
 <CADwFkmm51L6PNq65TE8oy_YYYn1SQndGVjaW3dL_RPwSezFphg@HIDDEN>
Feedback-ID: 112775352:user:proton
X-Pm-Message-ID: 14586e0001556623ce4bce882d91609e4707745f
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: 75784
Cc: 75784 <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 (-)

"Stefan Kangas" <stefankangas@HIDDEN> writes:

> Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text
> editors" <bug-gnu-emacs@HIDDEN> writes:
>
>> print.c contains the following code:
>>
>> static void
>> print_create_variable_mapping (void)
>> {
>>   Lisp_Object total[] =3D {
>>     list3 (intern ("length"), intern ("print-length"), Qnil),
>>     list3 (intern ("level"), intern ("print-level"), Qnil),
>>     list3 (intern ("circle"), intern ("print-circle"), Qnil),
>>     list3 (intern ("quoted"), intern ("print-quoted"), Qt),
>>     list3 (intern ("escape-newlines"), intern ("print-escape-newlines"),=
 Qnil),
>>     list3 (intern ("escape-control-characters"),
>> =09   intern ("print-escape-control-characters"), Qnil),
>>     list3 (intern ("escape-nonascii"), intern ("print-escape-nonascii"),=
 Qnil),
>>     list3 (intern ("escape-multibyte"),
>> =09   intern ("print-escape-multibyte"), Qnil),
>>     list3 (intern ("charset-text-property"),
>> =09   intern ("print-charset-text-property"), Qnil),
>>     list3 (intern ("unreadeable-function"),
>> =09   intern ("print-unreadable-function"), Qnil),
>>     list3 (intern ("gensym"), intern ("print-gensym"), Qnil),
>>     list3 (intern ("continuous-numbering"),
>> =09   intern ("print-continuous-numbering"), Qnil),
>>     list3 (intern ("number-table"), intern ("print-number-table"), Qnil)=
,
>>     list3 (intern ("float-format"), intern ("float-output-format"), Qnil=
),
>>     list3 (intern ("integers-as-characters"),
>> =09   intern ("print-integers-as-characters"), Qnil),
>>   };
>>
>>   Vprint_variable_mapping =3D CALLMANY (Flist, total);
>> }
>>
>> Unfortunately, "unreadable" is spelled in two different ways: the first
>> instance is "unreadeable-function", with an "e", the second is
>> "print-unreadable-function", without the "e".
>>
>> I think this was a simple typo at one point, but it was exposed as part
>> of the Lisp API and people may have used it.  OTOH, it wasn't introduced
>> too long ago, so we might want to fix it and see whether anyone
>> complains.
>>
>> The documentation also needs to be updated, either to change it to the
>> correct spelling or to mention the typo so Lisp hackers know this is
>> another kdb-macro-redisplay.
>
> Thanks for catching this typo.

Thanks for suggesting I report it.

> I think we will have to support both spellings, at least for a while.

Okay.

> Do we have a way to add an obsoletion warning to both names?

I'm sorry: why both names?  The new name should be permanent, unless we
decide to move to a different name entirely to get rid of the typo (this
is what happened with kdb-macro-redisplay, IIRC).

While we could check for an obsoletion property on the symbol in
question in print_bind_overrides, it's very likely that if anyone
actually uses this code, they use it in an automated loop, so the
warning would need rate-limiting as well.  My suggestion is to print the
warning just once, increasing the risk it'll be missed but saving us
having to write a rate-limiting facility for Emacs which, if I
understand the context directly, cannot use Lisp.

> Would you like to suggest a patch?

diff --git a/src/print.c b/src/print.c
index 8c10ffa883e..918cef107b7 100644
--- a/src/print.c
+++ b/src/print.c
@@ -677,6 +677,8 @@ print_create_variable_mapping (void)
 =09   intern ("print-escape-multibyte"), Qnil),
     list3 (intern ("charset-text-property"),
 =09   intern ("print-charset-text-property"), Qnil),
+    list3 (intern ("unreadable-function"),
+=09   intern ("print-unreadable-function"), Qnil),
     list3 (intern ("unreadeable-function"),
 =09   intern ("print-unreadable-function"), Qnil),
     list3 (intern ("gensym"), intern ("print-gensym"), Qnil),

should allow using the correct spelling, but not add the obsoletion
warning.

I do not know how to make a symbol that is unbound but used to indicate
a keyword (I don't understand why no ":" is present, or how this would
change the situation) obsolete.

How would you like to proceed?

As is, unfortunately, normal for loops that attempt to avoid
FOR_EACH_TAIL, print_bind_overrides misses a corner case and infloops
unquittably for:

(prin1 "foo" nil (quote #1=3D(t . #1#)))

Maybe we should build on the useful parts of this first attempt and
review it carefully for a second version.

Pip





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

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


Received: (at 75784) by debbugs.gnu.org; 24 Jan 2025 12:47:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 24 07:47:49 2025
Received: from localhost ([127.0.0.1]:44070 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tbJ6D-0006Nf-IQ
	for submit <at> debbugs.gnu.org; Fri, 24 Jan 2025 07:47:49 -0500
Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]:55368)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1tbJ6B-0006NR-1j
 for 75784 <at> debbugs.gnu.org; Fri, 24 Jan 2025 07:47:47 -0500
Received: by mail-ed1-x531.google.com with SMTP id
 4fb4d7f45d1cf-5dc149e14fcso2324701a12.2
 for <75784 <at> debbugs.gnu.org>; Fri, 24 Jan 2025 04:47:47 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1737722861; x=1738327661; darn=debbugs.gnu.org;
 h=to:subject:message-id:date:mime-version:references:in-reply-to:from
 :from:to:cc:subject:date:message-id:reply-to;
 bh=Rzzahq1ldJ1A4zbtFFSXPpEXG5xjhJfWZ7IOT3sw1aw=;
 b=B/+waepML+OycTr8ZwNunIsBqWBIXNIbCGhmsCJlTR8YpcpP5UEZORNWApH9qk2M15
 aZ8BpZ6r8wcIU2eNHHVw1rjHPPu1k0HvUlwJLoe5ffb2/tcL94bHYJgr6V8RrkyQqmMp
 phpT668NFj9FYex1JYYhkZTDff9xjhZHI6TmhvAD9oi+cpGQ/4Aog0sELS9+RRyg5hP9
 RCJ8J1Ug/umqETvJrGUC4M6mWAjBppwwMRHOM11mph+LQxyF5xLBA2NxGtU0+EBEb2Ko
 4/+S/kHhTgD2BFI6ZcuMPacU4rvwXYH14et6V//NNYZgR5VUR91O+UwgOnIkaXiPs8ie
 SrEg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1737722861; x=1738327661;
 h=to:subject:message-id:date:mime-version:references:in-reply-to:from
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=Rzzahq1ldJ1A4zbtFFSXPpEXG5xjhJfWZ7IOT3sw1aw=;
 b=sSwU2MQ9GXF3HJd2WOEMBBRbSZrF/UHFP6A82dZCuyz5OGwUwwDmFmD62qW9dkwRLL
 GwPuMICbk+wryu0BJsswNz3JlvR16nshKuWwaEkb/8RPHPXsRX6GR2zX9RRUpNykMakq
 8uudyWU5OX/Y9876ZTaGuCNq5CQ6SWDq90vMYmlynriiEunE7cK0Bn3g3j+8yNDWTf4n
 uZMAaFBAE2/iSV4xz9MqrOTd52vky7oR0c8sivj6rMCebiio0Qcxcer2qvGrKlMHg3qm
 VwTw5qQXP9ZXHjzNHEOswlR4cs8ETC09KR4Ok5vPAzK7tPDqOjJy+pLJ0FdeDAb6enwp
 fGeQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCUkifrScWpAMWff9ZTdUA3CWoWTb3Lpqt/GEYdVCxRxgzbgYcOIkchWg941i8GH2i+hPwLWKw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YyMaUBdH2Fkoan39lTTsZalDtpkrutkN8CSbsN+cMa8hYLGe45C
 QMCmRsuPWHWfGGL2PIh/gPNRNFLc8EI1eqvzHksmiT3A1A9fPkxAnHDjMm/LiDyQZWpnnejcXen
 ziYcAfneo3qXlwwgs9mJb7o1/7AbMU21e
X-Gm-Gg: ASbGncszanrzdQ8fxa2DAMJLI295A3Oqaz7DF6f7zIb1Ha6m/q4ZcOdAgA6ZGX3oaBc
 utvGk1tcJ0ZAcAI9h8JUU4ALAnKBxATlRFXFERLQNN0GWMta2vBKrH6dVXs/q1tQ=
X-Google-Smtp-Source: AGHT+IFzCvYy92kxN9XNAtAx0NkMBPz3A+kSHDKyfT9l/ZUWlxcPZ8VsHD39y8O7xbitT7J4pFgxXTsQ0fXiW5SOuqQ=
X-Received: by 2002:a05:6402:518f:b0:5d0:81dc:f20e with SMTP id
 4fb4d7f45d1cf-5db7d318a0bmr29585263a12.17.1737722860666; Fri, 24 Jan 2025
 04:47:40 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Fri, 24 Jan 2025 06:47:40 -0600
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <87y0z167r1.fsf@HIDDEN>
References: <87y0z167r1.fsf@HIDDEN>
MIME-Version: 1.0
Date: Fri, 24 Jan 2025 06:47:40 -0600
X-Gm-Features: AWEUYZmW7_6p31m2phW7GGMLJeAWSnn2DPFOsjXbx0MdH_RUeTakXnPUP3FXKho
Message-ID: <CADwFkmm51L6PNq65TE8oy_YYYn1SQndGVjaW3dL_RPwSezFphg@HIDDEN>
Subject: Re: bug#75784: Typo "unreadeable" in print.c; was exposed to Lisp
To: Pip Cet <pipcet@HIDDEN>, 75784 <at> debbugs.gnu.org
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75784
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 (-)

Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs@HIDDEN> writes:

> print.c contains the following code:
>
> static void
> print_create_variable_mapping (void)
> {
>   Lisp_Object total[] = {
>     list3 (intern ("length"), intern ("print-length"), Qnil),
>     list3 (intern ("level"), intern ("print-level"), Qnil),
>     list3 (intern ("circle"), intern ("print-circle"), Qnil),
>     list3 (intern ("quoted"), intern ("print-quoted"), Qt),
>     list3 (intern ("escape-newlines"), intern ("print-escape-newlines"), Qnil),
>     list3 (intern ("escape-control-characters"),
> 	   intern ("print-escape-control-characters"), Qnil),
>     list3 (intern ("escape-nonascii"), intern ("print-escape-nonascii"), Qnil),
>     list3 (intern ("escape-multibyte"),
> 	   intern ("print-escape-multibyte"), Qnil),
>     list3 (intern ("charset-text-property"),
> 	   intern ("print-charset-text-property"), Qnil),
>     list3 (intern ("unreadeable-function"),
> 	   intern ("print-unreadable-function"), Qnil),
>     list3 (intern ("gensym"), intern ("print-gensym"), Qnil),
>     list3 (intern ("continuous-numbering"),
> 	   intern ("print-continuous-numbering"), Qnil),
>     list3 (intern ("number-table"), intern ("print-number-table"), Qnil),
>     list3 (intern ("float-format"), intern ("float-output-format"), Qnil),
>     list3 (intern ("integers-as-characters"),
> 	   intern ("print-integers-as-characters"), Qnil),
>   };
>
>   Vprint_variable_mapping = CALLMANY (Flist, total);
> }
>
> Unfortunately, "unreadable" is spelled in two different ways: the first
> instance is "unreadeable-function", with an "e", the second is
> "print-unreadable-function", without the "e".
>
> I think this was a simple typo at one point, but it was exposed as part
> of the Lisp API and people may have used it.  OTOH, it wasn't introduced
> too long ago, so we might want to fix it and see whether anyone
> complains.
>
> The documentation also needs to be updated, either to change it to the
> correct spelling or to mention the typo so Lisp hackers know this is
> another kdb-macro-redisplay.

Thanks for catching this typo.

I think we will have to support both spellings, at least for a while.
Do we have a way to add an obsoletion warning to both names?

Would you like to suggest a patch?




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

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


Received: (at submit) by debbugs.gnu.org; 23 Jan 2025 12:21:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 23 07:21:52 2025
Received: from localhost ([127.0.0.1]:39673 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tawDY-0006FE-8j
	for submit <at> debbugs.gnu.org; Thu, 23 Jan 2025 07:21:52 -0500
Received: from lists.gnu.org ([2001:470:142::17]:49848)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <pipcet@HIDDEN>)
 id 1tawDV-0006Ev-GX
 for submit <at> debbugs.gnu.org; Thu, 23 Jan 2025 07:21:50 -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 <pipcet@HIDDEN>)
 id 1tawDM-0002Qy-Pw
 for bug-gnu-emacs@HIDDEN; Thu, 23 Jan 2025 07:21:41 -0500
Received: from mail-40131.protonmail.ch ([185.70.40.131])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <pipcet@HIDDEN>)
 id 1tawDK-0005py-6N
 for bug-gnu-emacs@HIDDEN; Thu, 23 Jan 2025 07:21:40 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;
 s=protonmail3; t=1737634895; x=1737894095;
 bh=G7a7uAWsOst5xAuiAUharzekT8bW/6g88AfApLuj//E=;
 h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date:
 Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector:
 List-Unsubscribe:List-Unsubscribe-Post;
 b=rl170BUt/4v9MJjuGoj2eGQX3b0g3Tq2OJNCGLmN6/nxgvrFrxqohzo0TnZ1PUpsT
 FbBQbQpecKt14BeJf1um7NfLcw51TsARFFygzboh3yZPj204xXoFUJdq8W/dX4guTb
 VcZrBdJNNcLImh0k2i/ivJ30GCxLuR3Dly7uUIsftLLgx9aMQ6o9au2VkfE+9MiM17
 Yd0+cQzsk5pHQgNjIjl3WfwYYymzyrBS70BMJWlj6FuOW0C0DJ+2VLQSk9tUnofxiY
 T/D8l9x1vqxkrUTg4Ze9nCOtILMJgb80KbCmeBxKEs7Kya4J5S37WN2hGkifoTBq4l
 22GzG3z5jTE1g==
Date: Thu, 23 Jan 2025 12:21:32 +0000
To: bug-gnu-emacs@HIDDEN
From: Pip Cet <pipcet@HIDDEN>
Subject: Typo "unreadeable" in print.c; was exposed to Lisp
Message-ID: <87y0z167r1.fsf@HIDDEN>
Feedback-ID: 112775352:user:proton
X-Pm-Message-ID: e4b34f70f3ab8ed14daa5b4c9fe02867f881872b
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=185.70.40.131; envelope-from=pipcet@HIDDEN;
 helo=mail-40131.protonmail.ch
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.043,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

print.c contains the following code:

static void
print_create_variable_mapping (void)
{
  Lisp_Object total[] =3D {
    list3 (intern ("length"), intern ("print-length"), Qnil),
    list3 (intern ("level"), intern ("print-level"), Qnil),
    list3 (intern ("circle"), intern ("print-circle"), Qnil),
    list3 (intern ("quoted"), intern ("print-quoted"), Qt),
    list3 (intern ("escape-newlines"), intern ("print-escape-newlines"), Qn=
il),
    list3 (intern ("escape-control-characters"),
=09   intern ("print-escape-control-characters"), Qnil),
    list3 (intern ("escape-nonascii"), intern ("print-escape-nonascii"), Qn=
il),
    list3 (intern ("escape-multibyte"),
=09   intern ("print-escape-multibyte"), Qnil),
    list3 (intern ("charset-text-property"),
=09   intern ("print-charset-text-property"), Qnil),
    list3 (intern ("unreadeable-function"),
=09   intern ("print-unreadable-function"), Qnil),
    list3 (intern ("gensym"), intern ("print-gensym"), Qnil),
    list3 (intern ("continuous-numbering"),
=09   intern ("print-continuous-numbering"), Qnil),
    list3 (intern ("number-table"), intern ("print-number-table"), Qnil),
    list3 (intern ("float-format"), intern ("float-output-format"), Qnil),
    list3 (intern ("integers-as-characters"),
=09   intern ("print-integers-as-characters"), Qnil),
  };

  Vprint_variable_mapping =3D CALLMANY (Flist, total);
}

Unfortunately, "unreadable" is spelled in two different ways: the first
instance is "unreadeable-function", with an "e", the second is
"print-unreadable-function", without the "e".

I think this was a simple typo at one point, but it was exposed as part
of the Lisp API and people may have used it.  OTOH, it wasn't introduced
too long ago, so we might want to fix it and see whether anyone
complains.

The documentation also needs to be updated, either to change it to the
correct spelling or to mention the typo so Lisp hackers know this is
another kdb-macro-redisplay.





Acknowledgement sent to Pip Cet <pipcet@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#75784; 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: Sat, 25 Jan 2025 00:30:02 UTC

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