Lyx does not preserve DOS/Unix line endings

Bug #1003419 reported by Remi Meier
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
lyx (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I am working on a lyx document together with people that use Windows. Every time I save the document, all line endings get converted to \n (LF). Every time someone on Windows saves the document, all line endings get converted to \r\n (CR+LF).

The document is versioned using SVN which now will show every line as changed in "svn diff". This is unacceptable when merging changes from other people and I always have to use the tool "unix2dos" before committing, so that the diffs look reasonable.

What I expected to happen:
If opened document uses LF to end lines, save document using LF to end lines.
If opened document uses CR+LF to end lines, save document using CR+LF to end lines.
Like most text editors.

What happened instead:
LyX converts the line endings to the format "native" to the platform it is running on.

LyX Version:
This affects all versions prior to and including LyX 2.0.2.

Ubuntu Version:
Description: Ubuntu 12.04 LTS
Release: 12.04

Revision history for this message
Jean-Marc Lasgouttes (jmarc) wrote :

The correct solution to this problem is to use
  svn propset svn:eol native <myfile.lyx>

This way windows users will see a file with CR+LF, and unix users will see plain LF.

I agree that LyX could implement what you describe, but that would be a problem for (say windows) users who use an editor (say notepad) which does not honor LF end of lines. It is precisely for these admittedly naive users that we should make as unsurprising as possible. Especially since svn does all the work.

JMarc (LyX developer)

Revision history for this message
Remi Meier (remi-meier) wrote :

Thanks, that works for me.

But I am not sure your argument holds.

Firstly, IMO a .lyx file is a machine controlled file format which should probably not be edited by hand. At least that is what I think naive users should never do. But it is diff/merge friendly, except for the line endings.

Secondly, _if_ a user is comfortable with opening and changing the file with text editors, I as a user expect the text editor to not change the line endings again. So LyX probably should not either.

Thirdly, if I save the document now under Linux, my Windows users still have problems with Notepad. Conversely if LyX would preserve the line endings (or make it an option), then a document _created_ on Windows would choose CR+LF as default for this document. Therefore even when Linux users work with it, it would stay editable in Notepad.

I would rate the current behaviour as worse than having a per document setting for line endings that defaults to the native line ending format. But you showed me a working solution, so I wont complain anymore :)

Thank you for your time and your help!

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in lyx (Ubuntu):
status: New → Confirmed
Revision history for this message
Scott Kostyshak (scott-kostyshak) wrote :

In my opinion, this bug should be closed. There is a known solution and the enhancement request was marked as 'wontfix' in LyX:
http://www.lyx.org/trac/ticket/8676

Revision history for this message
rodrigob (rodrigo-benenson) wrote :

Just go bet by this issue too.
Using https://bitbucket.org for version control management, and it was not happy with the line ending changes.
Had to do manual convertion, and might have to do everytime window uses commit...

Revision history for this message
Scott Kostyshak (scott-kostyshak) wrote :

This bug should be closed.

Juhani Numminen (jsonic)
Changed in lyx (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.