cuisine icon indicating copy to clipboard operation
cuisine copied to clipboard

file_read returns text with WINDOWS_EOL on UNIX_EOL files?

Open eykd opened this issue 13 years ago • 2 comments

In using file_update in concert with text_ensure_lines, I find that my remote files are being converted from unix-style \n to windows-style \r\n. I see nothing obviously wrong with the code of any of the involved functions, and yet this is the behavior I'm consistently observing (using emacs to detect the EOL-style).

Of course, you can imagine the havoc this creates when encountered by BASH (and its rather fragile grasp on the reality). :)

This one frankly makes absolutely no sense to me. I hope it makes sense to you.

eykd avatar Oct 16 '11 20:10 eykd

Looking at it, the results of file_read() have the \r\n in them (and with emacs I can confirm that the target file uses unix newlines), so this is before text_detect_eol. Would this be a problem with fabric? Is it something in python's universal newline handling? What the heck?

eykd avatar Oct 16 '11 20:10 eykd

Hmm, that's really weird. You could try to implement a test case in "tests/all.py", as the test module does not use Fabric, so it would be easy to spot where it comes from.

Also, if you could share a simple test case using Fabric, I'd be happy to test it and help debug it.

sebastien avatar Oct 17 '11 21:10 sebastien