From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#63881: 29.0.91; apropos-documentation fails when load-history contains element whose CAR is nil Date: Sat, 10 Jun 2023 12:25:49 +0300 Message-ID: <83ttvfzn1e.fsf@gnu.org> References: <878rd0c4df.fsf@gmail.com> <83cz2b7pyp.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32675"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63881@debbugs.gnu.org, visuweshm@gmail.com To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 10 11:26:33 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q7urg-0008JW-4Z for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 10 Jun 2023 11:26:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7urH-0000A7-PD; Sat, 10 Jun 2023 05:26:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7urD-00009t-44 for bug-gnu-emacs@gnu.org; Sat, 10 Jun 2023 05:26:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q7urC-0003iS-Pc for bug-gnu-emacs@gnu.org; Sat, 10 Jun 2023 05:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q7urC-0003DA-I4 for bug-gnu-emacs@gnu.org; Sat, 10 Jun 2023 05:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Jun 2023 09:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63881 X-GNU-PR-Package: emacs Original-Received: via spool by 63881-submit@debbugs.gnu.org id=B63881.168638914812323 (code B ref 63881); Sat, 10 Jun 2023 09:26:02 +0000 Original-Received: (at 63881) by debbugs.gnu.org; 10 Jun 2023 09:25:48 +0000 Original-Received: from localhost ([127.0.0.1]:33294 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7uqx-0003Ch-SU for submit@debbugs.gnu.org; Sat, 10 Jun 2023 05:25:48 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7uqv-0003CT-Nn for 63881@debbugs.gnu.org; Sat, 10 Jun 2023 05:25:46 -0400 Original-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 ) id 1q7uqq-0003ej-2m; Sat, 10 Jun 2023 05:25:40 -0400 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=x94WTCshZHiFt5bcTIJelPx3q7AmuS/YSTzbdq+kfsc=; b=VQpD6XRATWIP tzLyneYv9fPEujV1CKGou4v+N2tOLKfe2ffxJ1B4d3alSnSFPF+4KHaTWTYxiphKHLC6dNrhHpXrk 2YCFcD/47AuJQmNAIbdE+/FugnC0GmCI4hdoZpQqPLD7vS0jPAJsqFpPaJEf4VDDiXSlK+6ZaEw3I +WfGEJos5XD74iXS0XjkVApt7baYud0m98soVbO7LPPLSjAxUvXyicysrcEwbdTZ5EaD1H5oB9nLU KCJO+rrqF8PXjFQXktfFCudrzxQ9iRNZnI5Nh04XNHKm6KnNA1K78x1wTW6qkO5gG+PaDuTlwYl+T hvgibnzSRi4zrrSedPeXXA==; Original-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 ) id 1q7uqp-0000EN-1a; Sat, 10 Jun 2023 05:25:39 -0400 In-Reply-To: <83cz2b7pyp.fsf@gnu.org> (message from Eli Zaretskii on Sun, 04 Jun 2023 08:31:58 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:263206 Archived-At: > Cc: 63881@debbugs.gnu.org > Date: Sun, 04 Jun 2023 08:31:58 +0300 > From: Eli Zaretskii > > > From: Visuwesh > > Date: Sun, 04 Jun 2023 08:37:08 +0530 > > > > > > As per (info "(elisp) Where Defined"), load-history may contain an > > element whose CAR is nil if eval-buffer was used to evaluate a defun > > in a non-file-visiting buffer. > > > > After such an entry is added to load-history, apropos-documentation > > fails with the backtrace at end. > > How did you add such an entry to load-history? IOW, is there a > real-life use case where this happens? > > > To reproduce the issue, > > > > 1. emacs -Q > > 2. Insert (defun test () t) > > 3. M-x eval-buffer RET > > 4. Confirm that a nil entry is present in load-history by evaluating > > (alist-get nil load-history 'none) > > 5. C-h d any RET > > > > The problem lies in apropos--map-preloaded-atoms in the part > > > > (dolist (x load-history) > > (when (string-match preloaded-regexp (car x)) > > ^^^^^^^^ > > (dolist (def (cdr x)) > > (cond > > ((symbolp def) (funcall f def)) > > ((eq 'defun (car-safe def)) (funcall f (cdr def))))))))) > > > > > > ---- > > > > > > Debugger entered--Lisp error: (wrong-type-argument stringp nil) > > string-match("\\`/home/viz/lib/ports/emacs/lisp/\\(?:abbrev\\|b\\(?:..." nil) > > (if (string-match preloaded-regexp (car x)) (progn (let ((tail (cdr x))) (while tail (let ((def (car tail))) (cond ((symbolp def) (funcall f def)) ((eq ... ...) (funcall f ...))) (setq tail (cdr tail))))))) Stefan, does the below look good for emacs-29? diff --git a/lisp/apropos.el b/lisp/apropos.el index 5d7fe69..c9551b0 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -900,7 +900,8 @@ apropos--map-preloaded-atoms ;; state of the `obarray' when we dumped, which we may also be able to ;; use in `bytecomp' to provide a clean initial environment?) (dolist (x load-history) - (when (string-match preloaded-regexp (car x)) + (when (let ((elt (car x))) + (and (stringp elt) (string-match preloaded-regexp elt))) (dolist (def (cdr x)) (cond ((symbolp def) (funcall f def))