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

sudo: SUDO_USER is wrong and SUDO_UID is missing #99

Open
cebtenzzre opened this issue Apr 28, 2023 · 0 comments
Open

sudo: SUDO_USER is wrong and SUDO_UID is missing #99

cebtenzzre opened this issue Apr 28, 2023 · 0 comments

Comments

@cebtenzzre
Copy link

Expected Result

On Linux:

$ sudo sh -c 'printf "%s\n" user=$SUDO_USER uid=$SUDO_UID gid=$SUDO_GID'
user=cebtenzzre
uid=1000
gid=1000

Actual Result

On Termux with tsu version 8.6.0:

$ sudo sh -c 'printf "%s\n" user=$SUDO_USER uid=$SUDO_UID gid=$SUDO_GID'
user=10394
uid=
gid=10394

SUDO_USER is actually the user ID, and SUDO_UID is not set.

Analysis

At a glance, it looks like there's a copy-paste error here:

tsu/shell/tsu.sh

Lines 172 to 174 in 5543412

EXP_ENV[SUDO_GID]="$(id -g)"
EXP_ENV[SUDO_USER]="$(id -un)"
EXP_ENV[SUDO_USER]="$(id -u)"

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

No branches or pull requests

1 participant