Bug 75003 - incomplete command line options definition in built-in tests
Summary: incomplete command line options definition in built-in tests
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kdelibs
Version: 7.3
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Than Ngo
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-10-03 15:42 UTC by Andrey
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-10-05 11:45:20 UTC
Embargoed:


Attachments (Terms of Use)
Patch for 'kioslavetest.cpp' (490 bytes, patch)
2002-10-03 15:44 UTC, Andrey
no flags Details | Diff
patch for 'metatest.cpp' (508 bytes, patch)
2002-10-03 15:45 UTC, Andrey
no flags Details | Diff

Description Andrey 2002-10-03 15:42:20 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461)

Description of problem:
Some built-in tests (kio/tests/kioslavetest.cpp, kio/tests/metatest.cpp) 
contain incomplete definition for command line options.
This definition must be done in accordance with KDELIBS-3.0 documentation (see 

http://developer.kde.org/documentation/library/3.0-
api/classref/kdecore/KCmdLineArgs.html#KApplication).
As that document states the last structure of options array must be {0,0,0}.
But in these tests I see the following:
------kioslavetest.cpp:------
....
static KCmdLineOptions options[] =
{
 { "s", 0, 0 },
 { "src <src>", "Source URL", "" },
 { "d", 0, 0 },
 { "dest <dest>", "Destination URL", "" },
 { "o", 0, 0 },
 { "operation <operation>", "Operation 
(list,listrecursive,stat,get,copy,move,del,shred,mkdir)", "copy" },
 { "p", 0, 0 },
 { "progress <progress>", "Progress Type (none,default,status)", "default" }
};
....
----------------------------
It should be noted 'normal' applications (e.g. kde-config) from this package 
use {0,0,0} at the end of command line options.

GCC 2.96 - and GCC 3.2-compiled tests run succesfully.
But if another compiler (such as Intel C++ compiler for Linux) is being used 
there's crash in command line parser.
May be this situation takes the place because compilers differently allocate 
memory for static objects.

-------------kcmdlineargs.cpp (library 'kdecore'): 	// a part of command 
line parser, here I have segmentation violation
 .....
 524 void
 525 KCmdLineArgs::parseAllArgs()
 526 {
 527    bool allowArgs = false;
 528    bool inOptions = true;
 529    bool everythingAfterArgIsArgs = false;
 530    KCmdLineArgs *appOptions = argsList->last();
 531    if (!appOptions->id)
 532    {
 533      const KCmdLineOptions *option = appOptions->options;
 534      while(option && option->name)
 535      {
 536        if (option->name[0] == '+')			// Intel C++ Linux 
compiler crash here	
 537            allowArgs = true;
 538        if ( option->name[0] == '!' && option->name[1] == '+' )
 539        {
 540            allowArgs = true;
 541            everythingAfterArgIsArgs = true;
 542        }
 543        option++;
 544      }
 .....
-------------------------------------

The simplest way to solve the problem is to add {0,0,0} at the end of command 
line options (pathes are attached).


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. install Intel C++ compiler for Linux
2. build the package using Intel C++ compiler
3. cd kdelibs-3.0.0/kio/tests
4. make kioslavetest && ./.libs/lt-kioslavetest
	

Actual Results:  Segmentation fault

Expected Results:  application window must be shown.

Additional info:

Comment 1 Andrey 2002-10-03 15:44:16 UTC
Created attachment 78384 [details]
Patch for 'kioslavetest.cpp'

Comment 2 Andrey 2002-10-03 15:45:54 UTC
Created attachment 78385 [details]
patch for 'metatest.cpp'

Comment 3 Ngo Than 2002-10-05 11:45:13 UTC
yes, some built-in tests here are broken. Thanks for your patch files.

Comment 4 Ngo Than 2002-10-10 11:27:31 UTC
It's fixed in 3.0.4-1


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