OpenPrinting / cups

OpenPrinting CUPS Sources
https://openprinting.github.io/cups
Apache License 2.0
1k stars 178 forks source link

lpstat gives incorrect wording for the default printer #819

Closed ToddAndMargo closed 5 months ago

ToddAndMargo commented 9 months ago

Dear Cups Developers,

Fedora 38 cups-2.4.7-1.fc38.x86_64

lpstat -d, although it gives the correct printer name, it does not differentiate between the global system default for when ~/.cups/lpoptions does not exist and the local user's default. It always stated "system default destination". If it is the user's default, is should state: "user's default destination "

$ lpoptions -d Cups-PDF ... ipp://localhost/printers/Cups-PDF

$ lpstat -d system default destination: Cups-PDF

That is the local user default, not the system default, as verified by the following.

$ cat /etc/cups/lpoptions Default HLL2300D

$ cat ~/.cups/lpoptions Default Cups-PDF

zdohnal commented 9 months ago

/etc/cups/lpoptions does not store system default, but root user default - it will be showed as a default destination if you are logged in as root.

'system default destination' is correct, because it is meant to tell you what destination will be used if you don't provide '-d' (for lp)/'-P' (for lpr) in your current login session - thus 'system' here is daemon default destination with possible user default destination overriding the daemon one.

@michaelrsweet IMO changing this or even mentioning the origin of settings would require splitting functionality of cupsGetNamedDest() which now does search for a destination into two new functions while keeping the original function in place for compatibility, WDYT?

@ToddAndMargo I can update lpstat, lpadmin, lpoptions and CUPS web UI man page with the following texts:

lpstat -d:
Show the current default destination taken from file lpoptions (located at ~/.cups for regular user, /etc/cups for root) or from printing system, where the file has the priority
lpoptions
Display or set printer options and default for user settings
lpadmin
Configure cups printers and classes in daemon settings

A new paragraph at index.html

locahost:631

CUPS Web User Interface configure the printing daemon cupsd - use lpoptions for user settings.
michaelrsweet commented 9 months ago

@ToddAndMargo The wording from the lpstat command is historical - the System V printing system used "system default destination" and any scripts that might parse the output would still depend on that... :/ And even if we did decide to change the wording, the default printer can come from the scheduler, the root lpoptions file, the user lpoptions, or the PRINTER or LPDEST environment variables.

@zdohnal I explicitly don't want to provide APIs for this - all of the defaults stuff is an implementation detail, and it is even different on macOS where your default printer is tracked by application and location (network). It is sufficient that an application can lookup the default printer for the current user session.

WRT adding something to the web interface, I foresee more confusion there since most users either don't know there is a print server on their computer or they assume that accessing the print server's web interface is interacting with the server settings and not their user settings...

zdohnal commented 7 months ago

@michaelrsweet are you ok with changes for man pages? With the change lpstat -d would mention the env variables as well.

michaelrsweet commented 7 months ago

@zdohnal OK, so some feedback on the original proposed "documentation" changes -

lpstat -d:

Show the current default destination, either the lpoptions default (if set) or the scheduler default (otherwise).

lpoptions:

display or set user printer options

lpadmin:

configure printers and classes on cups scheduler

I don't recommend any changes to the CUPS web interface.

zdohnal commented 7 months ago

@michaelrsweet shall we mention env vars with lpstat -d? Or it is under one of the mentioned defaults?

michaelrsweet commented 7 months ago

@zdohnal We could add an ENVIRONMENT VARIABLES section in the lp, lpoptions, lpr, and lpstat man pages that copies the LPDEST and PRINTER entries from the cups man page.

michaelrsweet commented 5 months ago

[master f17164cc8] Update default destination documentation (Issue #819)