Bug 761 - printing parameter doesn't override the default values of printer-related commands
printing parameter doesn't override the default values of printer-related com...
Status: CLOSED FIXED
Product: Samba 3.0
Classification: Unclassified
Component: Printing
3.0.0
All All
: P3 normal
: 3.0.2
Assigned To: Gerald (Jerry) Carter
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2003-11-11 22:47 UTC by SATOH Fumiyasu
Modified: 2005-08-24 10:22 UTC (History)
1 user (show)

See Also:


Attachments
load the config file and then initialize the printing options (6.44 KB, patch)
2004-03-01 20:08 UTC, Gerald (Jerry) Carter
no flags Details
don't default to bsd printing on linux (1.11 KB, patch)
2004-03-04 07:17 UTC, Gerald (Jerry) Carter
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description SATOH Fumiyasu 2003-11-11 22:47:58 UTC
The smb.conf(5) manpage descripbes the printing (S) parameter as below:

       printing (S)
              This  parameters  controls  how  printer   status
              information  is  interpreted  on  your system. It
              also affects the default  values  for  the  print
              command,  lpq command, lppause command , lpresume
              command, and lprm command  if  specified  in  the
              [global] section.
               ...

but this differs from actual behavior:

$ echo 'printing = bsd' > smb.conf
$ testparm -s -v smb.conf > bsd.out
$ echo 'printing = sysv' > smb.conf
$ testparm -s -v smb.conf |diff bsd.out -
241c241
<       printing = bsd
---
>       printing = sysv
Comment 1 Gerald (Jerry) Carter 2004-03-01 20:08:17 UTC
Created attachment 421 [details]
load the config file and then initialize the printing options
Comment 2 Gerald (Jerry) Carter 2004-03-01 20:08:56 UTC
Fixed in 3.0 and HEAD
Comment 3 SATOH Fumiyasu 2004-03-03 20:59:37 UTC
This patch breaks other things:

$ cat smb.conf
[printer]
print ok = YES

$ testparm -V
Version CVS 3.0.3pre1

$ testparm -s smb.conf
Load smb config files from smb.conf
Processing section "[printer]"
No path in service printer - using /tmp
Loaded services file OK.
# Global parameters
[global]
        print command = lpr -r -P'%p' %s
        lpq command = lpq -P'%p'
        lprm command = lprm -P'%p' %j

[printer]
        path = /home/fumiya/var/tmp
        printable = Yes
        print command =
        lpq command =
        lprm command =


With Samba 3.0.2a:

$ testparm -V
Version 3.0.2a

$ testparm -s smb.conf
Load smb config files from smb.conf
Processing section "[printer]"
No path in service printer - using /tmp
Loaded services file OK.
# Global parameters
[global]

[printer]
        path = /home/fumiya/var/tmp
        printable = Yes
Comment 4 Gerald (Jerry) Carter 2004-03-04 07:16:47 UTC
Different bug actually.  DEFAULT_PRINTING was always 
getting set to PRINT_BSD on linux systems rather than 
looking for cups support.
Comment 5 Gerald (Jerry) Carter 2004-03-04 07:17:18 UTC
Created attachment 424 [details]
don't default to bsd printing on linux
Comment 6 Gerald (Jerry) Carter 2004-03-04 07:18:10 UTC
fixed checked into 3.0 and HEAD

$ cat /tmp/smb.conf
[printers]
        print ok = yes

$ bin/testparm -s /tmp/smb.conf
Load smb config files from /tmp/smb.conf
Processing section "[printers]"
No path in service printers - using /tmp
Loaded services file OK.
# Global parameters
[global]

[printers]
        path = /tmp
        printable = Yes
        browseable = No
Comment 7 SATOH Fumiyasu 2004-03-04 18:46:53 UTC
Reopened.

$ cat smb.conf
[global]
printing = sysv

[printer]
print ok = YES

$ testparm -s smb.conf
Load smb config files from smb.conf
Processing section "[printer]"
No path in service printer - using /tmp
Loaded services file OK.
# Global parameters
[global]
        printing = sysv
        print command = lp -c -d%p %s; rm %s
        lpq command = lpstat -o%p
        lprm command = cancel %p-%j
        lppause command = lp -i %p-%j -H hold
        lpresume command = lp -i %p-%j -H resume
        queuepause command = disable %p
        queueresume command = enable %p

[printer]
        path = /tmp
        printable = Yes
        print command =
        lpq command =
        lprm command =
        lppause command =
        lpresume command =
        queuepause command =
        queueresume command =
Comment 8 SATOH Fumiyasu 2004-03-04 18:52:33 UTC
The patch "don't default to bsd printing on linux" in
Additional Comment #5 is for source/script/installswat.sh,
not for printing system. :-)
Comment 9 Gerald (Jerry) Carter 2004-03-11 09:05:53 UTC
The problem is that the various print commands 
are initialized based on the value of DEFAULT_PRINTING
from include/includes.h which is done before any 
smb.conf parsing.  


grrr....this bug has been a snakepit.
Comment 10 Gerald (Jerry) Carter 2004-03-11 09:53:32 UTC
You know what?  I'm just oging to fix the docs.
This is a chicken-and-egg problem that I can't figure
out how to work around.  I cannot see a way to inject
new defaults based on parsing 'printing = ...' in 
the global section (in the middle of parsing).

Right now the best solution is to explicitly set the 
'print command', et. al. manually in the global section.

At least now you can override the struct printif* on a 
per section basis so cups doesn't take complete control.
Comment 11 Gerald (Jerry) Carter 2004-04-10 15:35:54 UTC
have a fix now.
Comment 12 Gerald (Jerry) Carter 2004-04-10 15:37:07 UTC
ok.  I think this should fix things now.  as well as resolving the 
things I broke in 3.0.3pre[12].  Changes checked into 3.0 and trunk.
Comment 13 Gerald (Jerry) Carter 2005-08-24 10:22:01 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.