Bug 255232 - print/texlive-base: pdfjam regex issue at runtime on 13.0 and newer
Summary: print/texlive-base: pdfjam regex issue at runtime on 13.0 and newer
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Hiroki Sato
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-19 17:24 UTC by Gordon
Modified: 2021-05-08 18:21 UTC (History)
4 users (show)

See Also:


Attachments
patch to fix regex problem with sed (1.34 KB, patch)
2021-05-07 07:32 UTC, Rainer Hurling
rhurlin: maintainer-approval?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gordon 2021-04-19 17:24:01 UTC

    
Comment 1 Gordon 2021-04-19 17:32:12 UTC
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.
Comment 2 Steve Wills freebsd_committer 2021-04-19 17:47:38 UTC
Re-open
Comment 3 Steve Wills freebsd_committer 2021-04-19 17:48:10 UTC
Assign to maintainer
Comment 4 Rainer Hurling freebsd_committer 2021-05-07 07:32:25 UTC
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.
Comment 5 Gordon 2021-05-07 22:13:54 UTC
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.
Comment 6 Rainer Hurling freebsd_committer 2021-05-08 05:52:56 UTC
(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 ;)
Comment 7 Gordon 2021-05-08 18:21:12 UTC
(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.