New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file.line in python3 on windows 2012 r2 is adding extra CR line endings. #48557

Closed
whytewolf opened this Issue Jul 12, 2018 · 6 comments

Comments

@whytewolf
Contributor

whytewolf commented Jul 12, 2018

Description of Issue/Question

Using file.line to insert a line. The resulting file is transformed to have <CR><CRLF> inserted on all lines, not just the lines edited.

Setup

c:\conf\vars.xml with dos line endings

test1<crlf>
test2<crlf>
test3<crlf>

test3.sls

{% if salt.match.grain('os:windows') %}
{% set conffile = 'C:/conf/vars.xml' %}
{% else %}
{% set conffile = '/tmp/vars.xml' %}
{% endif%}
{% set confline_regex = 'test2' %}
{% set confline_new = 'test_test' %}

# Add line IPv4 configuration line
remove_conf_line:
 file.line:
  - name: '{{ conffile }}'
  - after: test2
  - mode: insert
  - content: test4

resulting file

test1<cr>
<crlf>
test2<cr>
<crlf>
test4<cr>
<crlf>
test3<cr>
<crlf>

Steps to Reproduce Issue

Use the above states and files on windows 2012 r2 with python3 2018.3.2
Also tried the line ending fix in #48503 which did not change the issue.

Versions Report

winion-0:
    Salt Version:
               Salt: 2018.3.2

    Dependency Versions:
               cffi: 1.10.0
           cherrypy: 10.2.1
           dateutil: 2.6.1
          docker-py: Not Installed
              gitdb: 2.0.3
          gitpython: 2.1.3
              ioflo: Not Installed
             Jinja2: 2.9.6
            libgit2: Not Installed
            libnacl: Not Installed
           M2Crypto: Not Installed
               Mako: 1.0.6
       msgpack-pure: Not Installed
     msgpack-python: 0.4.8
       mysql-python: Not Installed
          pycparser: 2.17
           pycrypto: 2.6.1
       pycryptodome: Not Installed
             pygit2: Not Installed
             Python: 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AMD64)]
       python-gnupg: 0.4.1
             PyYAML: 3.12
              PyZMQ: 16.0.3
               RAET: Not Installed
              smmap: 2.0.3
            timelib: 0.2.4
            Tornado: 4.5.1
                ZMQ: 4.1.6

    System Versions:
               dist:
             locale: cp1252
            machine: AMD64
            release: 2012ServerR2
             system: Windows
            version: 2012ServerR2 6.3.9600 SP0 Multiprocessor Free

@whytewolf whytewolf added the ZD label Jul 12, 2018

@whytewolf

This comment has been minimized.

Contributor

whytewolf commented Jul 12, 2018

ZD-2682

@Ch3LL

This comment has been minimized.

Contributor

Ch3LL commented Jul 13, 2018

ping @saltstack/team-windows any ideas here?

@Ch3LL Ch3LL added this to the Blocked milestone Jul 13, 2018

@damon-atkins

This comment has been minimized.

Member

damon-atkins commented Jul 13, 2018

@dwoz dwoz self-assigned this Jul 13, 2018

@dwoz

This comment has been minimized.

Contributor

dwoz commented Jul 13, 2018

@Ch3LL @whytewolf this should be easy enough to reproduce. I've assigned it to myself.

@rallytime

This comment has been minimized.

Contributor

rallytime commented Jul 20, 2018

@dwoz Let's get this fixed for 2018.3.3

@rallytime

This comment has been minimized.

Contributor

rallytime commented Aug 13, 2018

Fixed with #49026

@rallytime rallytime closed this Aug 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment