Skip to content

sudoedit doesn't work if $SUDO_EDITOR has arguments #1491

@aidanharris

Description

@aidanharris

Describe the bug
Sometimes I like to open files in KDE's Kate using sudoedit so I have an alias like the following:

$ which sukate
sukate: aliased to env SUDO_EDITOR='kate -b -n' sudoedit 

Expected behavior
This works in the original sudo but not with sudo-rs. I suspect that it doesn't split the whitespace when searching if it's a valid editor, i.e it's probably checking for /usr/bin/kate\ \-b\ \-n which of course doesn't exist.

If this is intentional, then fair enough, a wrapper script can be used instead but if not then sudo-rs should probably do whatever the original sudo does. I haven't checked but it's probably something equivalent to the following pseudocode:

editor="$1"
shift
# check if $editor is safe/trusted
# if it is
exec "$editor" "$@"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions