Skip to content
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

reading binary profile data on windows #1906

Merged
merged 1 commit into from
Jun 8, 2017
Merged

Conversation

arlimus
Copy link
Contributor

@arlimus arlimus commented Jun 8, 2017

On Windows, we ran into the problem that the execution of inherited profiles would (sometimes) not work. This was due to the use of File.read and File.write and handling inside the file provider, which works in most cases (especially *nix systems), but does not behave as expected on Windows. A better and more correct way of treating these files is via binary read and write mode, which changes the underlying encoding of both strings that are passed along.

Signed-off-by: Dominik Richter dominik.richter@gmail.com

@arlimus arlimus added Type: Bug Feature not working as expected in progress labels Jun 8, 2017
@arlimus arlimus force-pushed the dr/windows-binary-io branch from d375fdc to 962654c Compare June 8, 2017 07:01
@arlimus
Copy link
Contributor Author

arlimus commented Jun 8, 2017

@chris-rock this is the one you have been hunting for 😁
i got one more...

arlimus added a commit that referenced this pull request Jun 8, 2017
On Windows, `inspec archive` would sometimes produce incorrect archive files. These would look fine, as tgz files, but would not execute correctly. This would lead to bewildering error messages like this one:

```
Unable to parse inspec.yml: line 1, control characters are not allowed
```

Fix it by treating the files as binary before writing them to get around any encoding issues, since the stream handler is a raw io object anyway.

Closely related to #1906
arlimus added a commit that referenced this pull request Jun 8, 2017
On Windows, `inspec archive` would sometimes produce incorrect archive files. These would look fine, as tgz files, but would not execute correctly. This would lead to bewildering error messages like this one:

```
Unable to parse inspec.yml: line 1, control characters are not allowed
```

Fix it by treating the files as binary before writing them to get around any encoding issues, since the stream handler is a raw io object anyway.

Closely related to #1906
arlimus added a commit that referenced this pull request Jun 8, 2017
On Windows, `inspec archive` would sometimes produce incorrect archive files. These would look fine, as tgz files, but would not execute correctly. This would lead to bewildering error messages like this one:

```
Unable to parse inspec.yml: line 1, control characters are not allowed
```

Fix it by treating the files as binary before writing them to get around any encoding issues, since the stream handler is a raw io object anyway.

Closely related to #1906

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
Copy link
Contributor

@chris-rock chris-rock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arlimus Great finding! Thank you!

On Windows, we ran into the problem that the execution of inherited profiles would (sometimes) not work. This was due to the use of `File.read` and `File.write` and handling inside the file provider, which works in most cases (especially *nix systems), but does not behave as expected on Windows. A better and more correct way of treating these files is via binary read and write mode, which changes the underlying encoding of both strings that are passed along.

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
@chris-rock chris-rock force-pushed the dr/windows-binary-io branch from 962654c to a8dd4d0 Compare June 8, 2017 08:11
@chris-rock chris-rock merged commit ffdce8a into master Jun 8, 2017
@chris-rock chris-rock deleted the dr/windows-binary-io branch June 8, 2017 08:19
chris-rock pushed a commit that referenced this pull request Jun 8, 2017
On Windows, `inspec archive` would sometimes produce incorrect archive files. These would look fine, as tgz files, but would not execute correctly. This would lead to bewildering error messages like this one:

```
Unable to parse inspec.yml: line 1, control characters are not allowed
```

Fix it by treating the files as binary before writing them to get around any encoding issues, since the stream handler is a raw io object anyway.

Closely related to #1906

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
@adamleff adamleff changed the title bugfix: reading binary profile data on windows reading binary profile data on windows Jun 8, 2017
aaronlippold pushed a commit to aaronlippold/inspec that referenced this pull request Jun 8, 2017
On Windows, we ran into the problem that the execution of inherited profiles would (sometimes) not work. This was due to the use of `File.read` and `File.write` and handling inside the file provider, which works in most cases (especially *nix systems), but does not behave as expected on Windows. A better and more correct way of treating these files is via binary read and write mode, which changes the underlying encoding of both strings that are passed along.

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
aaronlippold pushed a commit to aaronlippold/inspec that referenced this pull request Jun 8, 2017
On Windows, `inspec archive` would sometimes produce incorrect archive files. These would look fine, as tgz files, but would not execute correctly. This would lead to bewildering error messages like this one:

```
Unable to parse inspec.yml: line 1, control characters are not allowed
```

Fix it by treating the files as binary before writing them to get around any encoding issues, since the stream handler is a raw io object anyway.

Closely related to inspec#1906

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
@arlimus
Copy link
Contributor Author

arlimus commented Jun 20, 2017

Likely caused: #1790

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Feature not working as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants