cli: error/warn when using sudo
Metadata
Current evaluation
Merged PR #3150 into master. Adds CLI checks to error on sudo for LXD, Multipass, and remote-build, while warning host and destructive-mode users. Updates spread tests to prevent permission errors.
Suggested action: —
No scores available.
Issue body
Sentry is filled with bug reports resulting from permission
errors due to mixed usage of sudo in different environments.
By checking for use of sudo, we can prevent most of these
errors from occurring.
- For lxd, multipass & remote-build users, exit with an error
if user is using sudo.
- For host (destructive-mode) users, warn if sudo is detected,
suggesting that the user also use sudo when cleaning.
Update spread tests to use `env -i` when using sudo.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged PR #3150 into master. Adds CLI checks to error on sudo for LXD, Multipass, and remote-build, while warning host and destructive-mode users. Updates spread tests to prevent permission errors. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into master. Implements CLI checks to error out for LXD, Multipass, and remote-build, and warn for host mode when sudo is detected, preventing permission errors. Updated spread tests to use env -i. Code coverage increased by 0.00%. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into master. Adds CLI checks to error on sudo usage for lxd, multipass, and remote-build, while warning host mode users. Prevents permission errors from mixed sudo environments and updates spread tests. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3240 cli: only issue warning when checking for usage of sudo | snapcraft | merged | Merged a maintainer pull request that updates the CLI to only issue a warning when checking for sudo usage. Approved by one reviewer, the change modifies four files and reduces the codebase by 38 lines. | |
| #3275 cli: ignore sudo warning when using multipass | snapcraft | merged | Merged a pull request that updates the CLI to ignore sudo warnings when using multipass. The change (+8/-2 lines in one file) was approved by one reviewer, passed CI checks, and successfully integrated into the main branch. |