radian-software / straight.el

πŸ€ Next-generation, purely functional package manager for the Emacs hacker.
MIT License
2.75k stars 151 forks source link

Byte compilation issue with straight.el at commit b3760f5 #1136

Open tonyaldon opened 11 months ago

tonyaldon commented 11 months ago

What's wrong

Byte compilation done by straight differs from the one done by byte-compile-file and seems to create a symbol that doesn't exist.

Directions to reproduce

When I let straight install and build the package one.el like this

(straight-use-package
 '(one :type git :host github :repo "tonyaldon/one.el"))

and called the following commands sequentially

I got the following error:

Debugger entered--Lisp error: (void-function org-element--property)
  org-element--property(:CUSTOM_ID (headline (:raw-value "one.elme" :begin 1 :end 358 :pre-blank 0 :contents-begin 12 :contents-end 357 :robust-begin 67 :robust-end 355 :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil ...) (section (:begin 12 :end 358 :contents-begin 12 :contents-end 357 :robust-begin 12 :robust-end 355 :post-blank 1 :post-affiliated 12 :mode section :granularity nil :parent #2) (property-drawer (:begin 12 :end 69 :contents-begin 25 :contents-end 62 :post-blank 1 :post-affiliated 12 :mode planning :granularity nil :parent #5) (node-property ...) (node-property ...)) (paragraph (:begin 69 :end 102 :contents-begin 69 :contents-end 101 :post-blank 1 :post-affiliated 69 :mode nil :granularity nil :parent #5) #("This is a new " 0 14 ...) (code ...) #("project.\n" 0 9 ...)) (paragraph (:begin 102 :end 203 :contents-begin 102 :contents-end 202 :post-blank 1 :post-affiliated 102 :mode nil :granularity nil :parent #5) #("If you don't know how " 0 22 ...) (code ...) #("works, you can check the documen..." 0 42 ...) (link ...) #(".\n" 0 2 ...)) (paragraph (:begin 203 :end 357 :contents-begin 203 :contents-end 357 :post-blank 0 :post-affiliated 203 :mode nil :granularity nil :parent #5) #("If you want to list all the page..." 0 74 ...) (link ... ...) #(".\n" 0 2 ...)))) nil nil)
  one-internal-id((headline (:raw-value "one.elme" :begin 1 :end 358 :pre-blank 0 :contents-begin 12 :contents-end 357 :robust-begin 67 :robust-end 355 :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil ...) (section (:begin 12 :end 358 :contents-begin 12 :contents-end 357 :robust-begin 12 :robust-end 355 :post-blank 1 :post-affiliated 12 :mode section :granularity nil :parent #1) (property-drawer (:begin 12 :end 69 :contents-begin 25 :contents-end 62 :post-blank 1 :post-affiliated 12 :mode planning :granularity nil :parent #4) (node-property ...) (node-property ...)) (paragraph (:begin 69 :end 102 :contents-begin 69 :contents-end 101 :post-blank 1 :post-affiliated 69 :mode nil :granularity nil :parent #4) #("This is a new " 0 14 ...) (code ...) #("project.\n" 0 9 ...)) (paragraph (:begin 102 :end 203 :contents-begin 102 :contents-end 202 :post-blank 1 :post-affiliated 102 :mode nil :granularity nil :parent #4) #("If you don't know how " 0 22 ...) (code ...) #("works, you can check the documen..." 0 42 ...) (link ...) #(".\n" 0 2 ...)) (paragraph (:begin 203 :end 357 :contents-begin 203 :contents-end 357 :post-blank 0 :post-affiliated 203 :mode nil :granularity nil :parent #4) #("If you want to list all the page..." 0 74 ...) (link ... ...) #(".\n" 0 2 ...)))))
  #f(compiled-function (elt) #<bytecode -0x1b65972288cb9119>)((headline (:raw-value "one.elme" :begin 1 :end 358 :pre-blank 0 :contents-begin 12 :contents-end 357 :robust-begin 67 :robust-end 355 :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil ...) (section (:begin 12 :end 358 :contents-begin 12 :contents-end 357 :robust-begin 12 :robust-end 355 :post-blank 1 :post-affiliated 12 :mode section :granularity nil :parent #1) (property-drawer (:begin 12 :end 69 :contents-begin 25 :contents-end 62 :post-blank 1 :post-affiliated 12 :mode planning :granularity nil :parent #4) (node-property ...) (node-property ...)) (paragraph (:begin 69 :end 102 :contents-begin 69 :contents-end 101 :post-blank 1 :post-affiliated 69 :mode nil :granularity nil :parent #4) #("This is a new " 0 14 ...) (code ...) #("project.\n" 0 9 ...)) (paragraph (:begin 102 :end 203 :contents-begin 102 :contents-end 202 :post-blank 1 :post-affiliated 102 :mode nil :granularity nil :parent #4) #("If you don't know how " 0 22 ...) (code ...) #("works, you can check the documen..." 0 42 ...) (link ...) #(".\n" 0 2 ...)) (paragraph (:begin 203 :end 357 :contents-begin 203 :contents-end 357 :post-blank 0 :post-affiliated 203 :mode nil :granularity nil :parent #4) #("If you want to list all the page..." 0 74 ...) (link ... ...) #(".\n" 0 2 ...)))))
  #f(compiled-function (--data) #<bytecode -0x1d677490ab1973bf>)((headline (:raw-value "one.elme" :begin 1 :end 358 :pre-blank 0 :contents-begin 12 :contents-end 357 :robust-begin 67 :robust-end 355 :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil ...) (section (:begin 12 :end 358 :contents-begin 12 :contents-end 357 :robust-begin 12 :robust-end 355 :post-blank 1 :post-affiliated 12 :mode section :granularity nil :parent #1) (property-drawer (:begin 12 :end 69 :contents-begin 25 :contents-end 62 :post-blank 1 :post-affiliated 12 :mode planning :granularity nil :parent #4) (node-property ...) (node-property ...)) (paragraph (:begin 69 :end 102 :contents-begin 69 :contents-end 101 :post-blank 1 :post-affiliated 69 :mode nil :granularity nil :parent #4) #("This is a new " 0 14 ...) (code ...) #("project.\n" 0 9 ...)) (paragraph (:begin 102 :end 203 :contents-begin 102 :contents-end 202 :post-blank 1 :post-affiliated 102 :mode nil :granularity nil :parent #4) #("If you don't know how " 0 22 ...) (code ...) #("works, you can check the documen..." 0 42 ...) (link ...) #(".\n" 0 2 ...)) (paragraph (:begin 203 :end 357 :contents-begin 203 :contents-end 357 :post-blank 0 :post-affiliated 203 :mode nil :granularity nil :parent #4) #("If you want to list all the page..." 0 74 ...) (link ... ...) #(".\n" 0 2 ...)))))
  mapc(#f(compiled-function (--data) #<bytecode -0x1d677490ab1973bf>) ((headline ... ...) (headline ... ...) (headline ... ... ... ...) (headline ... ... ... ...) (headline ... ... ... ...) (headline ... ... ... ...)))
  #f(compiled-function (--data) #<bytecode -0x1d677490ab1973bf>)((org-data (:begin 1 :contents-begin 1 :contents-end 4896 :end 4896 :robust-begin 3 :robust-end 4894 :post-blank 0 :post-affiliated 1 :path "/media/youtube/youtu..." :mode org-data ...) (headline ... ...) (headline ... ...) (headline ... ... ... ...) (headline ... ... ... ...) (headline ... ... ... ...) (headline ... ... ... ...)))
  org-element-map((org-data (:begin 1 :contents-begin 1 :contents-end 4896 :end 4896 :robust-begin 3 :robust-end 4894 :post-blank 0 :post-affiliated 1 :path "/media/youtube/youtu..." :mode org-data ...) (headline ... ...) (headline ... ...) (headline ... ... ... ...) (headline ... ... ... ...) (headline ... ... ... ...) (headline ... ... ... ...)) headline #f(compiled-function (elt) #<bytecode -0x1b65972288cb9119>))
  one-parse-buffer()
  one-render-pages()
  one-build()
  funcall-interactively(one-build)
  call-interactively(one-build record nil)
  command-execute(one-build record)
  execute-extended-command(nil "one-build" nil)
  funcall-interactively(execute-extended-command nil "one-build" nil)
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

It is normal because org-element--property is not defined by org-mode. But what caught my attention is that one.el never calls org-element--property, it only calls org-element-property which is well defined.

I found org-element--property symbol in straight/build/one/one.elc file generated by straight (if I understand correctly):

;;; Compiled
;;; in Emacs version 29.1
;;; with all optimizations.

;;; ...

(defalias 'one-ox-headline #[771 "..." [org-element--property :level nil :raw-value :one-internal-id "" format "<div><h%s id=\"%s\">%s</h%s>%s</div>"] 14 (#$ . 1276)])#@120 Transcode a SECTION element from Org to HTML.

But if I byte compile one.el file with byte-compile-file directly, I no longer have that issue and the compiled file looks like this:

;;; Compiled
;;; in Emacs version 29.1
;;; with all optimizations.

;;; ...

(defalias 'one-ox-headline #[771 "..." [:level get-text-property 0 plist-get :raw-value :one-internal-id "" format "<div><h%s id=\"%s\">%s</h%s>%s</div>"] 14 (#$ . 1276)])#@120 Transcode a SECTION element from Org to HTML.

I recently switched from straight from commit 3eca39d to straight at commit b3760f5. I hadn't that issue with 3eca39d.

So, I disable byte compilation for that package:

(straight-use-package
 '(one :type git :host github :repo "tonyaldon/one.el"
       :build (:not compile)))

What do you think? Am I doing something wrong?

Version information

progfolio commented 11 months ago

I'm unable to reproduce with the following test case:

Test Case ```emacs-lisp (straight-bug-report :post-bootstrap (straight-use-package '(one :host github :repo "tonyaldon/one.el")) (one-default-new-project) (one-build)) ```
Output ```emacs-lisp Bootstrapping straight.el... Bootstrapping straight.el...done Looking for gnu-elpa-mirror recipe β†’ Cloning melpa... Looking for gnu-elpa-mirror recipe β†’ Cloning melpa...done Looking for nongnu-elpa recipe β†’ Cloning gnu-elpa-mirror... Looking for nongnu-elpa recipe β†’ Cloning gnu-elpa-mirror...done Looking for emacsmirror-mirror recipe β†’ Cloning nongnu-elpa... Looking for emacsmirror-mirror recipe β†’ Cloning nongnu-elpa...done Looking for emacsmirror-mirror recipe β†’ Cloning el-get... Looking for emacsmirror-mirror recipe β†’ Cloning el-get...done Looking for straight recipe β†’ Cloning emacsmirror-mirror... Looking for straight recipe β†’ Cloning emacsmirror-mirror...done Building straight... Building straight...done Test run with version: prerelease (HEAD -> develop, origin/master, origin/develop, origin/HEAD) b3760f5 2023-10-21 Cloning one.el... Cloning one.el...done Building one... Building one β†’ Cloning jack... Building one β†’ Cloning jack...done Building one β†’ Building jack... Building one β†’ Building jack...done Building one β†’ Cloning emacs-htmlize... Building one β†’ Cloning emacs-htmlize...done Building one β†’ Building htmlize... Building one β†’ Building htmlize...done Building one... Building one...done Build pages... Build page β€˜/’ Build page β€˜/blog/default-home-list-pages/’ Build page β€˜/blog/default/’ Setting up indent for shell type bash Indentation variables are now local. Indentation setup for shell type bash Build page β€˜/blog/one-default-with-toc/’ Setting up indent for shell type bash Indentation variables are now local. Indentation setup for shell type bash Build page β€˜/blog/one-default-with-sidebar/’ Setting up indent for shell type bash Indentation variables are now local. Indentation setup for shell type bash Build page β€˜/blog/one-default-doc/’ Setting up indent for shell type bash Indentation variables are now local. Indentation setup for shell type bash Build pages...done Packages: "straight" n/a develop b3760f5 2023-10-21 "org-elpa" n/a n/a "melpa" n/a master 60b3f2b1 2023-12-17 "gnu-elpa-mirror" n/a master ab9bcb0 2023-12-18 "nongnu-elpa" n/a main b299b0d 2023-11-23 "el-get" melpa master a5ba5852 2023-10-20 "emacsmirror-mirror" n/a master 49cd2c4 2023-12-12 "one" melpa master f94f183 2023-12-19 "jack" melpa master 77f51e6 2023-11-12 "htmlize" melpa master dd27bc3 2021-08-25 ```

Does the error occur for you if you evaluate that test case?

tonyaldon commented 11 months ago

I just evaluated the test case and no error occurred.

Test Case ```emacs-lisp (straight-bug-report :post-bootstrap (straight-use-package '(one :host github :repo "tonyaldon/one.el")) (one-default-new-project) (one-build)) ```
Output ```emacs-lisp Bootstrapping straight.el... Bootstrapping straight.el...done Looking for gnu-elpa-mirror recipe β†’ Cloning melpa... Looking for gnu-elpa-mirror recipe β†’ Cloning melpa...done Looking for nongnu-elpa recipe β†’ Cloning gnu-elpa-mirror... Looking for nongnu-elpa recipe β†’ Cloning gnu-elpa-mirror...done Looking for emacsmirror-mirror recipe β†’ Cloning nongnu-elpa... Looking for emacsmirror-mirror recipe β†’ Cloning nongnu-elpa...done Looking for emacsmirror-mirror recipe β†’ Cloning el-get... Looking for emacsmirror-mirror recipe β†’ Cloning el-get...done Looking for straight recipe β†’ Cloning emacsmirror-mirror... Looking for straight recipe β†’ Cloning emacsmirror-mirror...done Building straight... Building straight...done Test run with version: prerelease (HEAD -> develop, origin/master, origin/develop, origin/HEAD) b3760f5 2023-10-21 Cloning one.el... Cloning one.el...done Building one... Building one β†’ Cloning jack... Building one β†’ Cloning jack...done Building one β†’ Building jack... Building one β†’ Building jack...done Building one β†’ Cloning emacs-htmlize... Building one β†’ Cloning emacs-htmlize...done Building one β†’ Building htmlize... Building one β†’ Building htmlize...done Building one... Building one...done Build pages... Build page β€˜/’ Build page β€˜/blog/default-home-list-pages/’ Build page β€˜/blog/default/’ Setting up indent for shell type bash Indentation variables are now local. Indentation setup for shell type bash Build page β€˜/blog/one-default-with-toc/’ Setting up indent for shell type bash Indentation variables are now local. Indentation setup for shell type bash Build page β€˜/blog/one-default-with-sidebar/’ Setting up indent for shell type bash Indentation variables are now local. Indentation setup for shell type bash Build page β€˜/blog/one-default-doc/’ Setting up indent for shell type bash Indentation variables are now local. Indentation setup for shell type bash Build pages...done Packages: "straight" n/a develop b3760f5 2023-10-21 "org-elpa" n/a n/a "melpa" n/a master 60b3f2b1 2023-12-17 "gnu-elpa-mirror" n/a master ab9bcb0 2023-12-18 "nongnu-elpa" n/a main b299b0d 2023-11-23 "el-get" melpa master a5ba5852 2023-10-20 "emacsmirror-mirror" n/a master 49cd2c4 2023-12-12 "one" melpa master f94f183 2023-12-19 "jack" melpa master 77f51e6 2023-11-12 "htmlize" melpa master dd27bc3 2021-08-25 ```
progfolio commented 11 months ago

See if you can add to that reproduction case in a way that reproduces the error. Otherwise it's difficult to diagnose.

tonyaldon commented 11 months ago

Thanks for looking at it. I'll try to see how can reproduce the error within the test case.