Bug 239805

Summary: failed when saving "share published printers connected to this system"
Product: [Fedora] Fedora Reporter: ericm24x7
Component: system-config-printerAssignee: Tim Waugh <twaugh>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: mishu, nphilipp
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 0.7.63.2-2.fc7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-06-13 21:04:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 236808    
Attachments:
Description Flags
cupsd config file none

Description ericm24x7 2007-05-11 13:55:49 UTC
Description of problem:
I received the following traceback when trying to apply/save the following option:
"Server Settings" > "[x]Share published printers connected to this system" 

Traceback (most recent call last):
  File "/usr/share/system-config-printer/system-config-printer.py", line 1099,
in on_btnApply_clicked
    err = self.apply()
  File "/usr/share/system-config-printer/system-config-printer.py", line 1110,
in apply
    return self.save_serversettings()
  File "/usr/share/system-config-printer/system-config-printer.py", line 3109,
in save_serversettings
    self.cups.adminSetServerSettings(setting_dict)
RuntimeError: Failed to set settings

Version-Release number of selected component (if applicable):
system-config-printer 0.7.63.1.x86_64

How reproducible:
persistent

Steps to Reproduce:
1. system-config-printer
2. Select the following options
   "Server Settings" > "[x]Share published printers connected to this system"
3. Press [apply] button
  
Actual results:
display traceback shown above

Comment 1 Tim Waugh 2007-05-23 12:09:15 UTC
Do you still see this?  Can you attach your /etc/cups/cupsd.conf file please?

Comment 2 ericm24x7 2007-05-23 16:11:58 UTC
Created attachment 155271 [details]
cupsd config file

Comment 3 Nils Philippsen 2007-05-26 13:47:02 UTC
I see this with a pristine cupsd.conf from cups-1.2.10-10.fc7 -- I upgraded from
FC6 to F7, then moved the cupsd.conf.rpmnew over the old cupsd.conf file, then
started s-c-printer and attempted to share the printers as described above.

Comment 4 Tim Waugh 2007-05-29 18:04:59 UTC
Hmm, I haven't been able to reproduce that behaviour here.  If you fetch
1.2.0-11.fc7 from here (both the cups and cups-libs packages):

http://koji.fedoraproject.org/koji/taskinfo?taskID=19891

can you still reproduce the problem?

Comment 5 ericm24x7 2007-05-29 18:36:29 UTC
I just installed and tested i386 build tree, cups-1.2.10-10.fc7 works OK while
it failed under x86_64. I will re-install x86_64 again, and update to 1.2.10-11.fc7

I will update on the result a little later today.  

Comment 6 ericm24x7 2007-05-30 00:05:43 UTC
The mirror I'm using do not have the complete x86_64 build tree at the moment.
The missing files are the boot files that reside beneath isolinux and images
directory. I can't install the system without the boot files. Will try again
later...

Comment 7 Nils Philippsen 2007-05-30 13:05:03 UTC
This is on x86_64, the traceback is when trying to apply the changed server
settings:

root@wombat:~> system-config-printer
Traceback (most recent call last):
  File "/usr/share/system-config-printer/system-config-printer.py", line 1099,
in on_btnApply_clicked
    err = self.apply()
  File "/usr/share/system-config-printer/system-config-printer.py", line 1110,
in apply
    return self.save_serversettings()
  File "/usr/share/system-config-printer/system-config-printer.py", line 3109,
in save_serversettings
    self.cups.adminSetServerSettings(setting_dict)
RuntimeError: Failed to set settings
root@wombat:~> rpm -q system-config-printer cups cups-libs
system-config-printer-0.7.63.1-1.fc7
cups-1.2.10-11.fc7
cups-libs-1.2.10-11.fc7
cups-libs-1.2.10-11.fc7
root@wombat:~> 


Comment 8 Tim Waugh 2007-05-30 13:53:26 UTC
I haven't been able to reproduce this, even on x86_64. :-(

