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

Bug 325302

Summary: Branding of MacOS eclipse.ini fails on case insensitive filesystem (Windows)
Product: z_Archived Reporter: Michal Ruzicka <michal.ruza>
Component: BuckminsterAssignee: buckminster.core-inbox <buckminster.core-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: a.wehner, philippn, thomas
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
org.eclipse.buckminster.pde-ini_branding.patch none

Description Michal Ruzicka CLA 2010-09-14 20:23:00 EDT
The following code in org.eclipse.buckminster.pde.tasks.BrandingIron.copyMacIni() does not consider case insensitive filesystems:

File ini = getCanonicalFile(new File(initialRoot, "/MacOS/eclipse.ini"));
File ini2 = getCanonicalFile(new File(initialRoot, "/MacOS/Eclipse.ini"));

...

if (ini.exists()) {
	if (ini2.exists()) {
		logger.warning("Found both %s and %s. Discarding the latter", ini.getAbsolutePath(), ini2.getAbsolutePath()); //$NON-NLS-1$
		ini2.delete(); // This should not happen really
	}
} else if (ini2.exists()) {
	ini = ini2;
} else
	return;

...

StringBuffer buffer;
try {
	buffer = readFile(ini);
} catch (IOException e) {
	logger.error(e, "Impossible to brand ini file"); //$NON-NLS-1$
	return;
}

When the MacOS/eclipse.ini file happens to exist in a case insensitive filesystem then both the warning and the error message from the above code excerpt are printed.
The reason is that ini and ini2 files are in fact identical on a case insensitive filesystem, so if ini exists then ini2 must exists too (as it is the same file). The code above misinterprets this and reacts with deletion of the ini2 file (and thus whit deletion of ini). Which is later manifested by the error message when an attempt is made to read the deleted ini file.
Comment 1 Michal Ruzicka CLA 2010-09-14 21:20:00 EDT
Created attachment 178892 [details]
org.eclipse.buckminster.pde-ini_branding.patch

The attached trivial patch should resolve the issue.
Comment 2 Thomas Hallgren CLA 2010-09-15 01:28:31 EDT
Patch looks good. Please commit to helios-maintenance branch.
Comment 3 Michal Ruzicka CLA 2010-09-15 13:15:04 EDT
patch committed to the helios-maintenance branch in revision 11581
Comment 4 Philipp Nanz CLA 2010-09-18 08:13:17 EDT
*** Bug 325674 has been marked as a duplicate of this bug. ***