Backend argument problem

Asked by Michael König

I'm trying to use the HPLIP backend ("hp" compiled from prnt/backend/hp.c) on an embedded system with only cups-filters to generate raster files, but without CUPS or Ghostscript.
I currently have version 3.12.6 of HPLIP, but it seems that the argument problem seems to be present for all previous versions I have taken a look at. Here's what I mean (all in the first few lines of main()):

According to the output when it's given the wrong number of arguments the command line should look as such:
"ERROR: invalid usage: device_uri job-id user title copies options [file]"

The problem is that this message is displayed when argc is < 6 or > 7, but the process name also counts in argc, so the argument count would be either 7 or 8.

This problem continues when the optional file is opened as "fd = open(argv[6], O_RDONLY)", where is probably should be argv[7], with number of copies from argv[4] (should be argv[5]).

And instead of using the device URI to query the model the process name is used instead: "hpmud_query_model(argv[0], &ma);"

I tried to fix the problem by increasing each array index by one, but that leads to segmentation faults.

Either my understanding of the code is totally wrong or it is highly unlikely that it'll run as written.

Question information

Language:
English Edit question
Status:
Answered
For:
HPLIP Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Johannes Meixner (jsmeix) said :
#1

See "man 7 backend" or online at cups.org at
http://www.cups.org/documentation.php/doc-1.5/man-backend.html
------------------------------------------------------------------------------
SYNOPSIS
    backend
    backend job user title num-copies options [ filename ]
...
The command name (argv[0]) is set to the device URI of the destination printer.
------------------------------------------------------------------------------
i.e.:
backend = argv[0]
job = argv[1]
user = argv[2]
title = argv[3]
num-copies = argv[4]
options = argv[5]
filename = argv[6]

Can you help with this problem?

Provide an answer of your own, or ask Michael König for more information if necessary.

To post a message you must log in.