unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* package-vc-install bug?
@ 2024-02-09  9:13 James Thomas
  2024-02-10 15:41 ` Philip Kaludercic
  0 siblings, 1 reply; 6+ messages in thread
From: James Thomas @ 2024-02-09  9:13 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: Philip Kaludercic

M-x package-vc-install RET <package> RET fails with the following on my
system:

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (error "Can’t read whole string")
  signal(error ("Can’t read whole string"))
  error("Can't read whole string")
  package-read-from-string("((emacs \"28.1\") (python \"0.2\") (csv-mode \"1.12\"))")
  package-vc--unpack-1(#s(package-desc :name python-view-data :version (20230508 543) :summary "View data in python" :reqs ((emacs (28 1)) (python (0 2)) (csv-mode (1 12))) :kind vc :archive "melpa" :dir "/home/user/.emacs.d/elpa/python-view-data/" :extras ((:commit . "1dd5f99679db9767530cfc20642a40a48bd479be") (:authors ("Shuguang Sun" . "shuguang79@qq.com")) (:maintainers ("Shuguang Sun" . "shuguang79@qq.com")) (:maintainer "Shuguang Sun" . "shuguang79@qq.com") (:keywords "tools") (:url . "https://github.com/ShuguangSun/python-view-data")) :signed nil) "/home/user/.emacs.d/elpa/python-view-data/")
  package-vc--unpack(#s(package-desc :name python-view-data :version (20230508 543) :summary "View data in python" :reqs ((emacs (28 1)) (python (0 2)) (csv-mode (1 12))) :kind tar :archive "melpa" :dir nil :extras ((:commit . "1dd5f99679db9767530cfc20642a40a48bd479be") (:authors ("Shuguang Sun" . "shuguang79@qq.com")) (:maintainers ("Shuguang Sun" . "shuguang79@qq.com")) (:maintainer "Shuguang Sun" . "shuguang79@qq.com") (:keywords "tools") (:url . "https://github.com/ShuguangSun/python-view-data")) :signed nil) (:url "https://github.com/ShuguangSun/python-view-data.git") nil)
  package-vc-install("python-view-data" nil nil python-view-data)
  funcall-interactively(package-vc-install "python-view-data" nil nil python-view-data)
  call-interactively(package-vc-install record nil)
  command-execute(package-vc-install record)
  execute-extended-command(nil "package-vc-install" "pac")
  funcall-interactively(execute-extended-command nil "package-vc-install" "pac")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)
--8<---------------cut here---------------end--------------->8---

and I can fix it with this:

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index db0cc515e46..979bbb343ed 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -526,6 +526,7 @@ package-vc--unpack-1
             (when-let* ((require-lines (lm-header-multiline "package-requires")))
               (thread-last
                 (mapconcat #'identity require-lines " ")
+                ((lambda (line) (concat line "\n")))
                 package-read-from-string
                 lm--prepare-package-dependencies
                 (nconc deps)

But I'm shying away from reporting a bug because I can't find any recent
code changes that could cause this.

Could someone help/confirm? I'm using Emacs 29.

--



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: package-vc-install bug?
  2024-02-09  9:13 package-vc-install bug? James Thomas
@ 2024-02-10 15:41 ` Philip Kaludercic
  2024-02-10 21:57   ` James Thomas
  0 siblings, 1 reply; 6+ messages in thread
From: Philip Kaludercic @ 2024-02-10 15:41 UTC (permalink / raw)
  To: James Thomas; +Cc: help-gnu-emacs

James Thomas <jimjoe@gmx.net> writes:

> M-x package-vc-install RET <package> RET fails with the following on my
> system:

Does this issue occur for every package?

> Debugger entered--Lisp error: (error "Can’t read whole string")
>   signal(error ("Can’t read whole string"))
>   error("Can't read whole string")
>   package-read-from-string("((emacs \"28.1\") (python \"0.2\") (csv-mode \"1.12\"))")
>   package-vc--unpack-1(#s(package-desc :name python-view-data :version (20230508 543) :summary "View data in python" :reqs ((emacs (28 1)) (python (0 2)) (csv-mode (1 12))) :kind vc :archive "melpa" :dir "/home/user/.emacs.d/elpa/python-view-data/" :extras ((:commit . "1dd5f99679db9767530cfc20642a40a48bd479be") (:authors ("Shuguang Sun" . "shuguang79@qq.com")) (:maintainers ("Shuguang Sun" . "shuguang79@qq.com")) (:maintainer "Shuguang Sun" . "shuguang79@qq.com") (:keywords "tools") (:url . "https://github.com/ShuguangSun/python-view-data")) :signed nil) "/home/user/.emacs.d/elpa/python-view-data/")
>   package-vc--unpack(#s(package-desc :name python-view-data :version (20230508 543) :summary "View data in python" :reqs ((emacs (28 1)) (python (0 2)) (csv-mode (1 12))) :kind tar :archive "melpa" :dir nil :extras ((:commit . "1dd5f99679db9767530cfc20642a40a48bd479be") (:authors ("Shuguang Sun" . "shuguang79@qq.com")) (:maintainers ("Shuguang Sun" . "shuguang79@qq.com")) (:maintainer "Shuguang Sun" . "shuguang79@qq.com") (:keywords "tools") (:url . "https://github.com/ShuguangSun/python-view-data")) :signed nil) (:url "https://github.com/ShuguangSun/python-view-data.git") nil)
>   package-vc-install("python-view-data" nil nil python-view-data)
>   funcall-interactively(package-vc-install "python-view-data" nil nil python-view-data)
>   call-interactively(package-vc-install record nil)
>   command-execute(package-vc-install record)
>   execute-extended-command(nil "package-vc-install" "pac")
>   funcall-interactively(execute-extended-command nil "package-vc-install" "pac")
>   call-interactively(execute-extended-command nil nil)
>   command-execute(execute-extended-command)
>
> and I can fix it with this:
>
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index db0cc515e46..979bbb343ed 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -526,6 +526,7 @@ package-vc--unpack-1
>              (when-let* ((require-lines (lm-header-multiline "package-requires")))
>                (thread-last
>                  (mapconcat #'identity require-lines " ")
> +                ((lambda (line) (concat line "\n")))

What I don't get, is what adding a newline to the end of a string should
change?

(read-from-string "((emacs \"29.1\"))")   ;=> (((emacs "29.1")) . 16)
(read-from-string "((emacs \"29.1\"\n))") ;=> (((emacs "29.1")) . 17)

>                  package-read-from-string
>                  lm--prepare-package-dependencies
>                  (nconc deps)
>
> But I'm shying away from reporting a bug because I can't find any recent
> code changes that could cause this.
>
> Could someone help/confirm? I'm using Emacs 29.
>
> --
>

-- 
Philip Kaludercic



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: package-vc-install bug?
  2024-02-10 15:41 ` Philip Kaludercic
