The problem demonstrated in #6065 is that a string has incorrectly been
encoded with US-ASCII even though it contains invalid US-ASCII byte
sequences (any byte with the most significant bit on is invalid in the
US-ASCII encoding).
The thing about doing newline normalization is that it is not actually
sensitive to the presence of US-ASCII byte sequenzes. Additionally, it
is very unlikely that a user will ever be using an encoding where \r\n
is not encoded the same as it would be in ASCII.
This patch first tries the existing method of normalizing the newlines
in the provided script file, if that fails for any reason it force
encodes the string to ASCII-8BIT (which allows the most significant bit
to be on in any individual byte) and then performs the substitution in
that byte space.
This allows the display of friendly output to the user when we think an
important action should be labeled a certain way. This makes vagrant
output a lot more useful when many inline shell provisioners are
present.
of `args` itself and as an element inside of an `args` array. Added validation
around passing in arrays for arguments. Just knowing that it is an array is not
enough, because arrays can contain any other type.
The logic change in 57d4775140 introduced
a bug where neither strings nor arrays provided as `args` for shell
provisioners would pass validation.
This fixes that problem along with a few extras:
- split out arg validation into a private method
- update comment describing valid args
- add a few unit tests around config validation
This commit contains two fixes:
- The Chef provisioner was incorrectly referencing config.ssh.username
instead of machine.ssh_info[:username]. With the new change to default
ssh configuration, if a user had not set config.ssh.username,
provisioning would fail.
- The shell provisioner was not appropriately changing permissions to
the upload path. If a different ssh user attempted to use a shell
provisioner, provisioning would fail. The same case applied to
the Chef provisioner -- while permissions were being reset, they
were not done recursively.