Skip to content

compare, don't assign, when checking for a better bibtex timeout - #19752

Closed
kevinushey wants to merge 1 commit into
mainfrom
bugfix/zotero-bbt-timeout-check
Closed

kevinushey wants to merge 1 commit into
mainfrom
bugfix/zotero-bbt-timeout-check

Conversation

@kevinushey

Copy link
Copy Markdown
Collaborator

Intent

betterBibtexJsonRpcRequest() in ZoteroBetterBibTeX.cpp was meant to show "Unable to connect to Better BibTeX. Please ensure that Zotero is running." when the request fails because the connection is unavailable or times out, and to log any other error under "Unexpected error communicating with Better BibTex". The timeout check assigned instead of comparing:

(error = systemError(boost::system::errc::timed_out, ErrorLocation()))

That expression always evaluates to true. So every error that wasn't "connection unavailable" was overwritten with a fake timeout error and reported as "Zotero is not running", and the else branch never ran, so the real error was never logged. The bug has been there since Better BibTeX support was added in 4548ca6 (2020).

Approach

Change = to ==. A connect timeout still takes the "not running" branch: TcpIpAsyncConnector reports it as systemError(errc::timed_out), the blocking sendRequest() returns it unchanged, and Error::operator== compares the code and category name. Any other error now gets the "unexpected error" warning and is logged.

Automated Tests

None. The logic is in an anonymous-namespace function that makes a real HTTP request to Better BibTeX on localhost:23119, so testing it would mean refactoring the error handling out of that function, which is more than this one-character fix needs. I checked that the file compiles cleanly with -Wparentheses.

QA Notes

With Zotero closed, the Better BibTeX warning should still say Zotero isn't running.

Documentation

None needed.

Checklist

  • If this PR adds a new feature, or fixes a bug in a previously released version, it includes an entry in NEWS.md
  • If this PR adds or changes UI, the updated UI meets accessibility standards
  • A reviewer is assigned to this PR (if unsure who to assign, check Area Owners list)
  • This PR passes all local unit tests

@kevinushey

Copy link
Copy Markdown
Collaborator Author

Folded into #19753 as error.matches(boost::system::errc::timed_out). That PR builds errc errors in the generic category, so an exact comparison against systemError(errc::timed_out) would stop matching timeouts that asio reports.

@kevinushey kevinushey closed this Nov 20, 2026
@github-actions

Copy link
Copy Markdown

RStudio E2E - all platforms

1 test(s) failed

###################- 99% pass rate

Passed Failed Skipped Flaky
5765 1 295 2
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 4 0 16 0
✅ desktop-linux 1452 0 49 1
❌ desktop-macos 1418 1 84 0
✅ desktop-windows 1447 0 60 1
✅ server-linux 1396 0 54 0
✅ setup 48 0 32 0

View report online


All platforms - commit 3b87a6a6db7aab0677b8f4f5d876c07ccca52c59 - Run #2427

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant