| Summary: | [launch] Environment variables that contain a space are not properly set at launch time | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Marc Khouzam <marc.khouzam> | ||||
| Component: | cdt-debug-dsf-gdb | Assignee: | Marc Khouzam <marc.khouzam> | ||||
| Status: | RESOLVED FIXED | QA Contact: | Marc Khouzam <marc.khouzam> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | cdtdoug, john.cortell, pawel.1.piech | ||||
| Version: | 8.0 | Flags: | marc.khouzam:
review?
|
||||
| Target Milestone: | 7.0.2 | ||||||
| Hardware: | PC | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Marc Khouzam
Created attachment 188081 [details]
Fix
Fix
Committed to HEAD and 7_0 John, can you review (one-file patch)? *** cdt cvs genie on behalf of mkhouzam *** Bug 336013: [launch] Environment variables that contain a space are not properly set at launch time [*] MIGDBSetEnv.java 1.2 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetEnv.java?root=Tools_Project&r1=1.1&r2=1.2 [*] MIGDBSetEnv.java 1.1.2.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetEnv.java?root=Tools_Project&r1=1.1&r2=1.1.2.1 The fix looks good but I think the explanation in the code is a bit confusing. Here's how I would phrase it: MICommand wraps a parameter with double quotes if it contains a space. If the value of the environment variable has a space, and we bundle the var name, the '=' and the value as a single parameter, then we'll end up with something like -gdb-set env "MYVAR=MY VAR" which defines an environment variable named "MYVAR=MY VAR", with an empty string for a value. To avoid this, we send each element as a separate parameter -gdb-set env MYVAR = MY VAR (In reply to comment #4) > The fix looks good but I think the explanation in the code is a bit confusing. > Here's how I would phrase it: > > MICommand wraps a parameter with double quotes if it contains a space. If the > value of the environment variable has a space, and we bundle the var name, the > '=' and the value as a single parameter, then we'll end up with something like > > -gdb-set env "MYVAR=MY VAR" > > which defines an environment variable named "MYVAR=MY VAR", with an empty > string for a value. To avoid this, we send each element as a separate parameter > > -gdb-set env MYVAR = MY VAR Yes, that's better. Thanks. I updated HEAD. (I didn't bother with 7_0 since that code is not going to be maintained for much longer). *** cdt cvs genie on behalf of mkhouzam *** Bug 336013: [launch] Environment variables that contain a space are not properly set at launch time [*] MIGDBSetEnv.java 1.3 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetEnv.java?root=Tools_Project&r1=1.2&r2=1.3 |