New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Regression) pandoc leaves temporary directory behind #9460
Comments
It seems that |
Can anybody else running pandoc on Windows reproduce this? It seems to be Windows-specific. |
Interestingly, my attempt at creating a minimal reproducible example is failing. Not sure what it is about my not-minimal example that is causing the issue to occur… But maybe finding the culprit revision will shed some light on it. |
A bisection between 3.1.11.1 and (I did that bisection first because I expected it to be faster.) My next step is going to be the bisection between 3.1.2 and 3.1.11.1 (likely tomorrow as it’s getting a bit late here). |
One thing to check is how deterministic your results are. Are the same files always left behind? Are files always left behind with that version, or just sometimes? Does 3.1.2 never leave them behind? |
It seems quite deterministic as far as I can tell, and the first bisection did provide a clue after all, at least as far as creating a repro case is concerned: it seems that adding a section name does the trick, and adding it actually makes the image unnecessary – even without it, pandoc still leaves Here is therefore a repro case: $ cd tmpandoc
$ pandoc document.md -o document.pdf |
Also: what |
My hunch is that this may have to do with lazy IO, and I note that there are a couple of readFileLazy's in the runTeXProgram code. I would expect that withSystemTempDir would still clean up, but maybe there is a bug in the Windows implementation? We could try replacing all the lazy IO with strict IO in this context -- I remember doing that before for another issue on Windows. |
If you want to try it, you could, in Text.Pandoc.PDF.hs, remove the readFileLazy :: (PandocMonad m, MonadIO m) => FilePath -> m BL.ByteString
readFileLazy fp = BL.fromStrict <$> readFileStrict fp Then recompile and see if the problem is still there. |
Commit bd8e317 |
My hunch is that this is causing improperly cleaned up temp directory on Windows (#9460), but this will have to be confirmed.
OK, try with current HEAD, which incorporates the idea I had above. |
That does seem to fix it, thanks!
|
Great, I'm glad to have found this. I remember running into a similar issue with lazy IO on Windows over a decade ago. |
As mentioned in #2288 (comment), pandoc 3.1.11.1 on Windows fails to clean up the
tex2pdf
temporary directory it creates if a document that includes PDF graphics is converted to PDF. (I haven’t tried whether other image formats trigger the bug.) I have offered to try and bisect the issue and am in the process of doing so. I can already confirm that 3.1.2 did not exhibit the problem (it cleaned up all temporary files, as expected).I’ll update this once I find the revision that introduced the regression.
I also plan to test whether the issue still reproduces on
HEAD
, and if it doesn’t, I’ll likely “reverse-bisect” the revision that fixed it, if only for my own curiosity.The text was updated successfully, but these errors were encountered: