Bug 75003 - incomplete command line options definition in built-in tests
incomplete command line options definition in built-in tests
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: kdelibs (Show other bugs)
7.3
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Ngo Than
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-10-03 11:42 EDT by Andrey
Modified: 2008-05-01 11:38 EDT (History)
0 users

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


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

  None (edit)
Description Andrey 2002-10-03 11:42:20 EDT
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 11:44:16 EDT
Created attachment 78384 [details]
Patch for 'kioslavetest.cpp'
Comment 2 Andrey 2002-10-03 11:45:54 EDT
Created attachment 78385 [details]
patch for 'metatest.cpp'
Comment 3 Ngo Than 2002-10-05 07:45:13 EDT
yes, some built-in tests here are broken. Thanks for your patch files.
Comment 4 Ngo Than 2002-10-10 07:27:31 EDT
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.