@ 2024-02-10 21:57   ` James Thomas
  2024-02-11  9:28     ` Philip Kaludercic
  0 siblings, 1 reply; 6+ messages in thread
From: James Thomas @ 2024-02-10 21:57 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: help-gnu-emacs

Philip Kaludercic wrote:

> James Thomas <jimjoe@gmx.net> writes:
>
>> M-x package-vc-install RET <package> RET fails with the following on my
>> system:
>
> Does this issue occur for every package?

Yes, for every one I've tried (in my system).

> What I don't get, is what adding a newline to the end of a string should
> change?
>
> (read-from-string "((emacs \"29.1\"))")   ;=> (((emacs "29.1")) . 16)
> (read-from-string "((emacs \"29.1\"\n))") ;=> (((emacs "29.1")) . 17)

The problem occurs in `package-read-from-string', not `read-from-string'
(I add the newline at the very end: "((emacs \"29.1\"))\n"):

(defun package-read-from-string (str)
  "Read a Lisp expression from STR.
Signal an error if the entire string was not used."
  (pcase-let ((`(,expr . ,offset) (read-from-string str)))
    (condition-case ()
        ;; The call to `ignore' suppresses a compiler warning.
        (progn (ignore (read-from-string str offset))
               (error "Can't read whole string"))
      (end-of-file expr))))

Because of the last line (`end-of-file') in the `condition-case'.

Regards,
James



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: package-vc-install bug?
  2024-02-10 21:57   ` James Thomas
@ 2024-02-11  9:28     ` Philip Kaludercic
  2024-02-11 12:01       ` James Thomas
  0 siblings, 1 reply; 6+ messages in thread
From: Philip Kaludercic @ 2024-02-11  9:28 UTC (permalink / raw)
  To: James Thomas; +Cc: help-gnu-emacs

James Thomas <jimjoe@gmx.net> writes:

> Philip Kaludercic wrote:
>
>> James Thomas <jimjoe@gmx.net> writes:
>>
>>> M-x package-vc-install RET <package> RET fails with the following on my
>>> system:
>>
>> Does this issue occur for every package?
>
> Yes, for every one I've tried (in my system).

In that case this should be reported as a bug.

>> What I don't get, is what adding a newline to the end of a string should
>> change?
>>
>> (read-from-string "((emacs \"29.1\"))")   ;=> (((emacs "29.1")) . 16)
>> (read-from-string "((emacs \"29.1\"\n))") ;=> (((emacs "29.1")) . 17)
>
> The problem occurs in `package-read-from-string', not `read-from-string'

I understood that, the point is that the cdr of the return value in both
cases points to the end of the string, so the second `read-from-string'
call in the `condition-case' will in both cases raise the same
`end-of-file', as is the case here:

  (read-from-string "")
  (read-from-string "x" 1)

> (I add the newline at the very end: "((emacs \"29.1\"))\n"):
>
> (defun package-read-from-string (str)
>   "Read a Lisp expression from STR.
> Signal an error if the entire string was not used."
>   (pcase-let ((`(,expr . ,offset) (read-from-string str)))
>     (condition-case ()
>         ;; The call to `ignore' suppresses a compiler warning.
>         (progn (ignore (read-from-string str offset))
>                (error "Can't read whole string"))
>       (end-of-file expr))))
>
> Because of the last line (`end-of-file') in the `condition-case'.

Can you confirm this by using edebug? 

> Regards,
> James

-- 
Philip Kaludercic



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: package-vc-install bug?
  2024-02-11  9:28     ` Philip Kaludercic
@ 2024-02-11 12:01       ` James Thomas
  0 siblings, 0 replies; 6+ messages in thread
From: James Thomas @ 2024-02-11 12:01 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: help-gnu-emacs

Philip Kaludercic wrote:

> James Thomas <jimjoe@gmx.net> writes:
>
>> Philip Kaludercic wrote:
>>
>>> James Thomas <jimjoe@gmx.net> writes:
>>>
>>>> M-x package-vc-install RET <package> RET fails with the following on my
>>>> system:
>>>
>>> Does this issue occur for every package?
>>
>> Yes, for every one I've tried (in my system).
>
> In that case this should be reported as a bug.
>
>>> What I don't get, is what adding a newline to the end of a string should
>>> change?
>>>
>>> (read-from-string "((emacs \"29.1\"))")   ;=> (((emacs "29.1")) . 16)
>>> (read-from-string "((emacs \"29.1\"\n))") ;=> (((emacs "29.1")) . 17)
>>
>> The problem occurs in `package-read-from-string', not `read-from-string'
>
> I understood that, the point is that the cdr of the return value in both
> cases points to the end of the string, so the second `read-from-string'
> call in the `condition-case' will in both cases raise the same
> `end-of-file', as is the case here:
>
>   (read-from-string "")
>   (read-from-string "x" 1)

Yes, you're right: apparently my modification has nothing to do with it
(see below). Sorry.

> Can you confirm this by using edebug?

It turns out that if I do C-M-x on `package-read-from-string' and then
try it, it works. But not without it on a fresh restart, even with emacs
-Q. Even stepping through using edebug without rerunning the defun
works.

I'm not sure what the problem is: maybe the build? Have to dig deeper.

Thank you for all your help.

Regards,
James



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: package-vc-install bug?
       [not found] <B398B849-3B09-44C7-B453-A6C3F1FB624F@hotmail.com>
@ 2024-09-25  3:45 ` James Thomas
  0 siblings, 0 replies; 6+ messages in thread
From: James Thomas @ 2024-09-25  3:45 UTC (permalink / raw)
  To: Stephen Jenkins; +Cc: help-gnu-emacs

Stephen Jenkins wrote:

> Did you ever find a solution to this?
> I am having the same issue on a new install of emacs-plus@30 on a
> Monterey Mac.
> Took me a few hours to find this one mention of it.

IIRC, 'make bootstrap' was what fixed it permanently.

(Cc-ing the list FTR)

Regards,
James



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-09-25  3:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-09  9:13 package-vc-install bug? James Thomas
2024-02-10 15:41 ` Philip Kaludercic
2024-02-10 21:57   ` James Thomas
2024-02-11  9:28     ` Philip Kaludercic
2024-02-11 12:01       ` James Thomas
     [not found] <B398B849-3B09-44C7-B453-A6C3F1FB624F@hotmail.com>
2024-09-25  3:45 ` James Thomas

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).