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

fix: sudosu not working on some BSD machines #8214

Merged
merged 8 commits into from
Jul 14, 2024

Conversation

lekoOwO
Copy link
Contributor

@lekoOwO lekoOwO commented Apr 11, 2024

SUMMARY

The original sudosu does not work on some BSD machines and some versions of linux machine as the argument of su differs .

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

become.sudosu

ADDITIONAL INFORMATION

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added become become plugin bug This issue/PR relates to a bug new_contributor Help guide this first time contributor plugins plugin (any type) small_patch Hopefully easy to review needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Apr 11, 2024
@lekoOwO
Copy link
Contributor Author

lekoOwO commented Apr 11, 2024

BTW, if /bin/sh is prefered, we should pass -s /bin/sh to su.

The original version passes /bin/sh without -s, thus on many su it does not work.

@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-7 backport-8 Automatically create a backport for the stable-8 branch labels Apr 11, 2024
@felixfontein
Copy link
Collaborator

Thanks for your contribution! Please note that you need to add a changelog fragment, and that the unit tests are failing (https://github.com/ansible-collections/community.general/blob/main/tests/unit/plugins/become/test_sudosu.py).

Also it seems to me that this is potentially a larger change that might break some use-cases on other systems. I'm wondering whether the switch between the current and the new behavior should maybe be controlled by a toggle?

(The /bin/sh comes from the currently selected shell plugin, so hardcoding that is out of the question. That would break other mechanisms.)

@lekoOwO
Copy link
Contributor Author

lekoOwO commented Apr 16, 2024

ummmm the unit test is failing because it is asserting the original command which is not working on all system... Maybe we should change the unit test?

@lekoOwO
Copy link
Contributor Author

lekoOwO commented Apr 16, 2024

I'm wondering whether the switch between the current and the new behavior should maybe be controlled by a toggle?

That sounds good to me.

@ansibullbot ansibullbot added the stale_ci CI is older than 7 days, rerun before merging label Apr 24, 2024
@felixfontein felixfontein added backport-9 Automatically create a backport for the stable-9 branch and removed backport-7 labels May 19, 2024
@felixfontein
Copy link
Collaborator

Ping @lekoOwO

needs_info

@ansibullbot ansibullbot added the needs_info This issue requires further information. Please answer any outstanding questions label Jul 13, 2024
plugins/become/sudosu.py Outdated Show resolved Hide resolved
plugins/become/sudosu.py Show resolved Hide resolved
plugins/become/sudosu.py Outdated Show resolved Hide resolved
plugins/become/sudosu.py Outdated Show resolved Hide resolved
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added ci_verified Push fixes to PR branch to re-run CI and removed small_patch Hopefully easy to review stale_ci CI is older than 7 days, rerun before merging labels Jul 13, 2024
@ansibullbot ansibullbot removed the ci_verified Push fixes to PR branch to re-run CI label Jul 13, 2024
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added the ci_verified Push fixes to PR branch to re-run CI label Jul 13, 2024
@ansibullbot ansibullbot removed the ci_verified Push fixes to PR branch to re-run CI label Jul 13, 2024
@felixfontein
Copy link
Collaborator

If nobody objects, I'll merge this tomorrow.

@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Jul 13, 2024
@felixfontein felixfontein removed the backport-8 Automatically create a backport for the stable-8 branch label Jul 14, 2024
@felixfontein felixfontein merged commit 83318c3 into ansible-collections:main Jul 14, 2024
147 checks passed
Copy link

patchback bot commented Jul 14, 2024

Backport to stable-9: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-9/83318c36aaf3f0e88362ac9d8a8d5ba7a4bfead2/pr-8214

Backported as #8631

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Jul 14, 2024
patchback bot pushed a commit that referenced this pull request Jul 14, 2024
* fix: sudosu not working on some BSD machines

* fix: sudosu: added a flag (`alt_method`) to enhance compatibility with more versions of `su`

* Update changelogs/fragments/8214-sudosu-not-working-on-some-BSD-machines.yml

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/become/sudosu.py

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/become/sudosu.py

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/become/sudosu.py

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/become/sudosu.py

Co-authored-by: Felix Fontein <[email protected]>

* fix: sudosu: lint

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit 83318c3)
@felixfontein
Copy link
Collaborator

@lekoOwO thanks for your contribution!

felixfontein pushed a commit that referenced this pull request Jul 14, 2024
…e BSD machines (#8631)

fix: sudosu not working on some BSD machines (#8214)

* fix: sudosu not working on some BSD machines

* fix: sudosu: added a flag (`alt_method`) to enhance compatibility with more versions of `su`

* Update changelogs/fragments/8214-sudosu-not-working-on-some-BSD-machines.yml

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/become/sudosu.py

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/become/sudosu.py

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/become/sudosu.py

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/become/sudosu.py

Co-authored-by: Felix Fontein <[email protected]>

* fix: sudosu: lint

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit 83318c3)

Co-authored-by: leko <[email protected]>
aioue pushed a commit to aioue/community.general that referenced this pull request Oct 1, 2024
* fix: sudosu not working on some BSD machines

* fix: sudosu: added a flag (`alt_method`) to enhance compatibility with more versions of `su`

* Update changelogs/fragments/8214-sudosu-not-working-on-some-BSD-machines.yml

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/become/sudosu.py

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/become/sudosu.py

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/become/sudosu.py

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/become/sudosu.py

Co-authored-by: Felix Fontein <[email protected]>

* fix: sudosu: lint

---------

Co-authored-by: Felix Fontein <[email protected]>
TobiasZeuch181 pushed a commit to TobiasZeuch181/zypper_repository_add_list that referenced this pull request Oct 2, 2024
* fix: sudosu not working on some BSD machines

* fix: sudosu: added a flag (`alt_method`) to enhance compatibility with more versions of `su`

* Update changelogs/fragments/8214-sudosu-not-working-on-some-BSD-machines.yml

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/become/sudosu.py

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/become/sudosu.py

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/become/sudosu.py

Co-authored-by: Felix Fontein <[email protected]>

* Update plugins/become/sudosu.py

Co-authored-by: Felix Fontein <[email protected]>

* fix: sudosu: lint

---------

Co-authored-by: Felix Fontein <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-9 Automatically create a backport for the stable-9 branch become become plugin bug This issue/PR relates to a bug needs_info This issue requires further information. Please answer any outstanding questions new_contributor Help guide this first time contributor plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants