Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
file.line on windows not treating unix line endings correctly. #48110
Description of Issue/Question
On windows when using
A simple file to change
a simple state.
Steps to Reproduce Issue
(Include debug logs if possible and relevant.)
Unix line ending version
Dos line endings in c:\test\test.txt
This only affects windows minions. Linux minions can handle the file with either line ending.
text mode, the default when reading is to convert platform-specific line endings (\n on Unix, \r\n on Windows) to just \n.
I would assume about would add platform-specific line endings
_get_eol will never see the line endings unless the file is open in binary mode. From what I can tell its open in text mode on Unix and Windows PY2 Binary, Windows PY3 Text.
I have made a few comments about Text Process in a few PR/Issues. Can we start a Discuss PR about what the requirements are and the assumptions. For example py3 introduced a newline option, which is also in PY2 io.open
newline controls how universal newlines works (it only applies to text mode). It can be None, '', '\n', '\r', and '\r\n'. It works as follows:
Also atomic_open is used which calls
After much testing, I have not been able to get this to work on any version of salt under windows. As @damon-atkins says this could be a python issue at the core. Is there any way within python standards to handle this on windows as it is handled in Linux?
Sorry having trouble testing this fix. Apparently, I can't just drop it into
Will try again. just thought I would note to let you know this is on my radar.