"Print to PDF" (ps2pdf) fix for GhostScript >=9.51 #141

Merged
blu.256 merged 1 commits from issue/217 into master 3 years ago
Collaborator

This should fix issue TDE/tdebase#217 and not break compatibility with older versions.

Needs to be tested on distributions with Ghostscript < 9.51 (e.g. Debian Jessie/Stretch/Buster etc.)

This should fix issue TDE/tdebase#217 and not break compatibility with older versions. Needs to be tested on distributions with Ghostscript < 9.51 (e.g. Debian Jessie/Stretch/Buster etc.)
blu.256 added the PR/rfc label 3 years ago
Owner

Looks good but will let Slavek testing on older distros since on bullseye there was no problem in first place.

Looks good but will let Slavek testing on older distros since on bullseye there was no problem in first place.
Poster
Collaborator

On Bullseye: The option was there actually until version 9.54, but deprecated since 9.51. That is probably the reason it still works for ≤ 9.54 (but is probably unnecessary).

On Bullseye: The option was there actually until version 9.54, but deprecated since 9.51. That is probably the reason it still works for ≤ 9.54 (but is probably unnecessary).
SlavekB requested changes 3 years ago
SlavekB left a comment
Owner

There are problems that need to be resolved.

At the same time, there is still a question that it would be sufficient simply to remove -c .setpdfwrite without conditions. See comment in TDE/tdebase#127.

There are problems that need to be resolved. At the same time, there is still a question that it would be sufficient simply to remove `-c .setpdfwrite` without conditions. See comment in TDE/tdebase#127.
# Determine GhostScript version to correct the
# ps2pdf command. Solves issue tdebase#217.
execute_process(
COMMAND gs --version
Owner

This is quietly assumed that gs is present during building. For example, for deb packages it is currently not true. Here it would be necessary to use find_program and use the condition whether gs was found for other code.

This is quietly assumed that `gs` is present during building. For example, for deb packages it is currently not true. Here it would be necessary to use `find_program` and use the condition whether `gs` was found for other code.
SlavekB marked this conversation as resolved
if( "${GS_VERSION}" VERSION_LESS "9.51" )
execute_process(
COMMAND sed -i '3s/%filterargs/& -c .setpdfwrite/' ps2pdf.xml
Owner

Here are some major problems:

  1. This makes a silent change in the source code – it is neither desirable or permissible. For two reasons:
    a) On some systems, the source code is on read-only mount and changes are not possible.
    b) In repeated processing of CMake rules, the change will be performed for the second time.
    The correct way is to use the file processing with the output to the binary directory and then install the file from the binary directory.
  2. The -i argument for sed prerequisites the use of GNU sed. This will be a problem on some systems, such as FreeBSD – there is GNU sed available as gsed. Because changes in source code is not desirable, there is no need for -i. However, it is also appropriate to consider using perl instead of sed.
Here are some major problems: 1. This makes a silent change in the source code – it is neither desirable or permissible. For two reasons: a) On some systems, the source code is on read-only mount and changes are not possible. b) In repeated processing of CMake rules, the change will be performed for the second time. The correct way is to use the file processing with the output to the binary directory and then install the file from the binary directory. 2. The `-i` argument for `sed` prerequisites the use of GNU sed. This will be a problem on some systems, such as FreeBSD – there is GNU sed available as `gsed`. Because changes in source code is not desirable, there is no need for `-i`. However, it is also appropriate to consider using perl instead of sed.
SlavekB marked this conversation as resolved
Owner

Note: Typo in previous comment – of course I had in mind TDE/tdebase#217.

Note: Typo in previous comment – of course I had in mind TDE/tdebase#217.
blu.256 force-pushed issue/217 from b063ebadee to cc09bbe410 3 years ago
blu.256 requested review from SlavekB 3 years ago
Poster
Collaborator

I removed the check as it seems unnecessary to keep the .setpdfwrite option after all.

I removed the check as it seems unnecessary to keep the `.setpdfwrite` option after all.
blu.256 force-pushed issue/217 from cc09bbe410 to 256b1cf85d 3 years ago
SlavekB approved these changes 3 years ago
SlavekB left a comment
Owner

It looks good for me.
We'll see what the opinion of @MicheleC is.

It looks good for me. We'll see what the opinion of @MicheleC is.
blu.256 requested review from MicheleC 3 years ago
MicheleC approved these changes 3 years ago
MicheleC left a comment
Owner

Nice!! If it works well with old systems, then it is a great solution.

Nice!! If it works well with old systems, then it is a great solution.
blu.256 merged commit 256b1cf85d into master 3 years ago
Poster
Collaborator

Merged and backported.

Merged and backported.
blu.256 deleted branch issue/217 3 years ago
blu.256 removed the PR/rfc label 3 years ago
blu.256 added this to the R14.0.11 release milestone 3 years ago

Reviewers

SlavekB approved these changes 3 years ago
MicheleC approved these changes 3 years ago
The pull request has been merged as 256b1cf85d.
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: TDE/tdelibs#141
Loading…
There is no content yet.