cli: improve sudo detection with euid check for warnings/errors
Metadata
Current evaluation
Merged improvements to sudo detection that verify the effective user ID, preventing unnecessary warnings when switching users. Approved by a maintainer, passed CI, and updated 4 files.
Suggested action: —
No scores available.
Issue body
Some environments will `sudo` to another user. To avoid
unnecessary warnings/errors, additionally check that the
effective user is root.
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
- [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `./runtests.sh static`?
- [ ] Have you successfully run `./runtests.sh tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged improvements to sudo detection that verify the effective user ID, preventing unnecessary warnings when switching users. Approved by a maintainer, passed CI, and updated 4 files. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged a fix that improves sudo detection by checking the effective user ID is root, preventing unnecessary warnings and errors when sudo switches users. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged a fix that improves sudo detection by verifying the effective user ID is root, preventing unnecessary warnings or errors when environments use sudo to switch users. |
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. |