This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 197792 - argc and argv incorrectly set on program startup.
Summary: argc and argv incorrectly set on program startup.
Status: RESOLVED DUPLICATE of bug 190919
Alias: None
Product: cnd
Classification: Unclassified
Component: execution (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 normal (vote)
Assignee: Andrew Krasny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-15 14:47 UTC by daveorgans
Modified: 2011-11-16 16:39 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
source for simple test of problem. (390 bytes, text/plain)
2011-04-15 14:47 UTC, daveorgans
Details

Note You need to log in before you can comment on or make changes to this bug.
Description daveorgans 2011-04-15 14:47:19 UTC
Created attachment 107776 [details]
source for simple test of problem.

On entry into the "main" function in C/C++ argc is always set to 1 and argv only contains the executable path (argv[0]), regardless of whether or not you have set command line arguments in the project "run" environment.

See attached program.  It does not work if args are set in "run" properties window.
Comment 1 Andrew Krasny 2011-04-15 15:44:02 UTC
Hm... looks really strange to me. Could you, please, create an 'Arguments' sample application and try if it works, please?

What exact version of NB do you use (Help->About)?
Comment 2 daveorgans 2011-04-15 16:00:32 UTC
The attached source code is a complete program.  Just create a project containing only this file and sets its properties->run->arguments to "string1 string2 string3" or any other strings of your choice and run the program.  Only arg[0] comes out.  In debug mode "main(int argc, char *argv[])" shows argc to be 1 and argv has only one entry, the executable path.  I expect the arguments from the "properties->run->arguments" field are not being passed to the debugger or shell on execution.

Dave H.
Comment 3 daveorgans 2011-04-15 16:08:09 UTC
More comments...  I am using the NetBeans 6.9 obtained through the Ubuntu disto site.  I am using the GNU toolset.

Help->About returns:

Product Version: NetBeans IDE 6.9 (Build 100825-unknown-revn)
Java: 1.6.0_20; OpenJDK Client VM 19.0-b09
System: Linux version 2.6.35-28-generic running on i386; UTF-8; en_US (nb)
Userdir: /home/dhawkins/.netbeans/6.9
Comment 4 Andrew Krasny 2011-04-15 16:17:13 UTC
Dave, 

I said that this is very strange, because this functionality is tested and used.. But, from the other hand, I see that you are using OpenJDK.. Perhaps this is the reason (?? Not sure though).. Also you are using an old version. Don't you want to try something newer? (download from netbeans.org). 7.0 is about to be released very soon. But you can try 7.0 RC2 right now... BTW, in this (7.0) version this place (how to setup arguments) was slightly changed...
Comment 5 soldatov 2011-04-15 16:30:28 UTC
This bug appears if you installed NetBeans 6.9 or 6.9.1 without patches.
Comment 6 Andrew Krasny 2011-04-28 16:26:41 UTC
Valera, what should we do with this? 
It is not reproducible in current versions. Should it be just closed?
Comment 7 soldatov 2011-04-28 18:44:25 UTC

*** This bug has been marked as a duplicate of bug 190919 ***