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

Bug#1078256: latexdiff: slight modification to a length passed to \raisebox results in diff output that does not compile #306

Closed ftilmann closed 3 weeks ago

ftilmann commented 4 weeks ago

(copied from Debian tracking, send email to debbug.latexdiff@sideload.33mail.com, 1078256@bugs.debian.org when fixed; title as issue title)

Package: latexdiff Version: 1.3.2-1 Severity: normal Tags: upstream

An old version has text like this:

\raisebox{-4\baselineskip}{\begin{minipage}…\end{minipage}}

A new version has instead:

\raisebox{-5\baselineskip}{\begin{minipage}…\end{minipage}}

This results in diff output that latexpdf chokes on. Sample input files are attached.

-- System Information: Debian Release: 12.5 APT prefers stable-updates APT policy: (990, 'stable-updates'), (990, 'stable-security'), (990, 'stable'), (500, 'oldstable') Architecture: amd64 (x86_64) Foreign Architectures: i386

Kernel: Linux 5.10.0-28-amd64 (SMP w/2 CPU threads) Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled

Versions of packages latexdiff depends on: ii perl 5.36.0-7+deb12u1

Versions of packages latexdiff recommends: ii texlive-latex-base 2022.20230122-3 ii texlive-latex-extra 2022.20230122-4 ii texlive-latex-recommended 2022.20230122-3 ii texlive-plain-generic 2022.20230122-4

Versions of packages latexdiff suggests: ii git 1:2.39.2-1.1

old.tex:

\documentclass{minimal}

\begin{document}
This sample document demonstrates a latexdiff defect whereby
a slight change to a length passed to raisebox results in an uncompilable diff.\\

\noindent\begin{minipage}[b]{0.32\textwidth}
  blurb of Dutch text here.%
\end{minipage}\hfill%
\raisebox{-4\baselineskip}{%
  \begin{minipage}[b]{0.36\textwidth}
  \rule{\textwidth}{\textwidth}%
\end{minipage}}\hfill%
\noindent\begin{minipage}[b]{0.28\textwidth}
   blurb of English text here.%
\end{minipage}%

\end{document}

new.tex:

\documentclass{minimal}

\begin{document}
This sample document demonstrates a latexdiff defect whereby
a slight change to a length passed to raisebox results in an uncompilable diff.\\

\noindent\begin{minipage}[b]{0.32\textwidth}
  altered blurb of Dutch text here.%
\end{minipage}\hfill%
\raisebox{-5\baselineskip}{%
  \begin{minipage}[b]{0.36\textwidth}
  \rule{\textwidth}{\textwidth}%
\end{minipage}}\hfill%
\noindent\begin{minipage}[b]{0.28\textwidth}
   altered blurb of English text here.%
\end{minipage}%

\end{document}
ftilmann commented 4 weeks ago

A quick work-around, use option --exclude-safecmd=raisebox

ftilmann commented 4 weeks ago

To fix properly is whether to disallow commands with optional arguments to be safecmd and textcmd at the same time (or rather remove hard-coded commands in this category from the safecmd list). This option needs to be still checked for undesirable consquences.