-
Notifications
You must be signed in to change notification settings - Fork 212
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
lp (-h) hostname option has to come before destination (-d) #357
Comments
This is due to the fact that CUPS' command line tools do not parse the complete command line before executing the command, but instead, parse each argument, one by one, and execute it. So in the first command line of your example it parses and executes This is the architecture of the tools which @michaelrsweet has chosen more than 22 years ago when he started developing CUPS. I do not know whether other command line tools of that time (and also of today) also work this way. Perhaps it was common that time at least. More intuitive for a user would be to parse the full command line at first and then execute the whole thing. |
So the syntax in the
In general the sequence of the options is significant.
but here the |
@tillkamppeter Thanks for the explanation. But note: either command works on Debian's CUPS 2.2.10-6+deb10u4. Where does that leave us? @jsmeix A documentation bug then? (With lpadmin I understand the double use of -E lies way back in the history of CUPS). |
@tillkamppeter Parsing all arguments first would change behavior, not to mention making those programs significantly more complex. @debiantriage The "-E" option to lpadmin goes back to System V's "lp" command (enable and accept jobs) while "-E" for the CUPS commands forces encryption to be used. So what happened for lpadmin was a bit of a compromise for consistency's sake... As for "-h" working before or after, it is probably because the queue is accessible from both the default and external servers... |
@michaelrsweet I'll accept the behaviour and complexity argument. Will the documentation be altered to reflect the order -h, -d? |
@debiantriage I've hit the similar issue with lpstat in RHEL - user was confused by order dependency - so the idea was to create a new subsection in manpages - 'Connect options' - so users can see those have to before other options. So the synopsis would be:
WDYT? |
@zdohnal I'd call them "connection options" or (better?) "server options". The point is that "-h" and "-E" need to come before other options. |
@zdohnal A good idea. I would incline slightly towards Server options. -- |
Debian user Paul Hutschemaekers has reported
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1008210
lp -d DESTINATION -h HOSTNAME FILENAME
fails, whereaslp -h HOSTNAME -d DESTINATION FILENAME
succeeds. I have reproduced this behaviour with 2.3.3op2 and 2.4.1op1 but not with 2.2.10-6.--
Brian.
The text was updated successfully, but these errors were encountered: