retorquere / zotero-better-bibtex

Make Zotero effective for us LaTeX holdouts
https://retorque.re/zotero-better-bibtex/
MIT License
5.3k stars 284 forks source link

BBT version check complains about Zotero built from source #2093

Closed andersjohansson closed 2 years ago

andersjohansson commented 2 years ago

Hi, I build Zotero from source with some small patches. Recently the version check that BBT does complains about not supporting my Zotero build that then gets a version string like: 6.0.SOURCE.c12fba6da.

This is to be expected given the version comparison done here, which probably gets confused by this version string: https://github.com/retorquere/zotero-better-bibtex/blob/master/content/startup.ts#L10

I tried removing this version check in the built BBT xpi, and installing and running worked then.

Would it be reasonable to extend the version check, that already does some work for supporting beta versions of Zotero.

Thank you for all your work on BBT.

github-actions[bot] commented 2 years ago

:robot: this is your friendly neighborhood build bot announcing test build 6.3.0.2245 ("include .SOURC in version compat check")

Install in Zotero by downloading test build 6.3.0.2245, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

andersjohansson commented 2 years ago

Thank you! This still doesn't seem to work. After removing SOURCE I get a version string 6.0.c12fba6da but this is still interpreted as less than 6.0.

I tried to do this in the "run javascript" window in Zotero.

const versionCompare = Components.classes['@mozilla.org/xpcom/version-comparator;1'].getService(Components.interfaces.nsIVersionComparator);
versionCompare.compare("6.0.c12fba6da","6.0");

Which gives -1.

In addition, even the installation seems to fail (as I understand it this is a step done by the plugin machinery), perhaps because of a similar version check done there. I have worked around this by setting <em:minVersion>5.0</em:minVersion> (instead of 6.0) in install.rdf. compare("6.0.c12fba6da","5.0") seems to return 1.

github-actions[bot] commented 2 years ago

:robot: this is your friendly neighborhood build bot announcing test build 6.3.0.2247 ("make it big")

Install in Zotero by downloading test build 6.3.0.2247, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

andersjohansson commented 2 years ago

Still no real luck with build 6.3.0.2247, which surprises me. First, I still need to modify install.rdf to be able to install. Then I get the "Outdated zotero version" message from BBT (triggered by the check in startup.ts.

Something strange seems to go on with that version comparison function. Tested this in Zotero:

function approxVersion(v) {
  return v.replace('m', '.').replace(/-beta|\.SOURCE/, `.${Number.MAX_SAFE_INTEGER}`);
}

const versionCompare = Components.classes['@mozilla.org/xpcom/version-comparator;1'].getService(Components.interfaces.nsIVersionComparator);

versionCompare.compare(approxVersion(Zotero.version), approxVersion("6.0")) /* Returns -1 */

/* Above gets translated to: */
versionCompare.compare("6.0.9007199254740991.c12fba6da","6.0") /* Returns -1 */

/* Removing the last "1" from the number: */
versionCompare.compare("6.0.900719925474099.c12fba6da","6.0") /* Returns 1 */
retorquere commented 2 years ago

Does 2249 work for you?

github-actions[bot] commented 2 years ago

:robot: this is your friendly neighborhood build bot announcing test build 6.4.0.2292 ("newline")

Install in Zotero by downloading test build 6.4.0.2292, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

andersjohansson commented 2 years ago

Sorry I've been held up with other things. Yes, 6.4.0.2292 works except I still need to modify install.rdf in the xpi to be able to install it (again changing to <em:minVersion>5.0</em:minVersion>)

retorquere commented 2 years ago

So <em:minVersion>6.0</em:minVersion> does not work for source builds?

This is not something I want to change. BBT does not work on 5.0. Can't the build output a more sensible version number? The case in startup.ts is my own doing, but the problem in install.rdf is really caused by Zotero claiming a version number that its own version comparator cannot deal with.

andersjohansson commented 2 years ago

Yes, I understand that. I will take a look into how the build generates its version number. Maybe just time to file a bug to Zotero about it.

andersjohansson commented 2 years ago

I didn’t realize before, but this perhaps is more on the Zotero side as you say. It hasn’t bitten me for any other plugins yet since all of them still state compatibility with 5.0. Thanks

retorquere commented 2 years ago

The change in startup.ts has been merged.

retorquere commented 2 years ago

Can you test the build that dropped on #2099?