lierdakil / pandoc-crossref

Pandoc filter for cross-references
https://lierdakil.github.io/pandoc-crossref/
GNU General Public License v2.0
911 stars 72 forks source link

Support pandoc 3.0 #370

Closed chenrui333 closed 1 year ago

chenrui333 commented 1 year ago

While trying to upgrade pandoc 3.0 formula, I ran into some regression test failure.

==> /opt/homebrew/opt/pandoc/bin/pandoc -F /opt/homebrew/Cellar/pandoc-crossref/0.3.14.0/bin/pandoc-crossref -o out.html hello.md 2>&1
WARNING: pandoc-crossref was compiled with pandoc 2.19.2 but is being run through 3.0. This is not supported. Strange things may (and likely will) happen silently.
pandoc-crossref: Error in $: Incompatible API versions: encoded with [1,23] but attempted to decode with [1,22,2,1].
CallStack (from HasCallStack):
  error, called at src/Text/Pandoc/JSON.hs:112:48 in pndc-typs-1.22.2.1-20a4938d:Text.Pandoc.JSON
Error running filter /opt/homebrew/Cellar/pandoc-crossref/0.3.14.0/bin/pandoc-crossref:
Filter returned error status 1
==> Testing pandoc-crossref (again)
==> /opt/homebrew/opt/pandoc/bin/pandoc -F /opt/homebrew/Cellar/pandoc-crossref/0.3.14.0/bin/pandoc-crossref -o out.html hello.md 2>&1
WARNING: pandoc-crossref was compiled with pandoc 2.19.2 but is being run through 3.0. This is not supported. Strange things may (and likely will) happen silently.
pandoc-crossref: Error in $: Incompatible API versions: encoded with [1,23] but attempted to decode with [1,22,2,1].
CallStack (from HasCallStack):
  error, called at src/Text/Pandoc/JSON.hs:112:48 in pndc-typs-1.22.2.1-20a4938d:Text.Pandoc.JSON
Error running filter /opt/homebrew/Cellar/pandoc-crossref/0.3.14.0/bin/pandoc-crossref:
Filter returned error status 1
Error: pandoc-crossref: failed
An exception occurred within a child process:
  Minitest::Assertion: Expected: 0
  Actual: 83

relates to https://github.com/Homebrew/homebrew-core/pull/120967

iandol commented 1 year ago

@lierdakil -- for everyone who uses the package manager homebrew (~340,000 people in the last year according to the brew stats), pandoc-crossref break the ability to update pandoc when pandoc-types changes even if they don't use pandoc-crossref. Would there be a way to keep this as a warning?

lierdakil commented 1 year ago

even if they don't use pandoc-crossref

I don't see how that would be related (unless homebrew maintainers made pandoc depend on pandoc-crossref, which is a weird way to do this, but what do I know). To be clear, I don't use macOS and have no relation to homebrew.

keep this as a warning?

Format changed, pandoc-crossref needs an update. This is not just about a warning, it's a bona fide incompatibility. I'll try to get to it this weekend (i.e. ~tomorrow)

iandol commented 1 year ago

@lierdakil — I did not intend to infer it is your fault, sorry. Homebrew as a package management system tests if dependant packages work or not. As I understand it this is a core promise a package management system tries to ensure (update package X doesn't break package Y) . If I update to Pandoc 3 and also have pandoc-crossref installed then pandoc-crossref with its error message would break. Homebrew tests all dependencies before updating any package. In this case it means until pandoc-crossref supports V3.0, pandoc itself will not be updated. This is unfortunate. Ideally the update would be conditional for only users with both packages installed but that is a complex beast to deal with as the dependency tree grows.

So my question was really whether you could downgrade the error when pandoc is a newer version, while still issuing a warning. That would ensure your users were still notified of potential problems with the update. But it seems this error "real" in the sense that pandoc-crossref cannot work, so fair enough!

Thank you!

iandol commented 1 year ago

@chenrui333 — would there be any other way to allow pandoc to update without waiting for pandoc-crossref in homebrew?

chenrui333 commented 1 year ago

We are trying to avoid supporting versioned formulae as possible, from what I can see this should be some simple API compatibility change. Let's give it one day or two.

lierdakil commented 1 year ago

The new release is live on Hackage and GitHub. That being said, it's more than "some simple API compatibility change", I had to rework some parts to accommodate changes to how pandoc handles figures internally, and I don't have time for comprehensive testing, unfortunately. So there are probably bugs. Please report if something's broke.

chenrui333 commented 1 year ago

Thanks @lierdakil!!

vedranmiletic commented 1 year ago

The new release is live on Hackage and GitHub. That being said, it's more than "some simple API compatibility change", I had to rework some parts to accommodate changes to how pandoc handles figures internally, and I don't have time for comprehensive testing, unfortunately. So there are probably bugs. Please report if something's broke.

Is it still compatible with Pandoc 2.9? I am not sure when Arch will update Pandoc, but pandoc-crossref gets updated regularly.

lierdakil commented 1 year ago

Is it still compatible with Pandoc 2.9

No. The version constraints are set appropriately and there isn't a reason to, since functionally pandoc-crossref 0.3.15.0 is identical to 0.3.14.0 (modulo bugs potentially introduced in 0.3.15 and supported pandoc version(s)). Unless pandoc-crossref package maintainers for Arch aren't ignoring version constraints (and if they are, frankly, they're wrong), they shouldn't try to update the package until pandoc itself is updated.

vedranmiletic commented 1 year ago

Thanks for the explanation, makes sense.