foo2ddst emits a redundant "PAGE: n copies" marker, causing CUPS to double-count printed pages
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- c
- Domain
- operating-systems
Research direction
Inspect foo2ddst.c's start_page() near lines 560-562 and compare its PAGE marker with the upstream pstops behavior described in the issue. Remove the redundant emission, rebuild foo2zjs, and print a one-page document through CUPS to verify the job reports Pages: 1 while still producing one physical sheet.
Written by the indexing model from the issue text.
Description
This is a third, distinct issue found while debugging the Ricoh SP112 /
foo2ddst setup covered in #<issue_1> and #<issue_2>.
Observation
A 1-page document (confirmed as exactly 1 page via the source
application's print preview before sending) consistently shows
"Pages: 2" in the CUPS web UI job list (/jobs) when printed through
foo2ddst. Only one physical sheet is actually printed — this is purely
an accounting/display discrepancy in CUPS's job page count, not an
actual duplicate print.
Switching the same printer queue to an alternative PPD/filter
(https://github.com/vaginessa/ricoh-sp112-ppd, pstoricohddst-gdi) with
the same document does NOT reproduce this — it correctly shows
"Pages: 1".
Root cause
foo2ddst.c's start_page() function emits its own CUPS page-accounting
marker:
++pageno;
if (IsCUPS)
fprintf(stderr, "PAGE: %d %d\n", pageno, Copies);
However, the standard CUPS "pstops" filter — which runs earlier in the
filter chain, before foomatic-rip/foo2ddst-wrapper ever sees the data —
already emits this same "PAGE: n copies" marker once per real page, as
is standard practice across CUPS printer filters. foo2ddst emitting a
second, redundant marker per page causes CUPS to count each physical
page twice.
Fix that resolved it locally
Removed the redundant fprintf() call in start_page() (foo2ddst.c, near
line 560-562):
++pageno;
if (IsCUPS)
fprintf(stderr, "PAGE: %d %d\n", pageno, Copies);
After rebuilding without this line, single-page jobs correctly show
"Pages: 1" in the CUPS job list, with no change in actual printed
output (still exactly one sheet).
Suggested fix upstream
Remove the redundant PAGE: emission from foo2ddst.c's start_page(),
since page accounting is already handled by the upstream "pstops"
filter. This is likely low-impact/cosmetic (doesn't affect actual
printing) but does affect job accounting accuracy shown to users and
any tooling that relies on CUPS's reported page counts (e.g. usage
tracking, quota systems).
Happy to provide the full patch diff if useful.
- Dominant language
- C
- Stars
- 8
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenPrinting/foo2zjs
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
OpenPrinting/foo2zjs#27 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
OpenPrinting/foo2zjs#28 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
OpenPrinting/foo2zjs#18 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
OpenPrinting/foo2zjs#5 ·
-
Port HBPLv1 Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
OpenPrinting/foo2zjs#2 · 1 comment ·
All issues in OpenPrinting/foo2zjs
Similar issues
-
level/task module/gcp type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
docs
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
P3 sonic-vpp
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sonic-net/sonic-buildimage#29662 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 94/100
spack/spack-packages#6586 ·
-
category:port-update
Difficulty 2/5 1-3 hours Newbie friendliness 72/100