FreeBSD 13 changed the way sed and grep operate. From the release notes: "The regex(3) function no longer accepts redundant escapes for most ordinary characters. This will cause applications such as sed(1) and grep(1) to reject regular expressions using these escapes. adeebf4cd47c" The pdfjam script from the texlive port no longer operates as intended. The sed directive from the pdfjam script throws an error: pdfjam "input.pdf" 1-20 -o output.pdf sed: 1: "/\\\usepackage{hyperref}/d": RE error: trailing backslash (\) sed: 1: "/\\\hypersetup.*/d": RE error: trailing backslash (\) sed: 1: "/\\\usepackage.*{geomet ...": RE error: trailing backslash (\) sed: 1: "/\\\usepackage.*{color}/d": RE error: trailing backslash (\) This is probably an easy fix, although I am not knowledgeable enough to know where to start. I believe this only affects FreeBSD 13 and later releases.
Re-open
Assign to maintainer
Created attachment 224744 [details] patch to fix regex problem with sed With this small corrections (turning '\\\' into '\\' for LaTeX functions) the scripts seems to work again as expected. Tested with some pdflatex generated pdf files. What I did not test is, if this breaks the regex behaviour on systems < 13.0.
I tested this patch on 13.0 and 12.2, it appears to work. There are a few lines associated with pdfinfo, that may cause errors on 13.0, I never checked these. The lines are 1094, 1095, 1097, 1098, 1100, 1101, 1103, 1104.
(In reply to Gordon from comment #5) Hi Gordon, I think that unlike the lines changed in the patch, the lines 1094, 1095, 1097, 1098, 1100, 1101, 1103, 1104 are not supposed to escape LaTeX functions (LaTeX function names preceded by '\'). I have looked at several converted files containing pdftitle, pdfauthor, pdfsubject and pdfkeyword. This information remains included in the conversion and can also be overwritten with '--pdfauthor newauthor', for example. To be on the safe side, maybe someone with more regex experience should look at it ;)
(In reply to Rainer Hurling from comment #6) Everything looks in order. Thank you for your patch. It looks like Hiroki can review it and hopefully will include it in a future update.
Please, could this be committed? pdfjam is broken on FreeBSD 13.0-RELEASE. This patch fixes the problem at least for simple use cases and I could not find more similar problems searching for triple backslash. (The other lines mentioned by Gordon seem to be fine.)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=56f9e4aaa7c55c7dae44e35c1f836ba10659dab5 commit 56f9e4aaa7c55c7dae44e35c1f836ba10659dab5 Author: Rainer Hurling <rhurlin@FreeBSD.org> AuthorDate: 2022-01-17 21:00:34 +0000 Commit: Rainer Hurling <rhurlin@FreeBSD.org> CommitDate: 2022-01-17 21:05:23 +0000 print/texlive-base: Fix pdfjam regex issue On FreeBSD >= 13.0 the pdfjam script throws an error: pdfjam "input.pdf" 1-20 -o output.pdf sed: 1: "/\\\usepackage{hyperref}/d": RE error: trailing backslash (\) sed: 1: "/\\\hypersetup.*/d": RE error: trailing backslash (\) sed: 1: "/\\\usepackage.*{geomet ...": RE error: trailing backslash (\) sed: 1: "/\\\usepackage.*{color}/d": RE error: trailing backslash (\) While here, pet portfmt. PR: 255232 Reported by: Gordon <gordon.friedman@hotmail.com> MFH: 2022Q1 Approved by: Hiroki Sato <hrs@FreeBSD.org> (maintainer timeout) print/texlive-base/Makefile | 7 +++--- ...exk_texlive_linked__scripts_pdfjam_pdfjam (new) | 26 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-)
A commit in branch 2022Q1 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=d6a68d239233231a7f0d5c8b40bf52d6610f342c commit d6a68d239233231a7f0d5c8b40bf52d6610f342c Author: Rainer Hurling <rhurlin@FreeBSD.org> AuthorDate: 2022-01-17 21:00:34 +0000 Commit: Rainer Hurling <rhurlin@FreeBSD.org> CommitDate: 2022-01-17 21:18:38 +0000 print/texlive-base: Fix pdfjam regex issue On FreeBSD >= 13.0 the pdfjam script throws an error: pdfjam "input.pdf" 1-20 -o output.pdf sed: 1: "/\\\usepackage{hyperref}/d": RE error: trailing backslash (\) sed: 1: "/\\\hypersetup.*/d": RE error: trailing backslash (\) sed: 1: "/\\\usepackage.*{geomet ...": RE error: trailing backslash (\) sed: 1: "/\\\usepackage.*{color}/d": RE error: trailing backslash (\) While here, pet portfmt. PR: 255232 Reported by: Gordon <gordon.friedman@hotmail.com> MFH: 2022Q1 Approved by: Hiroki Sato <hrs@FreeBSD.org> (maintainer timeout) (cherry picked from commit 56f9e4aaa7c55c7dae44e35c1f836ba10659dab5) print/texlive-base/Makefile | 8 ++++--- ...exk_texlive_linked__scripts_pdfjam_pdfjam (new) | 26 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-)
Committed on main and 2022Q1 with maintainer timeout. Thanks again, Gordon, for the report.