Friday, September 19, 2008

Beware of LPDEST

When LPDEST is set in your shell profile it will make that printer the one used by lp, even if another default has been chosen systemwide. Fair enough - every user should be able to choose their favorite printers. However, this confusingly (IMO) alters what is returned by lpstat as "system default destination". For example:
(imagine somewhere hidden in .bash_profile is LPDEST=wrongPrinter1)

>lpstat -d
system default destination: wrongPrinter1
#ok let's fix this
>sudo lpadmin -d rightPrinter2
>lpstat -d
system default destination: wrongPrinter1
#wtf??
>sudo lpstat -d
system default destination: rightPrinter2
#root and me see two different "system defaults" on the same machine
>lpadmin -d
rightPrinter2
Permission denied: not in group 14
#i guess only root can change the real system default
>export LPDEST=rightPrinter2
>lpstat -d
system default destination: rightPrinter2

Perhaps most hair ripping will be that the GUI print settings will show rightPrinter2 as the default but most programs will print to wrongPrinter1. I see the origins of a good April Fools prank here. A better design would allow lpstat to be cognizant of user and default system preferences and label them accordingly.
(I use Solaris10 YMMV)
For more info:
http://www.sun.com/bigadmin/content/submitted/printing_solaris.html

No comments:

Post a Comment