Skip to content

/usr/local/bin/apt embeds a call to sudo #145

@jrw

Description

@jrw

System utility commands should never call sudo themselves (unless you've explicitly requested them to, for example, via a command option). For example, if I run mkdir /foo as a normal user, I expect to get a permission denied error, not for mkdir to magically call sudo on my behalf. However, that is what /usr/local/bin/apt does -- it calls sudo on my behalf. This is very unexpected and extremely surprising. Instead, apt should just fail with an error message, if it is run as a user without appropriate privileges.

Imagine my surprise when I ran apt install PACKAGE (instead of sudo apt install PACKAGE) as a normal user and found that it went ahead and installed the package into my root file system! I was shocked and concerned that I might have broken my OS. Luckily, my OS was OK, but I had to spend the next hour trying to figure out how that could have happened.

Please remove the call to sudo from the /usr/local/bin/apt python script. Instead, just let the command fail with the appropriate error message and optionally give a reminder that apt install needs to run with sufficient privileges.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions