Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The sub-command "delete" fails to delete printer(s) #301

Closed
tangyanli opened this issue Oct 25, 2023 · 2 comments
Closed

The sub-command "delete" fails to delete printer(s) #301

tangyanli opened this issue Oct 25, 2023 · 2 comments
Assignees
Labels
bug Something isn't working priority-high
Milestone

Comments

@tangyanli
Copy link

Describe the bug
The sub-command "delete" fails to delete printer(s)

To Reproduce
Steps to reproduce the behavior:

  1. Start legacy-printer-app.
  2. Add a printer named "legacy-1" on web page or by the "add" sub-command.
  3. Call sub-command "delete" to delete the new added printer:
    legacy-printer-app delete -d legacy-1
  4. The terminal display below error message:
    legacy-printer-app: Unable to get information for printer: successful-ok

More behavior

  1. The new added printer can be deleted on the web page.
  2. If I shutdown and restart the printer-app again, then the printer "legacy-1" can be deleted by the "delete" sub-command.

System Information:

  • OS: Ubuntu22.10
  • Browser: Firefix
  • Version: pappl-v1.4.x

Additional context
At the client side, in the function _papplMainloopDeletePrinter, the acquired printer_id is 0.

	printer_id = ippGetInteger(ippFindAttribute(response, "printer-id", IPP_TAG_INTEGER), 0);
	ippDelete(response);

	if (printer_id == 0)       ★ printer_id is 0
	{
		_papplLocPrintf(stderr, _PAPPL_LOC("%s: Unable to get information for printer: %s"), base_name, cupsGetErrorString());
		httpClose(http);
		return (1);
	}

At the pappl server side, the backtrace is as below

ipp_create_printer()
    papplPrinterCreate(system, printer_id = 0, ...) 
        ippAddInteger(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "printer-id", printer_id)   ★ the value of "printer-id" attribute is set as 0
        _papplSystemAddPrinter(system, printer, printer_id)
            printer->printer_id = system->next_printer_id ++    ★ the printer_id is reset. But the "printer-id" in the printer->attrs is still 0.

michaelrsweet added a commit that referenced this issue Oct 26, 2023
michaelrsweet added a commit that referenced this issue Oct 26, 2023
@michaelrsweet
Copy link
Owner

OK, this should now be fixed.

@michaelrsweet michaelrsweet self-assigned this Oct 26, 2023
@michaelrsweet michaelrsweet added bug Something isn't working priority-high labels Oct 26, 2023
@michaelrsweet michaelrsweet added this to the Stable milestone Oct 26, 2023
@michaelrsweet
Copy link
Owner

(only affected new printers, printers that were loaded then got the correct ID)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-high
Projects
None yet
Development

No branches or pull requests

2 participants