andras-simonyi / citeproc-el

A CSL 1.0.2 Citation Processor for Emacs.
GNU General Public License v3.0
85 stars 9 forks source link

`queue-append` on `citeproc-proc-citations` slot results in `wrong-type-argument` error #136

Closed grtcdr closed 1 year ago

grtcdr commented 1 year ago

Hi András,

Thank you so much for your continued work on this wonderful package. I'm experiencing a bit of a roadblock at the moment during the publishing process of my website.

Versions

Backtrace

Here's the backtrace from the output of running org-publish-all on this ox-publish-based website:

Publishing file /home/runner/work/grtcdr.github.io/grtcdr.github.io/src/posts/2022-07-15.org using ‘org-html-publish-to-html’
Debugger entered--Lisp error: (wrong-type-argument queue #s(queue :head nil :tail nil))
  signal(wrong-type-argument (queue #s(queue :head nil :tail nil)))
  queue-append(#s(queue :head nil :tail nil) #s(citeproc-citation :cites (((itd . #s(citeproc-itemdata :varvals ((citation-number . "1") (label . "page") (page-first . "186") (publisher . "Springer") (container-title . "Computers helping people with special needs: 13th ...") (title . "How to make unified modeling language diagrams acc...") (issued ...) (blt-type . "inproceedings") (type . "paper-conference") (author ...) (page . "186–190")) :rawcite nil :rawbibitem nil :rc-uptodate nil :sort-key nil :occurred-before nil :disamb-pos nil :subbib-nos nil :uncited nil)) (id . "muller12uml") (prefix) (suffix) (locator) (label) (location))) :note-index nil :mode nil :suppress-affixes nil :capitalize-first nil :ignore-et-al nil :grouped nil))
  citeproc-append-citations((#s(citeproc-citation :cites (...) :note-index nil :mode nil :suppress-affixes nil :capitalize-first nil :ignore-et-al nil :grouped nil)) #s(citeproc-proc :style #s(citeproc-style :info (... ... ... ... ... ... ... ... ... ... ... ...) :opts (... ... ... ... ...) :bib-opts (... ... ... ... ... ...) :bib-sort (lambda ... ...) :bib-sort-orders (t t t t t) :bib-layout (lambda ... ...) :cite-opts (... ... ... ... ... ... ... ... ... ...) :cite-note nil :cite-sort (lambda ... ...) :cite-sort-orders (t t t t) :cite-layout (lambda ... ...) :cite-layout-attrs (... ... ...) :locale-opts (... ...) :macros (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :terms (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :uses-ys-var t :date-text (... ... ... ...) :date-numeric (... ... ... ...) :locale "en") :getter #f(compiled-function (x) #<bytecode 0x198758f07b737c33>) :itemdata #<hash-table equal 1/65 0xb7c753> :citations #s(queue :head nil :tail nil) :names #<hash-table equal 1/65 0xb7c47d> :finalized nil :uncited nil :bib-filters nil))

2022-07-15.org is referencing the following BibTeX entry (from the refs.bib file) which is reported by biber as a valid reference:

@inproceedings{muller12uml,
  title={How to make unified modeling language diagrams accessible for blind students},
  author={M{\"u}ller, Karin},
  booktitle={Computers Helping People with Special Needs: 13th International Conference, ICCHP 2012, Linz, Austria, July 11-13, 2012, Proceedings, Part I 13},
  pages={186--190},
  year=2012,
  organization={Springer}
}

For a more detailed log, this one shows a full backtrace of the above error, though it is performed in a CI setting and with debug-on-error set to nil (to avoid extremely long backtraces).

Settings

The following is a list of customizations of oc and oc-csl relevant to citeproc:

(setq org-cite-global-bibliography (list (expand-file-name "assets/refs.bib"))
      org-cite-csl-styles-dir (expand-file-name "assets/csl/styles")
      org-cite-csl-locales-dir (expand-file-name "assets/csl/locales")
      org-cite-export-processors '((html . (csl "ieee.csl"))
                   (latex . biblatex)
                   (t . simple)))

What I've tried

  1. Using my system-wide citation-style-language-{styles,locales} whose PKGBUILD I personally created for myself, though the outcome of the export process (locally and in CI[^2]) remains the same.
  2. I've tried using APA instead of IEEE, just in case there was an incompatibility between the different packages and citation styles.
  3. Clearing the cache, local package archive, and of course, the output directory generated by the publishing process.

[^1]: citeproc is being downloaded in batch mode via package-vc-install with the :latest-release option. [^2]: CI uses Ubuntu which already packages the citation-style-language-{styles,locales} packages (and in the same location).

andras-simonyi commented 1 year ago

Hi, thanks for the report! Before trying to reproduce the bug in detail, a quick reaction: The few times I saw similar problems in the past (simple operations on citeproc structures throwing wrong-type-argument error) it was always caused by compiled byte code (or maybe nowadays native code) incompatibilities between different Emacs versions. So the first thing I'd check is whether this could be the case and if recompilation helps if that is a possibility at all.

grtcdr commented 1 year ago

Thanks for the quick reply!

The configuration files that ship the website are not being byte-compiled.

andras-simonyi commented 1 year ago

The configuration files that ship the website are not being byte-compiled.

I didn't necessarily mean configuration files, rather the files in the Citeproc and Queue packages, maybe also Org. Is it possible that some of them were somehow compiled for an Emacs version different from the one which is actually used? The error seems to be resulting from something so elementary (appending something to [an apparently empty] queue structure) that it is most probably not a Citeproc bug.

You may also try to check whether simple queue operations (creating a queue, appending anything to it etc.) work independently of Citeproc.

grtcdr commented 1 year ago

Is it possible that some of them were somehow compiled for an Emacs version different from the one which is actually used?

Maybe. I was able to successfully publish the website locally, though I can't say the same for the CI.

citeproc and queue and other project dependencies are being built in their own init directory (dependencies are pulled and compiled from scratch on every commit) but it's setup-emacs whose byte compilation I cannot control.

andras-simonyi commented 1 year ago

Well, the only thing I see is that adding an object to an empty queue fails. As far as I know there are no constraints on what kind of object could be appended, so the problem somehow concerns accessing the slots of the queue structure. The only cases I've seen this kind of problem were compiled code incompatibilities.

andras-simonyi commented 1 year ago

citeproc and queue and other project dependencies are being built in their own init directory (dependencies are pulled and compiled from scratch on every commit) but it's setup-emacs whose byte compilation I cannot control.

Maybe you could try to turn off compilation for citeproc and queue?

grtcdr commented 1 year ago

Well, the only thing I see is that adding an object to an empty queue fails.

But isn't the queue empty at first?

As far as I know there are no constraints on what kind of object could be appended, so the problem somehow concerns accessing the slots of the queue structure. The only cases I've seen this kind of problem were compiled code incompatibilities.

Gotcha!

Maybe you could try to turn off byte compilation for citeproc and queue?

I'll do that and report back.

grtcdr commented 1 year ago

Well, that fixed it :)

Thank you so much for the help!