* bug#59684: 29.0.50; [PATCH] package.el: Insert news for installed packages only
@ 2022-11-29 16:54 Andrii Kolomoiets
2022-11-29 21:06 ` Philip Kaludercic
0 siblings, 1 reply; 6+ messages in thread
From: Andrii Kolomoiets @ 2022-11-29 16:54 UTC (permalink / raw)
To: 59684; +Cc: Philip Kaludercic
[-- Attachment #1: Type: text/plain, Size: 599 bytes --]
Hi,
In some folder, e.g. "/tmp":
1. Create folder named "news"
2. emacs -Q
3. M-x list-packages
4. RET on any available not installed package
This will produce "Read error: Is a directory, /tmp/news" message.
In GNU Emacs 29.0.50
Repository revision: 2772ebe3667f28cefd0d6134204ce6a3c7a8c323
Repository branch: master
Adding news to package description was introuced in
dd98fedd0c7f27bfba046d761042c19181cb461d
Adding Philip to Cc as the author of the original commit.
Attached patch solves issue by checking that:
1. pkg-dir is not nil
2. pkg-dir is not 'builtin
3. "news" is a regular file
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Insert-news-for-installed-packages-only.patch --]
[-- Type: text/x-patch, Size: 1243 bytes --]
From 9bd185609643ec861b02b4327295bb6db3b82974 Mon Sep 17 00:00:00 2001
From: muffinmad <andreyk.mad@gmail.com>
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 | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 8d44fae30a0..f722eb8fae9 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2696,8 +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))
- ((file-readable-p file)))
+ (news (and-let* (pkg-dir
+ ((not built-in))
+ (file (expand-file-name "news" pkg-dir))
+ ((file-regular-p file)))
file)))
(when (string= status "avail-obso")
(setq status "available obsolete"))
--
2.32.1 (Apple Git-133)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#59684: 29.0.50; [PATCH] package.el: Insert news for installed packages only
2022-11-29 16:54 bug#59684: 29.0.50; [PATCH] package.el: Insert news for installed packages only Andrii Kolomoiets
@ 2022-11-29 21:06 ` Philip Kaludercic
2022-11-29 21:16 ` Andrii Kolomoiets
0 siblings, 1 reply; 6+ messages in thread
From: Philip Kaludercic @ 2022-11-29 21:06 UTC (permalink / raw)
To: Andrii Kolomoiets; +Cc: 59684
Andrii Kolomoiets <andreyk.mad@gmail.com> writes:
> Hi,
>
> In some folder, e.g. "/tmp":
> 1. Create folder named "news"
> 2. emacs -Q
> 3. M-x list-packages
> 4. RET on any available not installed package
>
> This will produce "Read error: Is a directory, /tmp/news" message.
>
> In GNU Emacs 29.0.50
> Repository revision: 2772ebe3667f28cefd0d6134204ce6a3c7a8c323
> Repository branch: master
>
> Adding news to package description was introuced in
> dd98fedd0c7f27bfba046d761042c19181cb461d
>
> Adding Philip to Cc as the author of the original commit.
>
> Attached patch solves issue by checking that:
> 1. pkg-dir is not nil
> 2. pkg-dir is not 'builtin
> 3. "news" is a regular file
This sounds good.
> From 9bd185609643ec861b02b4327295bb6db3b82974 Mon Sep 17 00:00:00 2001
> From: muffinmad <andreyk.mad@gmail.com>
> 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 | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index 8d44fae30a0..f722eb8fae9 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -2696,8 +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))
> - ((file-readable-p file)))
> + (news (and-let* (pkg-dir
> + ((not built-in))
> + (file (expand-file-name "news" pkg-dir))
> + ((file-regular-p file)))
Shouldn't we keep `file-readable-p'?
> file)))
> (when (string= status "avail-obso")
> (setq status "available obsolete"))
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#59684: 29.0.50; [PATCH] package.el: Insert news for installed packages only
2022-11-29 21:06 ` Philip Kaludercic
@ 2022-11-29 21:16 ` Andrii Kolomoiets
2022-11-29 21:25 ` Philip Kaludercic
0 siblings, 1 reply; 6+ messages in thread
From: Andrii Kolomoiets @ 2022-11-29 21:16 UTC (permalink / raw)
To: Philip Kaludercic; +Cc: 59684
Philip Kaludercic <philipk@posteo.net> 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'.
--
Andrii
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#59684: 29.0.50; [PATCH] package.el: Insert news for installed packages only
2022-11-29 21:16 ` Andrii Kolomoiets
@ 2022-11-29 21:25 ` Philip Kaludercic
2022-11-29 21:38 ` Andrii Kolomoiets
0 siblings, 1 reply; 6+ messages in thread
From: Philip Kaludercic @ 2022-11-29 21:25 UTC (permalink / raw)
To: Andrii Kolomoiets; +Cc: 59684
Andrii Kolomoiets <andreyk.mad@gmail.com> writes:
> Philip Kaludercic <philipk@posteo.net> 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...
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#59684: 29.0.50; [PATCH] package.el: Insert news for installed packages only
2022-11-29 21:25 ` Philip Kaludercic
@ 2022-11-29 21:38 ` Andrii Kolomoiets
2022-11-30 19:53 ` Philip Kaludercic
0 siblings, 1 reply; 6+ messages in thread
From: Andrii Kolomoiets @ 2022-11-29 21:38 UTC (permalink / raw)
To: Philip Kaludercic; +Cc: 59684
[-- Attachment #1: Type: text/plain, Size: 543 bytes --]
Philip Kaludercic <philipk@posteo.net> 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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Insert-news-for-installed-packages-only.patch --]
[-- Type: text/x-patch, Size: 1197 bytes --]
From ac7fddd70d8cc1ff946826d4624370538032de7a Mon Sep 17 00:00:00 2001
From: muffinmad <andreyk.mad@gmail.com>
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)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#59684: 29.0.50; [PATCH] package.el: Insert news for installed packages only
2022-11-29 21:38 ` Andrii Kolomoiets
@ 2022-11-30 19:53 ` Philip Kaludercic
0 siblings, 0 replies; 6+ messages in thread
From: Philip Kaludercic @ 2022-11-30 19:53 UTC (permalink / raw)
To: Andrii Kolomoiets; +Cc: 59684-done
Andrii Kolomoiets <andreyk.mad@gmail.com> writes:
> Philip Kaludercic <philipk@posteo.net> 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.
Thanks, I've pushed the change.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-11-30 19:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-29 16:54 bug#59684: 29.0.50; [PATCH] package.el: Insert news for installed packages only Andrii Kolomoiets
2022-11-29 21:06 ` Philip Kaludercic
2022-11-29 21:16 ` Andrii Kolomoiets
2022-11-29 21:25 ` Philip Kaludercic
2022-11-29 21:38 ` Andrii Kolomoiets
2022-11-30 19:53 ` Philip Kaludercic
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).