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

uninstall: use polkit on PermissionError #8846

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dabrain34
Copy link
Contributor

As for an install, the uninstall should be able
to use the polkit to gain privileges.

As for an install, the uninstall should be able
to use the polkit to gain privileges.
Copy link
Member

@xclaesse xclaesse left a comment

Choose a reason for hiding this comment

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

Small nitpicking, but other than that looks OK.

@@ -32,17 +40,26 @@ def do_uninstall(log: str) -> None:
print('Deleted:', fname)
successes += 1
except Exception as e:
print(f'Could not delete {fname}: {e}.')
failures += 1
if e.__class__ == PermissionError and shutil.which('pkexec') is not None and 'PKEXEC_UID' not in os.environ:
Copy link
Member

Choose a reason for hiding this comment

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

IMHO it's cleaner to have multiple except:

try:
  ...
except PermissionError:
  ...
except Exception as e:
  ...

@eli-schwartz
Copy link
Member

We already have #7345 asking for the install logic to stop using polkit/pkexec with the rationale "this is a bad idea and extremely disturbing".

Now we want to add more polkit/pkexec logic?

@xclaesse
Copy link
Member

xclaesse commented Jun 7, 2021

TBF, #7345 is just 1 person asking to stop using pkexec a year ago. Surely if it was serious issue a PR would have been submitted by now. Personally I think it makes sense to use pkexec, there are other CLI that does that like systemctl, so it's not totally surprising behaviour IMHO.

@xclaesse
Copy link
Member

xclaesse commented Jun 7, 2021

Also we can uninstall only via ninja ATM, so the rational from #3567 still apply to uninstall I think?

@eli-schwartz
Copy link
Member

It's not just one person, and no patch was submitted because it is a design issue, not a bugfix, so presumably people don't want to go to the effort of writing a patch if it's going to be rejected.

The rationale from #3567 explicitly does NOT apply. The install target depends on the "all" target and there was a concern that people would "accidentally touching a file before running sudo ninja install, causing the outputs to become owned by root".

This is NOT applicable to ninja uninstall, because it is a PHONY target with no dependencies and will never, ever, ever cause targets to be rebuilt as root.

@dabrain34
Copy link
Contributor Author

As we are still using the install with polkit, I assume we should be consistent and use polkit also to uninstall . I dont see any blocker or any security issue to not use it.

@rmader
Copy link

rmader commented Nov 23, 2024

I created #13948 now, copying the behavior of #11366

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.

4 participants