diff options
| author | sethp <seth@codecopse.net> | 2023-07-31 11:13:44 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-31 11:13:44 -0700 |
| commit | fff66a954c7664d8263a00f3ca5f021dc0ca5716 (patch) | |
| tree | 3e1b0e36907872ae595cc2fee2e3e9a1c0e0edc9 | |
| parent | 912dacb6588b63b385020d5b210fb27eb8095da0 (diff) | |
| download | rust-fff66a954c7664d8263a00f3ca5f021dc0ca5716.tar.gz rust-fff66a954c7664d8263a00f3ca5f021dc0ca5716.zip | |
fix: lookup user by name, not id
Previously, the `id -u $LOCAL_USER_ID` check would succeed, because there was already a user mapped to the $LOCAL_USER_ID with a different name. Looking up the entry in the database by name, however, correctly makes the `useradd` operation idempotent. An alternative fix would be to avoid duplicating an already-existing-ID, however that would require either probing for an available ID or identifying where LOCAL_USER_ID is being set and changing it to better match the ubuntu base image, neither of which is a one-line change.
| -rwxr-xr-x | src/ci/run.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ci/run.sh b/src/ci/run.sh index 0c0026f484f..e447d11c37f 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -8,7 +8,7 @@ fi if [ "$NO_CHANGE_USER" = "" ]; then if [ "$LOCAL_USER_ID" != "" ]; then - id -u $LOCAL_USER_ID &>/dev/null || useradd --shell /bin/bash -u $LOCAL_USER_ID -o -c "" -m user + id -u user &>/dev/null || useradd --shell /bin/bash -u $LOCAL_USER_ID -o -c "" -m user export HOME=/home/user unset LOCAL_USER_ID |
