Bug 1981603

Summary: pdftopdf doesn't handle "page-range=10-2147483647" correctly
Product: [Fedora] Fedora Reporter: Bryan Mason <bmason>
Component: cups-filtersAssignee: Zdenek Dohnal <zdohnal>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 34CC: twaugh, zdohnal
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: cups-filters-1.28.9-2.fc34 cups-filters-1.28.9-2.fc33 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1981612 (view as bug list) Environment:
Last Closed: 2021-07-29 01:06:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Proposed patch
none
Backported patch from upstream
none
Backported patch from upstream none

Description Bryan Mason 2021-07-12 23:47:13 UTC
Description of problem:

  Running a command like "lp -P 10- /etc/services" results in all pages
  being printed.  The page-range option passed to pdftopdf in this case
  is "10-2147483647".  pdftopdf doesn't handle this option properly.

Version-Release number of selected component (if applicable):

  cups-filters-1.28.9-1.fc35

How reproducible:

  100%


Steps to Reproduce:

  1. Run "lp -d <queue-name> -P 10- /etc/services

Actual results:

  The entire /etc/services file is printed.

Expected results:

  The first 10 pages of /etc/service shouldn't be printed

Additional info:

  Test script and patch to follow shortly.

  Upstream PR:
    https://github.com/OpenPrinting/cups-filters/pull/399

Comment 1 Bryan Mason 2021-07-12 23:48:43 UTC
Created attachment 1801001 [details]
Proposed patch

Comment 3 Zdenek Dohnal 2021-07-13 12:49:50 UTC
Hi Bryan,

thank you for reporting the issue upstream and for the patch!

I was able to reproduce with:

$ pdfinfo out.pdf
Title:          
Author:         root
Creator:        texttopdf/1.28.9
CreationDate:   Tue Jul 13 11:16:06 2021 CEST
Tagged:         no
UserProperties: no
Suspects:       no
Form:           none
JavaScript:     no
Pages:          198
Encrypted:      no
Page size:      612 x 792 pts (letter)
Page rot:       0
File size:      2199860 bytes
Optimized:      no
PDF version:    1.3

$ /usr/lib/cups/filter/pdftopdf 1 root '' 1 'page-ranges=100-2147483647' out.pdf > final-longmax.pdf

$ pdfinfo final-longmax.pdf
Title:          
Author:         root
Creator:        texttopdf/1.28.9
CreationDate:   Tue Jul 13 11:16:06 2021 CEST
Tagged:         no
UserProperties: no
Suspects:       no
Form:           none
JavaScript:     no
Pages:          198
-------------------- (bad)
Encrypted:      no
Page size:      612 x 792 pts (letter)
Page rot:       0
File size:      319134 bytes
Optimized:      no
PDF version:    1.3


Although pdftopdf is part of cups-filters, IMHO it would be great to have a regression test in cups upstream test suite too - sent upstream here https://github.com/OpenPrinting/cups/pull/208 .

Comment 4 Zdenek Dohnal 2021-07-13 13:48:30 UTC
Waiting on merging upstream.

Comment 5 Zdenek Dohnal 2021-07-20 06:47:52 UTC
Created attachment 1803510 [details]
Backported patch from upstream

Comment 6 Zdenek Dohnal 2021-07-20 06:48:26 UTC
The patch was merged, proceeding with a build.

Comment 7 Zdenek Dohnal 2021-07-20 06:53:17 UTC
Created attachment 1803515 [details]
Backported patch from upstream

Comment 8 Fedora Update System 2021-07-20 09:45:27 UTC
FEDORA-2021-9b987f6e36 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-9b987f6e36

Comment 9 Fedora Update System 2021-07-20 09:56:02 UTC
FEDORA-2021-8f6d7c517d has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-8f6d7c517d

Comment 10 Fedora Update System 2021-07-21 01:15:30 UTC
FEDORA-2021-8f6d7c517d has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-8f6d7c517d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-8f6d7c517d

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Fedora Update System 2021-07-21 01:54:30 UTC
FEDORA-2021-9b987f6e36 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-9b987f6e36`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-9b987f6e36

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2021-07-29 01:06:55 UTC
FEDORA-2021-9b987f6e36 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Fedora Update System 2021-07-29 02:00:25 UTC
FEDORA-2021-8f6d7c517d has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.