Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 341064 - CDT runs application with empty environment
Summary: CDT runs application with empty environment
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug (show other bugs)
Version: 7.0.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: cdt-debug-inbox@eclipse.org CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-27 19:17 EDT by Sven Köhler CLA
Modified: 2020-09-04 15:16 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Köhler CLA 2011-03-27 19:17:36 EDT
Build Identifier:  M20110210-1200

I compile and run this little test program:
	char * pPath;
	pPath = getenv("PATH");
	if (pPath != NULL)
		printf("The current path is: %s\n", pPath);
	else
		printf("no path\n");

When I run it, it prints "no path".

However, if I edit the launch configuration and add a completely useless variable "asdfasdf", then the PATH variable is suddenly set.
(The radio button below the environment variables is set to "Append ...")

If I remove the variable again, then the radio buttons below the list of variables get grayed out. (BTW: this is not how the radio buttons should behave - it makes aboslute sense to have the choice between "Append variables" and "Replace native environment" even if the list of variables is empty). If I run the created binary, the PATH variable is empty again.

(My conclusion is, that the setting somehow defaults to "Replace native environment" if the list of variables is empty and the radio buttons are grayed out)


Reproducible: Always
Comment 1 Sven Köhler CLA 2011-03-27 19:25:02 EDT
A java launch configuration works: the environment variables exist, if the list of variables is empty. However, the radio buttons are also grayed out. (Which keeps a user from configuring a completely empty environment.)

Please advise, if I should report a seperate bug for the "radio button grayed out" issue.
Comment 2 Marc Khouzam CLA 2011-05-24 11:47:32 EDT
(In reply to comment #1)
> A java launch configuration works: the environment variables exist, if the list
> of variables is empty. However, the radio buttons are also grayed out. (Which
> keeps a user from configuring a completely empty environment.)
> 
> Please advise, if I should report a seperate bug for the "radio button grayed
> out" issue.

We take the environment tab from the platform, so your suggestion (which seems to make sense) to not have them grayed out, would need to be a separate bug on the platform.
Comment 3 Marc Khouzam CLA 2011-05-24 11:48:37 EDT
(In reply to comment #0)
> I compile and run this little test program:
>     char * pPath;
>     pPath = getenv("PATH");
>     if (pPath != NULL)
>         printf("The current path is: %s\n", pPath);
>     else
>         printf("no path\n");
> 
> When I run it, it prints "no path".

I am not able to reproduce this on Linux with CDT 7.0.2 or HEAD.  It may be a Windows-specific problem.