Description
An edge case exists in the username fallback logic in tools/docker-images/clp-package/build.sh at line 51:
user="${USER:-$(id -un 2>/dev/null || whoami 2>/dev/null || echo unknown)}"
When the username cannot be found on the system (e.g., the username is not specified in /etc/passwd), id -un may print the numeric user ID followed by a newline but exit with a non-zero code. Due to the || chaining, subsequent commands (whoami and echo unknown) continue to execute, causing their output to be appended, resulting in a multi-line string with line breaks embedded in the user variable.
Example scenario
id -un: Prints 123\n; Exits with non-0
whoami: Prints nothing; Exits with non-0
echo unknown: Prints "unknown"
Result: user becomes "123\nunknown"
This could lead to invalid Docker image tag names or unexpected behaviour in the build process.
References
Description
An edge case exists in the username fallback logic in
tools/docker-images/clp-package/build.shat line 51:user="${USER:-$(id -un 2>/dev/null || whoami 2>/dev/null || echo unknown)}"When the username cannot be found on the system (e.g., the username is not specified in
/etc/passwd),id -unmay print the numeric user ID followed by a newline but exit with a non-zero code. Due to the||chaining, subsequent commands (whoamiandecho unknown) continue to execute, causing their output to be appended, resulting in a multi-line string with line breaks embedded in theuservariable.Example scenario
This could lead to invalid Docker image tag names or unexpected behaviour in the build process.
References