Skip to content

Reject Send-Document for finished or processing jobs (Issue #1833) - #1834

Open
masanta-s wants to merge 1 commit into
OpenPrinting:masterfrom
masanta-s:fix-1833-send-document-state
Open

masanta-s wants to merge 1 commit into
OpenPrinting:masterfrom
masanta-s:fix-1833-send-document-state

Conversation

@masanta-s

Copy link
Copy Markdown

Fixes #1833

send_document() did not check the job state before it added the file. So a document sent to a canceled, aborted or completed job was accepted, and the job was started again. A document sent to a job that was already processing moved it back to pending-held, so it printed a second time.

Fix: right after the owner check, send_document() now returns client-error-not-possible:

  • for a canceled, aborted or completed job. It uses the same message as hold_job().
  • for a processing job. A job only gets to processing after its last document, since an open Create-Job job is held.

Stopped jobs keep their current handling.

Test: I added "Send Document to Canceled Job" to test/4.3-job-ops.test. I also raised the expected request and error counts in run-stp-tests.sh by one each, for the new request and its error line.

Verified on Ubuntu 24.04:

  • Before: Send-Document to a processing job returned successful-ok and set the job to pending-held. Send-Document to a completed job also returned successful-ok.
  • After: both return client-error-not-possible. A normal Create-Job with two Send-Document requests still works.
  • run-stp-tests.sh 1 passes. The only new error line is the rejected Send-Document.

…ing#1833)

send_document() did not check the job state. A document sent to a canceled, aborted or completed job was accepted, and the job was started again. A document sent to a processing job moved it back to held, so it printed twice. Return client-error-not-possible in both cases.
@masanta-s
masanta-s force-pushed the fix-1833-send-document-state branch from 5ad6a46 to c3766bf Compare November 29, 2026 10:24
@michaelrsweet michaelrsweet self-assigned this Nov 29, 2026
@michaelrsweet michaelrsweet added the bug Something isn't working label Nov 29, 2026
@michaelrsweet michaelrsweet added this to the v2.4.x milestone Nov 29, 2026

@michaelrsweet michaelrsweet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments.

Also, please do not add the additional IPP test.

Comment thread scheduler/ipp.c
* See if the job can still accept documents (Issue #1833)...
*/

if (job->state_value > IPP_JSTATE_STOPPED)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be > IPP_JSTATE_HELD. You can't add documents after the job has started processing.

Comment thread scheduler/ipp.c
*/

send_ipp_status(con, IPP_STATUS_ERROR_NOT_POSSIBLE,
_("Job #%d is finished and cannot be altered."), jobid);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Job #%d is closed."

Comment thread scheduler/ipp.c
_("Job #%d is finished and cannot be altered."), jobid);
return;
}
else if (job->state_value == IPP_JSTATE_PROCESSING)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't get a different error - pending and pending-held jobs are "open", any other state is "closed".

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Send-Document has no job-state check, resurrects canceled jobs and re-prints processing jobs

2 participants