quelpa icon indicating copy to clipboard operation
quelpa copied to clipboard

Unable to install single-file, malformed package

Open domq opened this issue 2 years ago • 1 comments

What I am trying to do:

(use-package org-screen
  :quelpa
  (org-screen
   :fetcher url
   :url "https://git.sr.ht/~bzg/org-contrib/blob/master/lisp/org-screen.el"))

What I expect: an autoinstalled, working org-screen package

What I get instead:

Error getting PACKAGE-DESC: (search-failed ;;; org-screen.el ends here)

... And here is the stack trace when running with toggle-debug-on-error:

Debugger entered--Lisp error: (search-failed ";;; org-screen.el ends here")
  package-buffer-info()
  quelpa-get-package-desc("/Users/quatrava/.emacs.d/quelpa-28.1/build/org-scr...")
  quelpa-file-version("/Users/quatrava/.emacs.d/quelpa-28.1/build/org-scr..." file nil "20220616.135407")
  quelpa-check-hash(org-screen (:fetcher url :url "https://git.sr.ht/~bzg/org-contrib/blob/master/lis...") "/Users/quatrava/.emacs.d/quelpa-28.1/build/org-scr..." "/Users/quatrava/.emacs.d/quelpa-28.1/build/org-scr..." url)
  quelpa-build--checkout-url(org-screen (:fetcher url :url "https://git.sr.ht/~bzg/org-contrib/blob/master/lis...") "/Users/quatrava/.emacs.d/quelpa-28.1/build/org-scr...")
  quelpa-build-checkout(org-screen (:fetcher url :url "https://git.sr.ht/~bzg/org-contrib/blob/master/lis...") "/Users/quatrava/.emacs.d/quelpa-28.1/build/org-scr...")
  quelpa-checkout((org-screen :fetcher url :url "https://git.sr.ht/~bzg/org-contrib/blob/master/lis...") "/Users/quatrava/.emacs.d/quelpa-28.1/build/org-scr...")
  quelpa-build((org-screen :fetcher url :url "https://git.sr.ht/~bzg/org-contrib/blob/master/lis..."))
  quelpa-package-install((org-screen :fetcher url :url "https://git.sr.ht/~bzg/org-contrib/blob/master/lis..."))
  apply(quelpa-package-install (org-screen :fetcher url :url "https://git.sr.ht/~bzg/org-contrib/blob/master/lis...") nil)
  quelpa((org-screen :fetcher url :url "https://git.sr.ht/~bzg/org-contrib/blob/master/lis..."))
  apply(quelpa (org-screen :fetcher url :url "https://git.sr.ht/~bzg/org-contrib/blob/master/lis..."))

domq avatar Jun 16 '22 12:06 domq

Issue exists in today's quelpa (checked out from Git master, using the recommended bootstrap method)

domq avatar Jun 16 '22 12:06 domq

Any news?

domq avatar Oct 24 '22 11:10 domq

hey I think the reason this fails is because org-screen.el does not contain ;;; org-screen.el ends here at the end which is mandated by emacs in package-buffer-info and hence the installation fails when it check for the string:

(defun package-buffer-info ()
  "Return a `package-desc' describing the package in the current buffer.

If the buffer does not contain a conforming package, signal an
error.  If there is a package, narrow the buffer to the file's
boundaries."
  (goto-char (point-min))
  (unless (re-search-forward "^;;; \\([^ ]*\\)\\.el ---[ \t]*\\(.*?\\)[ \t]*\\(-\\*-.*-\\*-[ \t]*\\)?$" nil t)
    (error "Package lacks a file header"))
  (let ((file-name (match-string-no-properties 1))
        (desc      (match-string-no-properties 2))
        (start     (line-beginning-position)))
    ;; This warning was added in Emacs 27.1, and should be removed at
    ;; the earliest in version 31.1.  The idea is to phase out the
    ;; requirement for a "footer line" without unduly impacting users
    ;; on earlier Emacs versions.  See Bug#26490 for more details.
    (unless (search-forward (concat ";;; " file-name ".el ends here"))
      (lwarn '(package package-format) :warning
             "Package lacks a terminating comment"))
    ;; Try to include a trailing newline.
    (forward-line)
    (narrow-to-region start (point))
    (require 'lisp-mnt)
    ;; Use some headers we've invented to drive the process.
    (let* (;; Prefer Package-Version; if defined, the package author
           ;; probably wants us to use it.  Otherwise try Version.
           (pkg-version
            (or (package-strip-rcs-id (lm-header "package-version"))
                (package-strip-rcs-id (lm-header "version"))))
           (keywords (lm-keywords-list))
           (homepage (lm-homepage)))
      (unless pkg-version
        (error
            "Package lacks a \"Version\" or \"Package-Version\" header"))
      (package-desc-from-define
       file-name pkg-version desc
       (and-let* ((require-lines (lm-header-multiline "package-requires")))
         (package--prepare-dependencies
          (package-read-from-string (mapconcat #'identity require-lines " "))))
       :kind 'single
       :url homepage
       :keywords keywords
       :maintainer (lm-maintainer)
       :authors (lm-authors)))))

it seems like this requirement will be phased out in emacs 31.1 but now it is still causing this error so the right solution now would be to fix the issue in the corresponding elisp file...

steckerhalter avatar Oct 25 '22 03:10 steckerhalter

I agree but I am in no position to proceed the way you suggest, since I am not the author of org-screen.el.

Please consider merging https://github.com/quelpa/quelpa/pull/239, which also fixes the issue? It seems to me that Quelpa already provides all the remediation needed for malformed packages.

domq avatar Oct 26 '22 10:10 domq

hmm, well I'd prefer to keep the default this way so that malformed packages don't work out of the box. but if you add a flag in the options which has to be enabled to activate your code then we can merge it in...

steckerhalter avatar Oct 26 '22 13:10 steckerhalter

I'm going to close this. As said if you want the PR to be merged pleased add an option as said... thanks

steckerhalter avatar Nov 09 '22 05:11 steckerhalter

Hello @steckerhalter, please take another look at #239 — I hope that the new, much less intrusive fix doesn't require a guarding flag anymore.

domq avatar Nov 16 '22 14:11 domq