[misc] fix sync-to-pdf feature when sibling compiles are disabled #261
Conversation
The paths are tracked with a `/./` component in the synctex file. ``` SyncTeX Version:1 Input:1:/var/lib/sharelatex/data/compiles/PROJECT_ID/./main.tex ... ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about this.
I had a server-ce with 2.6.1 and SIBLING_CONTAINERS_ENABLED=false. The synctex worked both ways.
When I upgraded to server-ce 2.7.0 the /sync/code endpoint stopped working, while /sync/pdf worked.
I'd like to reproduce the problem, because I think it would be better to fix the way we call latexmk so that the path is correct.
Possibly there has been a change in latexmk between the two versions which affects this(?).
Old container:
New container:
|
Changes between those versions: http://personal.psu.edu/~jcc8/software/latexmk/versions.html V. 4.74b dated 29 May 2021.
V. 4.74 dated 16 May 2021.
V. 4.73 dated 3 May 2021.
V. 4.72b dated 15 Apr. 2021.
hyperxmp-latexmkrc: Rc file to configure latexmk to work with hyperxmp (v. 5.7 or higher). With the initialization code in this rc file, latexmk gets a correct byteCount field in the xmp metadata produced by hyperxmp in the pdf file. V. 4.70b dated 29 Sep. 2020.
|
In order to confirm @briangough's hypothesis, I swapped the latexmk script directly inside the server-ce container, keeping everything else constant, and I found that, indeed, version 4.70b works, and version 4.72b doesn't. So, it's a change between the two versions that creates the problem. Maybe this excerpt from the Changelog
I also tested the TeX Live 2021 image, which has the newer latexmk, and got the same problem, so there's even more reason to fix that. |
AFAICT, what happens is that latexmk added a step to "normalize" the aux and output directories. The normalization changes the path so that it is relative to the current directory. When the aux directory is equal to the current directory, the normalized path becomes the empty string, which disables another step in latexmk, where the aux dir would be added to the TEXINPUTS and BIBINPUTS env variables. This, in turn, adds the We can probably fix that by setting TEXINPUTS and BIBINPUTS prior to calling latexmk. This is also related to https://github.com/overleaf/internal/issues/1816. It would be nice if what we do here solved that issue as well. |
Thanks for your investigation here!
That did not do the trick alone 😞 Tested via https://github.com/overleaf/internal/commit/b2d9f548dd8d021e4dddca5c13bcd233da12c80e dockerOptions.Env = [
'TEXINPUTS=/compile:',
'BIBINPUTS=/compile:',
...
] (Also tested without success using a trailing slash diff --git a/services/clsi/app/js/DockerRunner.js b/services/clsi/app/js/DockerRunner.js
index 5bb2aeccf4..9d00fd62bd 100644
--- a/services/clsi/app/js/DockerRunner.js
+++ b/services/clsi/app/js/DockerRunner.js
@@ -262,2 +262,4 @@ const DockerRunner = {
+ console.error(options.Env)
+
if (Settings.path != null && Settings.path.synctexBinHostPath != null) {
diff --git a/services/clsi/test/acceptance/js/Stats.js b/services/clsi/test/acceptance/js/Stats.js
index 4f071abe5f..24653e25ae 100644
--- a/services/clsi/test/acceptance/js/Stats.js
+++ b/services/clsi/test/acceptance/js/Stats.js
@@ -3,2 +3,3 @@ const Settings = require('@overleaf/settings')
after(function (done) {
+ return done()
request(
|
Ok. It turns out that latexmk doesn't normalize the aux dir to the empty string, but to '.', which it then prepends to TEXINPUTS, defeating any manipulation of TEXINPUTS we can do beforehand. However, it looks like newer versions of synctex deal with paths better and will work. It just so happens that we stumbled upon another good reason to upgrade synctex in support today, so I moved https://github.com/overleaf/internal/issues/2478 to the backlog. |
Applied above commit manually to my CE (3.0.1) and now it works, many thanks. |
Hi! This patch never made it into production or Server CE/Pro. We came up with a different solution that landed after the 3.0 cut: overleaf/overleaf@9ee92da |
I see, thanks for clearing this up! I was just confused, since from the dates I supposed it should have been in the cut. But with this simple edit it works already now in CE and I guess it will work after the next upgrade with a different solution. Cheers :) |
Description
Fixes overleaf/overleaf#919
For https://digital-science.slack.com/archives/CM8CT5MUP/p1626769788005200
The project paths are tracked with a
/./
component in the synctex file.This was breaking our synctex invocation. This PR is adding the extra compontent.
Related Issues / PRs
Fixes overleaf/overleaf#919
For https://digital-science.slack.com/archives/CM8CT5MUP/p1626769788005200
Review
Sandbox compiles are not affected and tested in CI.
Potential Impact
Low.
Manual Testing Performed
https://console.cloud.google.com/cloud-build/builds;region=global/c7625584-3f3f-4442-b5cc-11e157184bf5?project=overleaf-ops