error handling between ldb and python

tridge at samba.org tridge at samba.org
Fri Jun 12 03:00:22 GMT 2009


Hi Jelmer,

The samba4.local.torture.provision test is failing for me. I can
reproduce the error manually by running:

  bin/smbtorture ncalrpc: LOCAL-TORTURE

The backtrace is as follows:

 Traceback (most recent call last):                                                      
  File "bin/python/samba/provision.py", line 1163, in provision_become_dc               
    domain=domain, hostname=hostname, hostip="127.0.0.1", domainsid=domainsid, machinepass=machinepass, serverrole="domain controller", sitename=sitename)                                              
  File "bin/python/samba/provision.py", line 1028, in provision                                     
    credentials=credentials, lp=lp)
  File "bin/python/samba/provision.py", line 624, in setup_secretsdb
    secrets_ldb.erase()
  File "bin/python/samba/__init__.py", line 127, in erase
    self.delete(attr)

As far as I can tell, the problem seems to be with this code in __init__.py:

            try:
                self.delete(attr)
            except ldb.LdbError, (LDB_ERR_NO_SUCH_OBJECT, _):
                # Ignore missing dn errors
                pass

the ldb_dlete call does set error code 32, which is
LDB_ERR_NO_SUCH_OBJECT, but the 'pass' above does not run. I showed
this by changing the code to:

            except ldb.LdbError, (LDB_ERR_NO_SUCH_OBJECT, _):
                # Ignore missing dn errors
                print "got ERR_NO_SUCH_OBJECT"
                pass
            except:
                print "got another error"
                pass

and I do see "got another error" and the test then passwd. I haven't
been able to work out what the error code is at the python level
though.

So a few questions:

 - how do I print what error the python binding thinks it got?

 - why is it LDB_ERR_NO_SUCH_OBJECT in the above, given this code:

	PyModule_AddObject(m, "ERR_NO_SUCH_OBJECT", PyInt_FromLong(LDB_ERR_NO_SUCH_OBJECT));

   from pyldb.c, wouldn't it be ERR_NO_SUCH_OBJECT, or
   ldb.ERR_NO_SUCH_OBJECT instead of LDB_ERR_NO_SUCH_OBJECT? How does
   the LDB_ prefix get added?

Andrew couldn't reproduce this bug on his system (fedora). It
happens on my Ubuntu Jaunty system, so it may be a matter of python
version.

Any other clues on how to track this down?

Cheers, Tridge


More information about the samba-technical mailing list