Bug 278026 - Managed build doesn't work for *.s assembler files
Summary: Managed build doesn't work for *.s assembler files
Status: RESOLVED DUPLICATE of bug 105022
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build-managed (show other bugs)
Version: 0 DD 1.1   Edit
Hardware: PC Windows XP
: P3 normal with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Chris Recoskie CLA
URL:
Whiteboard:
Keywords:
: 313350 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-05-27 07:42 EDT by Alexey Krivoborodov CLA
Modified: 2010-05-18 11:34 EDT (History)
5 users (show)

See Also:


Attachments
Simple fix (773 bytes, patch)
2010-04-07 20:07 EDT, Dave Korn CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Krivoborodov CLA 2009-05-27 07:42:50 EDT
Build ID: I20090522-1710

Steps To Reproduce:
1. Eclipse: 3.5 RC2, CDT: I200905220803 (RC2)
2. Create a managed build C++ project
3. Add an assembler file test.s with the lower case ending .s to the project
4. "Build selected files" from the context menu of test.s is disabled

More information:
Managed build works fine for *.S assembler files (upper case ending .S). The entry "*.S = Assembly source file" is locked on the preference page "C/C++ File Types". It isn't possible to add a second entry "*.s = Assembly source file".
Comment 1 fizul CLA 2009-09-07 22:11:07 EDT
I see the same behavior in Ganymede as well. But the difference is, in Ganymede it accepts *.s and doesnot recognise *.S assembly file. *.s is in preference page and it is not possible to add *.S entry.

--fizul

(In reply to comment #0)
> Build ID: I20090522-1710
> 
> Steps To Reproduce:
> 1. Eclipse: 3.5 RC2, CDT: I200905220803 (RC2)
> 2. Create a managed build C++ project
> 3. Add an assembler file test.s with the lower case ending .s to the project
> 4. "Build selected files" from the context menu of test.s is disabled
> 
> More information:
> Managed build works fine for *.S assembler files (upper case ending .S). The
> entry "*.S = Assembly source file" is locked on the preference page "C/C++ File
> Types". It isn't possible to add a second entry "*.s = Assembly source file".
Comment 2 Alexey Krivoborodov CLA 2009-09-15 03:46:30 EDT
In the meantime I found a workaround for the problem: Project Properties -> C/C++ General -> File Types -> Use project settings -> New -> Pattern: *.s, Type: Assembly Source File -> OK

alex
Comment 3 Harald CLA 2010-03-23 11:40:37 EDT
(In reply to comment #1)
> I see the same behavior in Ganymede as well. But the difference is, in Ganymede
> it accepts *.s and doesnot recognise *.S assembly file. *.s is in preference
> page and it is not possible to add *.S entry.
> 
> --fizul

In my CDT 6.0 (Galileo on MS Windows) it switches over to accepts not *.s and recognise *.S assembly files. Not good.

But I think it's an plattform fault, since in org.eclipse.cdt.core (5.1.1.200909110608) the content-type contribution looks fine:
base-type = org.eclipse.core.runtime.text
file-extensions = S,s,asm,ASM
id = asmSource
name = Assembly Source File
priority = high

Can someone assign this bug to the plattform?

--Harald
Comment 4 Dave Korn CLA 2010-03-31 18:38:26 EDT
org.eclipse.core.internal.content.FileSpec:

	public boolean equals(final String text, final int otherType, final boolean strict) {
		return ((!strict && getBasicType(type) == getBasicType(otherType)) || type == otherType) && this.text.equalsIgnoreCase(text);
	}

This is used by org.eclipse.core.internal.content.ContentType.hasFileSpec() for matching to avoid duplicates when org.eclipse.core.internal.content.ContentType.internalAddFileSpec() is adding file extensions, and that means that, when all the extension specs are being added to the content type at startup time, as from the list you mentioned:

> file-extensions = S,s,asm,ASM 

the first "S" is accepted, the second "s" discarded as a duplicate; likewise for the "asm", and "ASM" probably doesn't work for you either.  The result is that the asmSource ContentType only ends up with two file extensions.  The underlying bug then is that FileSpec.equals is case insensitive, but the rest of the world expects file extensions (as represented by FileSpecs) to be case-sensitive.

Here's a traceback of the stack at the time when it decides that "s" and "S" are duplicates and not to add the second one:

Thread [Thread-2] (Suspended)	
	ContentType.hasFileSpec(String, int, boolean) line: 388	
	ContentType.internalAddFileSpec(String, int) line: 406	
	ContentType.createContentType(ContentTypeCatalog, String, String, byte, String[], String[], String, String, Map, IConfigurationElement) line: 96	
	ContentTypeBuilder.createContentType(IConfigurationElement) line: 170	
	ContentTypeBuilder.registerContentType(IConfigurationElement) line: 211	
	ContentTypeBuilder.buildCatalog() line: 90	
	ContentTypeManager.getCatalog() line: 123	
	ContentTypeManager.getContentType(String) line: 134	
	EditorRegistry.addEditorFromPlugin(EditorDescriptor, List, List, List, boolean) line: 251	
	EditorRegistryReader.readElement(IConfigurationElement) line: 108	
	EditorRegistryReader(RegistryReader).readElements(IConfigurationElement[]) line: 144	
	EditorRegistryReader(RegistryReader).readExtension(IExtension) line: 155	
	EditorRegistryReader(RegistryReader).readRegistry(IExtensionRegistry, String, String) line: 176	
	EditorRegistryReader.addEditors(EditorRegistry) line: 42	
	EditorRegistry.initializeFromStorage() line: 565	
	EditorRegistry.<init>() line: 164	
	WorkbenchPlugin.getEditorRegistry() line: 454	
	EditorReference.getDescriptor(String) line: 225	
	EditorReference.<init>(EditorManager, IMemento) line: 190	
	EditorManager.restoreEditorState(IMemento, ArrayList, IEditorReference[], MultiStatus) line: 1486	
	EditorManager.restoreState(IMemento) line: 928	
	WorkbenchPage.restoreState(IMemento, IPerspectiveDescriptor) line: 3174	
	WorkbenchWindow.restoreState(IMemento, IPerspectiveDescriptor) line: 2219	
	Workbench.doRestoreState(IMemento, MultiStatus) line: 3399	
	Workbench.access$30(Workbench, IMemento, MultiStatus) line: 3341	
	Workbench$54.run() line: 2117	
	Workbench.runStartupWithProgress(int, Runnable) line: 1831	
	Workbench.restoreState(IMemento) line: 2115	
	Workbench.access$28(Workbench, IMemento) line: 2086	
	Workbench$49.run() line: 1949	
	SafeRunner.run(ISafeRunnable) line: 42	
	Workbench.restoreState() line: 1893	
	WorkbenchConfigurer.restoreState() line: 183	
	WorkbenchAdvisor$1.run() line: 781	

I'm gonna try making that comparison in FileSpec.equals case-sensitive and see how much of the world breaks.
Comment 5 Dave Korn CLA 2010-04-07 20:07:46 EDT
Created attachment 164154 [details]
Simple fix

Works for me.  Haven't spotted any side-effects so far.
Comment 6 Andrew Gvozdev CLA 2010-04-08 10:51:39 EDT
This appears to be a platform issue and actualy a duplicate of bug 105022. Could be worth to attach the patch there. Thanks for looking at it.

*** This bug has been marked as a duplicate of bug 105022 ***
Comment 7 Andrew Gvozdev CLA 2010-05-18 11:34:56 EDT
*** Bug 313350 has been marked as a duplicate of this bug. ***