Bug #6560 Segmentation fault after successful install
Submitted: 10 Nov 2004 21:28 Modified: 15 Nov 2004 10:00
Reporter: GuĂ°mundur D. Haraldsson Email Updates:
Status: Closed Impact on me:
None 
Category:MaxDB Severity:S3 (Non-critical)
Version:7.5.00.19 OS:Linux (Fedora Core 2 -installed cleanly)
Assigned to: Ulf Wendel CPU Architecture:Any

[10 Nov 2004 21:28] GuĂ°mundur D. Haraldsson
Description:
After installing MaxDB 7.5.00.19 I was looking around in the newly installed directories, and did something I knew was incorrect, but tried anyway:

[sdb@klif bin]$ pwd
/usr/local/maxdb_kernel/bin

[sdb@klif bin]$ ./dbmstart
ERR: Missing database name
Usage: dbmstart -d DBNAME
Segmentation fault

[sdb@klif bin]$ ./dbmstop 
ERR: Missing database name
Usage: dbmstart -d DBNAME
Segmentation fault

When looking at source-code, I see the following in  /home/gdh/maxdb-source/V75_00_19/MaxDB_ORG/sys/src/cn/vcn12dbmstart.cpp:

static void cn12ParseOptions
      ( tcn12Options       * options,
        int                  argc,
        char               * argv[] )
{
    if ( argc < 2 )
    {
        printf("ERR: Missing database name\n");
        printf("Usage: dbmstart -d DBNAME\n");
    }
   [..]

    char *dbname;

    if ( argv[1][2] != 0 )
    {
        dbname = &(argv[1][2]);
    }
    else
    {
        dbname = argv[2];
    }

    if ( strlen(dbname) > sizeof(tsp00_DbName) )
    {
        printf("ERR: Database '%s' name too long\n", dbname);
        printf("Usage: dbmstart -d DBNAME\n");
    }

   [..]

I'd guess that "dbname = &(argv[1][2]);" is the offencive statement here, causing the segmentation fault when fewer than 1 argument are provided...

Also, when I tried to provide some arguments, this happend:

[sdb@klif bin]$ ./dbmstop -d asdf asdf asdf
Failed to get root path for 'ASDF'
Failed to get root path for 'ASDF'
Segmentation fault

How to repeat:
* Install MaxDB
* Try to use dbmstart without creating any database instance.

Suggested fix:
Provide some checks in the code posted above, if indeed that code is causing the problems...
[11 Nov 2004 21:57] Ulf Wendel
Thank you for the great input! 

We are working on it :-(.

Best regards,
Ulf Wendel
[15 Nov 2004 10:00] Ulf Wendel
Hello,

your analysation of the error was very helpful. Thank you!

You can track the process of the bugfix on http://www.sapdb.org/webpts?stored=yes&Init=no&SelFECR=3&Number=1132481&TStatus1=yes&TStat...  

Best regards,
Ulf Wendel