11.6.0 on Solaris and line feeds in files rendered from templates


#1

I tried using chef.11.6.0-1.solaris2.5.10.i386.solaris on Solaris 10 today, but
I found that when a template source file containing line feeds such as the
following:

domain <%= @domain %>^M
search <% @search_domains.each do |search_domain| -%><%= search_domain %> <%
end -%>^M
<% @nameservers.each do |nameserver| -%>^M
nameserver <%= nameserver %>^M
<% end -%>^M

The rendered file also has the line feeds:

domain xyz.com^M
search xyz.com ^M
nameserver 10.nnn.nn.nn^M

Such garbage in the rendered files causes the resolver to fail.

With 11.4, the rendered file is free of the line feeds and the resolver works
as expected.

Has anyone noticed this issue with 11.6 in general and/or specifically on
Solaris?

Is there a workaround? Or perhaps this is a case of garbage in and garbage
out? i.e. the behavior in 11.4 is masking the need for us to ensure that the
template files don’t have this style of new line?


#2

On Wednesday, August 21, 2013 at 8:58 PM, cpkampmeier@gmail.com wrote:

I tried using chef.11.6.0-1.solaris2.5.10.i386.solaris on Solaris 10 today, but
I found that when a template source file containing line feeds such as the
following:

domain <%= @domain %>^M
search <% @search_domains.each do |search_domain| -%><%= search_domain %> <%
end -%>^M
<% @nameservers.each do |nameserver| -%>^M
nameserver <%= nameserver %>^M
<% end -%>^M

The rendered file also has the line feeds:

domain xyz.com (http://xyz.com)^M
search xyz.com (http://xyz.com) ^M
nameserver 10.nnn.nn.nn^M

Such garbage in the rendered files causes the resolver to fail.

With 11.4, the rendered file is free of the line feeds and the resolver works
as expected.

Has anyone noticed this issue with 11.6 in general and/or specifically on
Solaris?

Is there a workaround? Or perhaps this is a case of garbage in and garbage
out? i.e. the behavior in 11.4 is masking the need for us to ensure that the
template files don’t have this style of new line?

This is intentional. 11.4 and earlier would always convert Windows-style newlines to Unix-style ones. You should take care to ensure that your templates have the correct line endings for the target systems you’re installing on.


Daniel DeLeo


#3

could be a new file meta parameter:
auto_newline false
:smiley:

Who likes to deal with CRLF issues…

On Aug 22, 2013, at 9:24 AM, Daniel DeLeo dan@kallistec.com wrote:

On Wednesday, August 21, 2013 at 8:58 PM, cpkampmeier@gmail.com wrote:

I tried using chef.11.6.0-1.solaris2.5.10.i386.solaris on Solaris 10 today, but
I found that when a template source file containing line feeds such as the
following:

domain <%= @domain %>^M
search <% @search_domains.each do |search_domain| -%><%= search_domain %> <%
end -%>^M
<% @nameservers.each do |nameserver| -%>^M
nameserver <%= nameserver %>^M
<% end -%>^M

The rendered file also has the line feeds:

domain xyz.com^M
search xyz.com ^M
nameserver 10.nnn.nn.nn^M

Such garbage in the rendered files causes the resolver to fail.

With 11.4, the rendered file is free of the line feeds and the resolver works
as expected.

Has anyone noticed this issue with 11.6 in general and/or specifically on
Solaris?

Is there a workaround? Or perhaps this is a case of garbage in and garbage
out? i.e. the behavior in 11.4 is masking the need for us to ensure that the
template files don’t have this style of new line?
This is intentional. 11.4 and earlier would always convert Windows-style newlines to Unix-style ones. You should take care to ensure that your templates have the correct line endings for the target systems you’re installing on.


Daniel DeLeo