Bug 229272 - CDT build with a dollar ($) character in the filename causes "Illegal Group Reference".
Summary: CDT build with a dollar ($) character in the filename causes "Illegal Group R...
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 4.0.3   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 279630
  Show dependency tree
 
Reported: 2008-04-29 07:37 EDT by Paul Margetts CLA
Modified: 2020-09-04 15:17 EDT (History)
0 users

See Also:


Attachments
A screen image showing the Illegal Argument Exception in action. (241.92 KB, image/gif)
2008-04-29 07:37 EDT, Paul Margetts CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Margetts CLA 2008-04-29 07:37:52 EDT
Created attachment 97950 [details]
A screen image showing the Illegal Argument Exception in action.

Build ID: 200802251018

Steps To Reproduce:
1. In CDT, create a new 'C' project with any target which uses the internal builder.  I selected MinGW as the target and called the project "MinGWproject". 
2. Add a new file to the project containing a dollar.  I called mine "file$name.c".
3. Type a dummy "main" into the file and build it.  You should then see the following message in the console window:


**** Rebuild of configuration Debug for project MinGWproject ****

**** Internal Builder is used for build               ****
Build error
Illegal group reference



More information:
The problem occurs because "resolvePercent" in the file "BuildDescription.class" in "org.eclipse.cdt.managedbuilder.internal.buildmodel.builddescription" calls "replaceAll" with the file name as the second parameter.  

java.lang.String.replaceAll help says: Note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string; see Matcher.replaceAll. Use Matcher.quoteReplacement(java.lang.String) to suppress the special meaning of these characters, if desired. 

Suggested fix: use Matcher.quoteReplacement instead of replaceAll.