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

[master] Convert stdin string to bytes regardless of stdin_raw_newlines #66830

Conversation

niklasr22
Copy link

@niklasr22 niklasr22 commented Aug 24, 2024

What does this PR do?

What issues does this PR fix or reference?

Fixes issue #62501

Previous Behavior

The following error was thrown when running cmd.run with a str passed via stdin and stdin_raw_newlines=True

Passed invalid arguments to cmd.run: memoryview: a bytes-like object is required, not 'str'

New Behavior

String also gets converted to bytes when stdin_raw_newlines=True, so no error is thrown

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes

Please review Salt's Contributing Guide for best practices, including the
PR Guidelines.

See GitHub's page on GPG signing for more information about signing commits with GPG.

@niklasr22 niklasr22 requested a review from a team as a code owner August 24, 2024 12:47
Copy link

welcome bot commented Aug 24, 2024

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at [email protected]. We’re glad you’ve joined our community and look forward to doing awesome things with you!

@salt-project-bot-prod-environment salt-project-bot-prod-environment bot changed the title Convert stdin string to bytes regardless of stdin_raw_newlines [master] Convert stdin string to bytes regardless of stdin_raw_newlines Aug 24, 2024
@niklasr22
Copy link
Author

Maybe the fix is also interesting for the 3006 LTS version?

@dmurphy18
Copy link
Contributor

@niklasr22 Fixing this on 3006.x branch will get a quicker release than master, also wondering if current test coverage is enough for this change, or does a new test need to be added to cover the code change.

@niklasr22
Copy link
Author

niklasr22 commented Aug 26, 2024

@dmurphy18 I opened another PR (#66840) using the 3006.x branch. I also extended an existing test of cmdmod, maybe not the perfect coverage, but better than nothing I guess.

@dwoz
Copy link
Contributor

dwoz commented Aug 28, 2024

This will get merged forward from 3006.x into master. See #66840

@dwoz dwoz closed this Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants