TurboPack / SynEdit

SynEdit is a syntax highlighting edit control, not based on the Windows common controls.
216 stars 72 forks source link

LF Line Endings in the .DPKs Cause File Corruption #256

Open mbaelive opened 2 months ago

mbaelive commented 2 months ago

The .DPK for Delphi 12 has LF line endings. Delphi does not support LF line endings in the .DPK. This will cause Delphi to corrupt the .DPK with a mix of LF and CRLF line endings when the project options are edited. "Requires", "contains", and "end." will also be changed to "rrequires", "ocontains", and "d.".

This is also affecting the packages on GetIt.

See Delphi issue RSS-427 for more information: https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-427

To fix this issue the .DPKs must have CRLF line endings. You need to have a .gitattributes file in your repository to prevent git from converting line endings. A .gitattributes file which contains:

* -text

Will turn off end of line conversion for all files. What goes into the repo will be what comes out.

Git documentation: https://git-scm.com/docs/gitattributes GitHub documentation: https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings

mbaelive commented 2 months ago

For an example of .gitattributes use see: https://github.com/Embarcadero/RADStudio12Demos

mbaelive commented 2 months ago

Despite the 19th of April, 2024 update to the SynEdit 2024.02 package on GetIt it still doesn't install properly via GetIt.

It's because the .gitattributes file is not yet in the SynEdit repository to turn off line ending conversion for Delphi project files and .dpks to keep them as CRLF line ended files.

For practical purposes CRLF line endings are simply part of the .DPK file format. There's no scenario (in repo, out of repo, cloned via git, downloaded as a zip, downloaded as a single file) in which it is valid for the .DPK to have LF line endings. The .dpk must always have CRLF line endings in all scenarios and all git configurations.

The AsyncPro 2024.02 and VirtualTree 2024.02 packages both now install properly via GetIt.

mbaelive commented 2 months ago

I tried the 24/04/2024 build of the SynEdit 2024.02 GetIt package but it didn't work for me.

The new .gitattributes file is there but the .dpks and project files need to be pushed to the repo with CRLF line endings.

romankassebaum commented 2 months ago

I just converted the .dpk files to LF and back to CRLF. I hope this helps.