Bug 491733 - dbtest crashes
dbtest crashes
Status: CLOSED CURRENTRELEASE
Product: Red Hat Directory Server
Classification: Red Hat
Component: Command Line Utilities (Show other bugs)
9.0
All Linux
high Severity medium
: ---
: ---
Assigned To: Noriko Hosoi
Viktor Ashirov
:
Depends On:
Blocks: 389_1.3.0 639035
  Show dependency treegraph
 
Reported: 2009-03-23 15:10 EDT by Noriko Hosoi
Modified: 2016-05-06 10:48 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-05-06 10:48:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
git patch file (master) (708.01 KB, patch)
2010-10-22 16:33 EDT, Noriko Hosoi
nkinder: review+
rmeggins: review+
Details | Diff

  None (edit)
Description Noriko Hosoi 2009-03-23 15:10:08 EDT
Description of problem:
Question from Community:
I found a file called dbtest.c in fds source code.
The actual purpose the file written is - “ldbm database test program”. (from the comment inside file)

The function dbtest_help() inside the dbtest.c clearly shows some command line help messages such as

i => traverse index keys and ID list values" 
t => traverse index keys and values" ;
T => traverse index keys";
u => traverse id2entry keys and values" ;
U => traverse id2entry keys";
l<c> => lookup index";
L<c> => lookup index (all)";
t<c> => traverse index keys… etc,

But I could not find any specific tool which uses the functions which exists inside dbtest.c. I tried using all the available tools in FDS I didn’t find any tool which invokes this dbtest_help () function.

Other than dbverify, dbscan, is there really any testing tool available for database testing OR 
This file is in the source code as an intention of using it in future FDS releases.

Can somebody clarify my doubt?
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1) Stop the server
2) Run the command line.  Then, I put "i" to dbtest, then "sn" to attr:
# /usr/sbin/ns-slapd dbtest -D /etc/dirsrv/slapd-your_instance_name -n userRoot
ldbm database test mode

index key prefixes:
          +  presence      (sn=*)
          =  equality      (sn=jensen)
          ~  approximate   (sn~=jensin)
          *  substring     (sn=jen*)
          :  matching rule (sn:1.2.3.4.5:=Jensen)
          \  continuation

commands: i => traverse index keys and ID list values
          t => traverse index keys and values
          T => traverse index keys
          u => traverse id2entry keys and values
          U => traverse id2entry keys
dbtest: i
 attr: sn
        key: * al
        data: Regular block (count=60, max=1202)
                id: 18482912
                id: 0
                id: 32
                id: 0
                id: 49
                id: 0
                id: 18891783

But it eventually crashed on my test machine.

[Stacktrace]
Program received signal SIGSEGV, Segmentation fault.
0x00007f3143fc42c5 in dbtest_print_idlist (keystr=0x179b1c0 "* an", 
    p=0x17acf20, size=4, outfp=0x3c1cb66780)
    at ldap/servers/slapd/back-ldbm/dbtest.c:280
280			for ( i = 0; idl->b_ids[i] != NOID; ++i ) {
(gdb) bt
#0  0x00007f3143fc42c5 in dbtest_print_idlist (keystr=0x179b1c0 "* an", 
    p=0x17acf20, size=4, outfp=0x3c1cb66780)
    at ldap/servers/slapd/back-ldbm/dbtest.c:280
#1  0x00007f3143fc4167 in dbtest_traverse (db=0x17a1930, 
    filename=0x7fff4dcc8510 "sn", options=13, outfp=0x3c1cb66780)
    at ldap/servers/slapd/back-ldbm/dbtest.c:254
#2  0x00007f3143fc3e35 in ldbm_back_db_test (pb=0x7fff4dcc8630)
    at ldap/servers/slapd/back-ldbm/dbtest.c:147
#3  0x0000000000420c99 in slapd_exemode_dbtest ()
    at ldap/servers/slapd/main.c:2748
#4  0x000000000041d1ac in main (argc=6, argv=0x7fff4dcc8cc8)
    at ldap/servers/slapd/main.c:951
(gdb) p i
$1 = 128054
(gdb) p idl->b_ids[i]
Cannot access memory at address 0x182a000
Comment 2 Noriko Hosoi 2010-10-22 16:33:47 EDT
Created attachment 455193 [details]
git patch file (master)

Description: Getting rid of the dbtest.c file and its command line
option in main.c.  The tool is obsolete (new idl format is not
supported).

Files:
 Makefile.am
 ldap/servers/slapd/back-ldbm/dbtest.c
 ldap/servers/slapd/back-ldbm/init.c
 ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
 ldap/servers/slapd/main.c
Comment 3 Noriko Hosoi 2010-10-29 13:37:18 EDT
Reviewed by Rich and Nathan (Thanks a lot!)

Pushed to master.

$ git merge work
Updating 07f9ed2..5fb379f
Fast-forward
 Makefile.am                                    |    1 -
 Makefile.in                                    |   16 +-
 aclocal.m4                                     |    4 +-
 config.h.in                                    |    6 +
 configure                                      |14450 ++++++++----------------
 ldap/servers/slapd/back-ldbm/dbtest.c          |  349 -
 ldap/servers/slapd/back-ldbm/init.c            |    2 -
 ldap/servers/slapd/back-ldbm/proto-back-ldbm.h |    1 -
 ldap/servers/slapd/main.c                      |   74 -
 9 files changed, 4911 insertions(+), 9992 deletions(-)
 delete mode 100644 ldap/servers/slapd/back-ldbm/dbtest.c

$ git push
Counting objects: 27, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (14/14), done.
Writing objects: 100% (14/14), 36.20 KiB, done.
Total 14 (delta 11), reused 1 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   07f9ed2..5fb379f  master -> master
Comment 4 Amita Sharma 2011-05-11 07:19:22 EDT
Hi Noriko,

It seems that this bug is for the source code changes in the dbtest.c file.
Can you please guide, how should I verify this.

Thanks,
Amita
Comment 5 Noriko Hosoi 2011-05-11 12:25:05 EDT
(In reply to comment #4)
> Hi Noriko,
> 
> It seems that this bug is for the source code changes in the dbtest.c file.
> Can you please guide, how should I verify this.
> 
> Thanks,
> Amita

Hi, Amita.

The server binary used to take "dbtest" as an option for testing db, but it was gotten rid of by this bug fix.

For instance, db2ldif could be run like this:
/usr/sbin/ns-slapd db2ldif -D /etc/dirsrv/slapd-ID -n userRoot -a /path/to/output

In the same way, we used to be able to set dbtest like this:
/usr/sbin/ns-slapd dbtest D /etc/dirsrv/slapd-ID -n userRoot

Now it just issues this usage.  That is, "dbtest" was dropped.
usage: ns-slapd -D configdir [ldif2db | db2ldif | archive2db | db2archive | db2index | refer | suffix2instance | upgradedb | upgradednformat | dbverify] [options]
Comment 6 Amita Sharma 2011-05-12 04:01:26 EDT
[root@testvm amsharma]# /usr/sbin/ns-slapd dbtest -D /etc/dirsrv/slapd-testvm/ -n userRoot
usage: ns-slapd -D configdir [ldif2db | db2ldif | archive2db | db2archive | db2index | refer | suffix2instance | upgradedb | upgradednformat | dbverify] [options]

[root@testvm amsharma]# locate dbtest
/usr/share/doc/dstat-0.7.0/examples/tdbtest

[root@testvm amsharma]# find / -name dbtest

Yes, It is removed. Marking the bug as VERIFIED.

Note You need to log in before you can comment on or make changes to this bug.