Subject: Re: bug#59684: 29.0.50; [PATCH] package.el: Insert news for installed packages only

From: Andrii Kolomoiets <[email-masked]>
Date: Tue, 29 Nov 2022 23:38:24 +0200

Philip Kaludercic <[email-masked]> writes:

>>>> +                          ((file-regular-p file)))
>>>
>>> Shouldn't we keep `file-readable-p'?
>>
>> I think we should use `file-regular-p' so even if the pkg-dir will
>> contain directory named "news" we will not try to insert it with
>> `insert-file-contents'.
>
> I agree that `file-regular-p' is sensible, what I meant was using
> `file-readable-p' in addition to that.  But I guess that all in all,
> this is a rare circumstance...

Oh, right.  Makes sense.  I've updated the patch.
>From ac7fddd70d8cc1ff946826d4624370538032de7a Mon Sep 17 00:00:00 2001
From: muffinmad <[email-masked]>
Date: Mon, 28 Nov 2022 23:09:59 +0200
Subject: [PATCH] Insert news for installed packages only

* lisp/emacs-lisp/package.el (describe-package-1): Check package is
installed and "news" is a regular file.
---
 lisp/emacs-lisp/package.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 8d44fae30a0..99538df228b 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2696,7 +2696,10 @@ describe-package-1
          (signed (if desc (package-desc-signed desc)))
          (maintainer (cdr (assoc :maintainer extras)))
          (authors (cdr (assoc :authors extras)))
-         (news (and-let* ((file (expand-file-name "news" pkg-dir))
+         (news (and-let* (pkg-dir
+                          ((not built-in))
+                          (file (expand-file-name "news" pkg-dir))
+                          ((file-regular-p file))
                           ((file-readable-p file)))
                  file)))
     (when (string= status "avail-obso")
-- 
2.32.1 (Apple Git-133)