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

Bug 357048

Summary: 'Libraries' option UI does not handle paths with spaces correctly
Product: [Tools] CDT Reporter: Mario Pierro <mario.pierro>
Component: cdt-build-managedAssignee: Project Inbox <cdt-build-managed-inbox>
Status: NEW --- QA Contact: Jonah Graham <jonah>
Severity: normal    
Priority: P3 CC: cdtdoug
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on: 186069    
Bug Blocks:    

Description Mario Pierro CLA 2011-09-08 05:18:07 EDT
Build Identifier: Eclipse 20110615-0604, CDT 8.0.0.201106081058

I have noticed that adding a library to a project using the Paths and Symbols > Libraries tab > Add button will fail if the path contains spaces.

The problem seems to be that quotes are added to the library filename, which are subsequently doubled when the -l option is built and thus stripped from the actual command line.


Reproducible: Always

Steps to Reproduce:
1. Create a new C project using the MinGW GCC toolchain and the Hello World C template.

2. Add a library to the project using Project > Properties > C/C++ Build > C/C++ General > Paths and Symbols > Libraries > Add > File System, and browse to a library file containing a space in its path

3. Verify that the corresponding option Project > Properties > C/C++ Build > C/C++ General > MinGW C Linker > Libraries > Libraries now contains the library file with quotes around it

4. Build the project, and verify that build fails since the -l option is sent to gcc without quotes around the path

>> WORKAROUND

5. Edit the option in Project > Properties > C/C++ Build > C/C++ General > MinGW C Linker > Libraries > Libraries and _remove_ the quotes around the path

6. Verify that the project now builds correctly, since the library path is sent in the -l option
Comment 1 Mario Pierro CLA 2011-09-08 05:21:45 EDT
Note that this problem happens in all toolchains using an option with valueType="libs" . 

I think this has been around since CDT 6.
Comment 2 Andrew Gvozdev CLA 2011-09-08 09:17:28 EDT
Most likely the same root cause as for bug 186069.