Skip to content

Commit fff66a9

Browse files
authored
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.
1 parent 912dacb commit fff66a9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/ci/run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fi
88

99
if [ "$NO_CHANGE_USER" = "" ]; then
1010
if [ "$LOCAL_USER_ID" != "" ]; then
11-
id -u $LOCAL_USER_ID &>/dev/null || useradd --shell /bin/bash -u $LOCAL_USER_ID -o -c "" -m user
11+
id -u user &>/dev/null || useradd --shell /bin/bash -u $LOCAL_USER_ID -o -c "" -m user
1212
export HOME=/home/user
1313
unset LOCAL_USER_ID
1414

0 commit comments

Comments
 (0)