Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 360846

Summary: Extra space in build command
Product: [Tools] CDT Reporter: Marc Khouzam <marc.khouzam>
Component: cdt-buildAssignee: Marc Khouzam <marc.khouzam>
Status: RESOLVED FIXED QA Contact: Andrew Gvozdev <angvoz.dev>
Severity: normal    
Priority: P3 CC: cdtdoug
Version: 8.0   
Target Milestone: 8.0.2   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Proposed fix marc.khouzam: iplog-

Description Marc Khouzam CLA 2011-10-13 11:01:21 EDT
If I add an argument to the build command and use the parallel build setting, an extra space appears before the -j flag.

Normally, this should not be a problem but it seems that some other plugins that re-use that output trip up on that extra space and abort.

To reproduce:

1- open the properties of a project
2- C/C++ Build -> Build settings, uncheck "Use default build command"
3- Make the build command "make hello"
4- Go to Behavior tab an enable parallel build 
5- make sure "stop on first build error" is also enabled
6- go back to Builder Settings tab
=> notice the double space in "make hello  -j4"

I will attach a proposed fix.
Comment 1 Marc Khouzam CLA 2011-10-13 11:06:15 EDT
Created attachment 205138 [details]
Proposed fix

Here is the simple fix which simply does not modify the existing arguments if the command to be added is empty.

If this fix makes sense, I'd like to apply it to the cdt_8_0 branch also.
Comment 2 Andrew Gvozdev CLA 2011-10-13 17:36:04 EDT
The fix looks OK to me. I also ran AllManagedBuildTests - they all passed.
Comment 3 Marc Khouzam CLA 2011-10-14 06:09:01 EDT
(In reply to comment #2)
> The fix looks OK to me. I also ran AllManagedBuildTests - they all passed.

Thanks Andrew!
For me to know for next time, can I run AllManagedBuildTests on Windows or on Linux?  I ran them on Windows (my home machine) and I see 8 errors before and after the patch.

I've committed the fix to both master and cdt_8_0
Comment 4 CDT Genie CLA 2011-10-14 06:23:02 EDT
*** cdt git genie on behalf of Marc Khouzam ***

    Bug 360846: Extra space in build command

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=04d4f11b532a5fb10928f106ffad50da7514da15
Comment 5 CDT Genie CLA 2011-10-14 06:23:03 EDT
*** cdt git genie on behalf of Marc Khouzam ***

    Bug 360846: Extra space in build command

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=2f2955595596ceb8141f6c82653612f80c87525a
Comment 6 Andrew Gvozdev CLA 2011-10-14 09:39:09 EDT
(In reply to comment #3)
> (In reply to comment #2)
> For me to know for next time, can I run AllManagedBuildTests on Windows or on
> Linux?  I ran them on Windows (my home machine) and I see 8 errors before and
> after the patch.
They are supposed to pass both on Windows and Linux. I ran them on Linux a while ago, but Hudson does every night. I ran on Win XP and at first I had interference from our homegrown plugins, so I disabled them as target plugins in launch configuration. After that all passed.
What kind of errors are you having? If it is a mismatch in generated makefile it is best to check console output where the expected/actual line is printed.
Comment 7 Marc Khouzam CLA 2011-10-14 10:57:02 EDT
(In reply to comment #6)

> They are supposed to pass both on Windows and Linux. I ran them on Linux a
> while ago, but Hudson does every night. I ran on Win XP and at first I had
> interference from our homegrown plugins, so I disabled them as target plugins
> in launch configuration. After that all passed.

I just ran them on Linux and everything passed (119 tests).
On Windows 7, there was 120 tests (one more test... weird), and some of them failed.  But my setup on Windows is surely to blame as I almost never use it.