Bug 215224 - [relengtool] 'Fix Copyright' produces mixed line delimiters
Summary: [relengtool] 'Fix Copyright' produces mixed line delimiters
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Releng (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P2 critical (vote)
Target Milestone: 4.3 M1   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-14 10:38 EST by Gunnar Wagenknecht CLA
Modified: 2012-06-25 04:50 EDT (History)
8 users (show)

See Also:


Attachments
patch to fix inconsistent line endings (1.68 KB, patch)
2008-01-14 10:38 EST, Gunnar Wagenknecht CLA
daniel_megert: review-
Details | Diff
patch to fix inconsistent line endings plus support for xml files (12.50 KB, patch)
2008-02-07 05:24 EST, Gunnar Wagenknecht CLA
daniel_megert: review-
Details | Diff
Fix (10.67 KB, patch)
2012-05-31 07:15 EDT, Dani Megert CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gunnar Wagenknecht CLA 2008-01-14 10:38:35 EST
Created attachment 86834 [details]
patch to fix inconsistent line endings

The using Advanced Fix Copyright on Windows with Subversion it's impossible to commit any touched files afterwards because of inconsistent line endings in the file. 

I found the problem in the "empty lines" which will print out a hard coded '\n' instead of the current system line ending. The attached patch fixes the problem.
Comment 1 Gunnar Wagenknecht CLA 2008-01-14 10:41:11 EST
Note, the patch also sets the adaptable="true" flag in plugin.xml to make the action appear in other views too.
Comment 2 Gunnar Wagenknecht CLA 2008-02-07 05:24:54 EST
Created attachment 89116 [details]
patch to fix inconsistent line endings plus support for xml files

This is a second version of the patch which also adds support for XML files.
Comment 3 Markus Keller CLA 2008-12-31 09:35:39 EST
Is this a dup of bug 140936?
Comment 4 Dani Megert CLA 2011-05-05 07:29:03 EDT
Bumping severity. The XML files with corrupted line delimiters cause CHKPII errors.
Comment 5 Dani Megert CLA 2011-05-05 07:31:21 EDT
See also bug 215224.
Comment 6 Dani Megert CLA 2011-05-05 08:46:10 EDT
(In reply to comment #5)
> See also bug 215224.
See also bug 276257.
Comment 7 Dani Megert CLA 2011-05-30 04:08:45 EDT
This is a critical bug as it mangles the files.
Comment 8 David Williams CLA 2012-05-06 21:29:17 EDT
Is this for subversion only? 

Sorry I've not noticed it earlier. 

And hate to ask you to do more work ... but .... any chance this was fixed by changes made for bug 345669? 

Tomasz, since you've been in this code lately, can you please assess?
Comment 9 Tomasz Zarna CLA 2012-05-07 04:50:18 EDT
(In reply to comment #8)
> And hate to ask you to do more work ... but .... any chance this was fixed by
> changes made for bug 345669?

Sorry, not a chance, a CopyrightAdapter is used only for retrieving last modified year for a file. There is no code for updating the file in the adapter. It's done in the SourceFile [1] class.

> Tomasz, since you've been in this code lately, can you please assess?

I'll try to look at it if I get some free cycles. If I understood the result of bug 276257 support for fixing copyrights in XML files has been disabled.

[1] org.eclipse.releng.tools.SourceFile.replace(BlockComment, String)
Comment 10 Tomasz Zarna CLA 2012-05-16 10:11:59 EDT
Sorry, I won't have time to look at it in the nearest future. I'm returning the bug to inbox to make the situation clear.
Comment 11 Dani Megert CLA 2012-05-31 05:07:48 EDT
The tool still messes up the line delimiters, especially in cases where the copyright is newly inserted. Both attached patches won't help, because they use println(), which inserts the line delimiter on which the tool is run, instead of the line delimiter that is currently used in the file.

I'll fix the line delimiter issue and opened new bug 381147 for the missing XML support.
Comment 12 Dani Megert CLA 2012-05-31 07:15:40 EDT
Created attachment 216562 [details]
Fix
Comment 13 Dani Megert CLA 2012-05-31 07:17:00 EDT
Note: this does *not* fix line delimiter issues for XML files. This is treated in bug 276257.