0

I have a cookbook that delivers a number of bash shell scripts as cookbook_file resources. For some reason when I run chef-client, the bash shell scripts will suddenly gain a carriage return as the very last character. On my windows box, the shell scripts have Linux style line endings and the .gitattributes file contains an entry that indicates that .sh files should upload/download with Linux style line endings.

I have confirmed that this unwanted carriage return character arrives sometime between "berks upload" and "chef-client".

Ultimately this prevents bash from executing the bash scripts.

How do I prevent this from happening?

1 Answer 1

0

It appears that Chef acknowledges that it's pretty terrible in dealing with line endings and provides no means to specify what to do with them[1].

To work around it, exit statements followed by a new line has been added to all of the bash scripts in the cookbook. This allows the script to exit before bash runs into the bad character.

[1] https://github.com/chef/chef/issues/4662

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .