ftilmann / latexdiff

Compares two latex files and marks up significant differences between them. Releases on www.ctan.org and mirrors
GNU General Public License v3.0
514 stars 72 forks source link

"The system cannot find the path specified." error on Windows with latexdiff-vc --flaten #180

Open nbud opened 4 years ago

nbud commented 4 years ago

LATEXDIFF-VC 1.3.0, Windows 10, cmd and powershell

Error:

(base) λ latexdiff-vc --git --flatten -r 0c519c8 thesis.tex > thesis-diff.tex
Working on  thesis.tex
Checking out old dir into: C:\Users\xxx\AppData\Local\Temp\qrh8b3ApB6/latexdiff-vc-0c519c8 (rev: 0c519c8)
The system cannot find the path specified.
Something went wrong in executing:  git archive --format=tar 0c519c8 | ( cd C:\Users\xxx\AppData\Local\Temp\qrh8b3ApB6/latexdiff-vc-0c519c8 ; tar -xf -) at C:\Users\xxx\AppData\Roaming\MiKTeX\2.9\scripts/latexdiff\latexdiff-vc line 603.

The incriminated line of latexdiff-vc is

system("git archive --format=tar $rev | ( cd $dirname ; tar -xf -)")==0 or die "Something went wrong in executing:  git archive --format=tar $rev | ( cd $dirname ; tar -xf -)";

I think replacing cd $dirname ; tar -xf - by cd $dirname & tar -xf - would fix the issue on Windows, I don't know what the effect is on Linux.

ftilmann commented 4 years ago

Thank for this suggestion. The suggested fix unfortunately will break on Linux. Unlike with latexdiff, with latexdiff-vc there is no real promise of operation system independence, as there is intense reliance on running system commands. I am sorry but I have zero experience with Windows powershell so cannot really commit to maintain a Windows powershell compatible version or test such a version. I am happy to accept pull requests providing Window compatibility if they don't break linux (probably this can only be achieved by initially checking what system the code is running on, and then selecting the appropriate command line) but won't test this under Windows.

nbud commented 4 years ago

Thank you for the quick reply and this great tool. So far this is the only bug I have with latexdiff-vc on Windows, so even though untested it works fairly smoothly.

Quick workaround for the record:

if exist diffnew rmdir diffnew /q /s
if exist diffold rmdir diffold /q /s
mkdir diffnew
mkdir diffold
git archive --format=tar HEAD | ( cd diffnew & tar -xf -)
git archive --format=tar 0c519c8 | ( cd diffold & tar -xf -)
latexdiff --flatten diffold/thesis.tex diffnew/thesis.tex > diffnew/thesis-diff.tex
latexmk --pdf diffnew\thesis-diff.tex
start "" /max thesis-diff.pdf