Created attachment 194220 [details] v1 In b3c1be27fb the lines were stripped of their ending \n, but the \n was never added back to the lines, so calling writelines generates a broken one line file.
This patch is addressed in the 2018.3.1 upgrade patch over here: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229012
fix has been merged upstream (already present in current port) https://github.com/saltstack/salt/commit/56c87ff6900bde45f01966b61fb87c665f4505f8#diff-3b24aaef4af6bf0d0d3023669f16a870 https://github.com/saltstack/salt/pull/48087