Nils, would it be possible for you to try single-stepping through the
_cupsAdminSetServerSettings() function to see where it fails?  This function
comes from libcups, cups-1.2.10/cups/adminutil.c in the source.

Once you've installed cups-debuginfo-1.2.10-11.fc7 you should be able to do this:

$ gdb --args python /usr/sbin/system-config-printer
(gdb) b _cupsAdminSetServerSettings
(gdb) run

and get a prompt at the point you press Apply.

Comment 9 Nils Philippsen 2007-05-30 15:57:02 UTC
Is the following enough?

971     {
(gdb) 
(gdb) list
966     int                                     /* O - 1 on success, 0 on failure */
967     _cupsAdminSetServerSettings(
968         http_t        *http,                /* I - Connection to server */
969         int           num_settings,         /* I - Number of settings */
970         cups_option_t *settings)            /* I - Settings */
971     {
972       int           i;                      /* Looping var */
973       http_status_t status;                 /* GET/PUT status */
974       const char    *server_port_env;       /* SERVER_PORT env var */
975       int           server_port;            /* IPP port for server */
(gdb) n
1013      _cups_globals_t *cg = _cupsGlobals(); /* Global data */
(gdb) n
1020      if (!http || !num_settings || !settings)
(gdb) n
1013      _cups_globals_t *cg = _cupsGlobals(); /* Global data */
(gdb) n
1020      if (!http || !num_settings || !settings)
(gdb) n
1022        _cupsSetError(IPP_INTERNAL_ERROR, NULL);
(gdb) n
1834    }
(gdb) n
0x00002aaab0be0839 in ?? () from /usr/lib64/python2.5/site-packages/cups.so
(gdb) n
Cannot find bounds of current function
(gdb) 


Comment 10 Tim Waugh 2007-05-30 18:25:39 UTC
Do you have the rest of that session still saved?  I would like to know what
http, num_settings, and settings, are..

Comment 11 Nils Philippsen 2007-05-31 08:10:57 UTC
I've just repeated what I did above, then single steppeed past the
_cupsSetError() call:

(gdb) print http
$1 = (http_t *) 0xc5a5e0
(gdb) print num_settings
$2 = 0
(gdb) print settings
$3 = (cups_option_t *) 0x0


Comment 12 Tim Waugh 2007-06-04 17:43:50 UTC
Can you try adjusting /usr/share/system-config-printer/system-config-printer.py
so that it looks like this, starting at line 3108?:

        try:
            print setting_dict ## i.e. just add this line
            self.cups.adminSetServerSettings(setting_dict)
        except cups.IPPError, (e, m):
            self.show_IPP_Error(e, m)
            return True

What it setting_dict before the call to set the settings?

Comment 13 Nils Philippsen 2007-06-04 18:25:01 UTC
setting_dict is:

{'SystemGroup': 'sys root', '_remote_admin': '0', 'DefaultAuthType': 'Basic',
'_share_printers': '1', '_debug_logging': '0', '_remote_printers': '1',
'_user_cancel_any': '0'}

Comment 14 Tim Waugh 2007-06-07 17:28:42 UTC
Please get system-config-printer-0.7.63.2-1.fc7 from updates-testing and then
run this in a terminal:

PYCUPS_DEBUG=1 /usr/sbin/system-config-printer

When you trigger the problem this time, we should get to see what values the
Python bindings saw.

Comment 15 Nils Philippsen 2007-06-08 08:44:16 UTC
root@wombat:~> PYCUPS_DEBUG=1 /usr/sbin/system-config-printer
-> Connection_init()
httpConnectEncrypt(...)
<- Connection_init() = 0
-> Connection_getPrinters()
cupsDoRequest("/")
Attribute: printer-is-shared
Added printer-is-shared to dict
Attribute: printer-state
Added printer-state to dict
Attribute: printer-state-message
Added printer-state-message to dict
Attribute: printer-state-reasons
-> build_list_from_attribute_strings()
none
<- build_list_from_attribute_strings()
Added printer-state-reasons to dict
Attribute: printer-type
Added printer-type to dict
Attribute: printer-uri-supported
Added printer-uri-supported to dict
Attribute: printer-name
Attribute: printer-location
Added printer-location to dict
Attribute: printer-info
Added printer-info to dict
Attribute: device-uri
Added device-uri to dict
Attribute: printer-make-and-model
Added printer-make-and-model to dict
Attribute: printer-is-shared
Added printer-is-shared to dict
Attribute: printer-state
Added printer-state to dict
Attribute: printer-state-message
Added printer-state-message to dict
Attribute: printer-state-reasons
-> build_list_from_attribute_strings()
none
<- build_list_from_attribute_strings()
Added printer-state-reasons to dict
Attribute: printer-type
Added printer-type to dict
Attribute: printer-uri-supported
Added printer-uri-supported to dict
Attribute: printer-name
Attribute: printer-location
Added printer-location to dict
Attribute: printer-info
Added printer-info to dict
Attribute: device-uri
Added device-uri to dict
Attribute: printer-make-and-model
Added printer-make-and-model to dict
<- Connection_getPrinters() = dict
-> Connection_getClasses()cupsDoRequest("/")
<- Connection_getClasses() = dict
-> Connection_adminSetServerSettings()
num_settings=0, settings=(nil)
<- Connection_adminSetServerSettings() EXCEPTION
Traceback (most recent call last):
  File "/usr/share/system-config-printer/system-config-printer.py", line 1106,
in on_btnApply_clicked
    err = self.apply()
  File "/usr/share/system-config-printer/system-config-printer.py", line 1117,
in apply
    return self.save_serversettings()
  File "/usr/share/system-config-printer/system-config-printer.py", line 3125,
in save_serversettings
    self.cups.adminSetServerSettings(setting_dict)
RuntimeError: Failed to set settings

Comment 16 Tim Waugh 2007-06-08 08:52:21 UTC
Can you try the change from comment #12 again?  This time it starts at line
3124.  I'd like to be able to catch both the 'print setting_dict' output from
the Python *and* the pycups debugging output saying what it found.  Thanks.

Comment 17 Nils Philippsen 2007-06-08 09:45:42 UTC
just the changed snippet:

Added printer-make-and-model to dict
<- Connection_getPrinters() = dict
-> Connection_getClasses()cupsDoRequest("/")
<- Connection_getClasses() = dict
{'SystemGroup': 'sys root', '_remote_admin': '0', 'DefaultAuthType': 'Basic',
'_share_printers': '1', '_debug_logging': '0', '_remote_printers': '1',
'_user_cancel_any': '0'}
-> Connection_adminSetServerSettings()
num_settings=0, settings=(nil)
<- Connection_adminSetServerSettings() EXCEPTION


Comment 18 Tim Waugh 2007-06-08 10:44:36 UTC
Can you please try these packages (system-config-printer and
system-config-printer-libs):

http://koji.fedoraproject.org/koji/taskinfo?taskID=30879

I think it might be to do with the fact that Python 2.5 changed the function
signature of PyDict_Next().

Comment 19 Tim Waugh 2007-06-08 11:39:14 UTC
This is the link to the actual packages:

http://koji.fedoraproject.org/koji/buildinfo?buildID=8397

Comment 20 ericm24x7 2007-06-08 18:03:21 UTC
Sorry Tim for not getting back too soon, got problem with the mirrors not
updating. Anyway, I just downloaded
system-config-printer-0.7.63.2-2.fc7.x86_64.rpm and it seem to work now. 

I can also see the share from remote client and did a quick test to print.
Result: Successful!

Great job... Closing this bug now.

Comment 21 Tim Waugh 2007-06-10 09:28:50 UTC
Thanks for testing.  I'll set this to MODIFIED until the update is actually pushed.

Comment 22 Fedora Update System 2007-06-11 22:03:41 UTC
system-config-printer-0.7.63.2-2.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.

Comment 23 Fedora Update System 2007-06-13 21:04:44 UTC
system-config-printer-0.7.63.2-2.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.