Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tools/docker-images/clp-package/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ if [[ -s "$temp_iid_file" ]]; then
new_image_id="$(<"$temp_iid_file")"
echo "$new_image_id" > "$iid_file"

user="${USER:-$(id -un 2>/dev/null || whoami 2>/dev/null || echo unknown)}"
user="${USER:-$(whoami 2>/dev/null)}" \
|| user=$(id --user --name 2>/dev/null) \
|| user=$(id --user 2>/dev/null) \
|| user="unknown";
Comment on lines +51 to +54
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Restore POSIX-friendly id fallbacks.

id --user --name/id --user are GNU-only; macOS and BusyBox reject them, so the script now falls all the way to "unknown" on those platforms. The previous id -un/id -u path worked there, so this is a regression. Please retain the short-option fallbacks (or probe for GNU support) before giving up on resolving the username.

-    user="${USER:-$(whoami 2>/dev/null)}" \
-        || user=$(id --user --name 2>/dev/null) \
-        || user=$(id --user 2>/dev/null) \
+    user="${USER:-$(whoami 2>/dev/null)}" \
+        || user=$(id --user --name 2>/dev/null) \
+        || user=$(id -un 2>/dev/null) \
+        || user=$(id --user 2>/dev/null) \
+        || user=$(id -u 2>/dev/null) \
         || user="unknown";
🤖 Prompt for AI Agents
In tools/docker-images/clp-package/build.sh around lines 51-54, the current
fallbacks use GNU-only long id options and break on macOS/BusyBox; restore
POSIX-friendly fallbacks by trying id -un and id -u first (then the GNU
long-option forms if desired), then whoami as a next fallback, and finally
"unknown"; implement these attempts with || chains so the script resolves the
username on non-GNU systems before giving up.

short_id="${new_image_id#sha256:}"
short_id="${short_id:0:4}"
docker tag "$new_image_id" "clp-package:dev-${user}-${short_id}"
Expand Down
Loading