Skip to content

Commit 9f086c0

Browse files
authored
[Desktop-lite] desktop-init.sh drops entrypoint args due to heredoc variable expansion (#1621)
* update script * update minor version
1 parent a1a0998 commit 9f086c0

4 files changed

Lines changed: 27 additions & 6 deletions

File tree

src/desktop-lite/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "desktop-lite",
3-
"version": "1.2.8",
3+
"version": "1.2.9",
44
"name": "Light-weight Desktop",
55
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/desktop-lite",
66
"description": "Adds a lightweight Fluxbox based desktop to the container that can be accessed using a VNC viewer or the web. GUI-based commands executed from the built-in VS code terminal will open on the desktop automatically.",

src/desktop-lite/install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,9 @@ else
409409
fi
410410
411411
# Run whatever was passed in
412-
if [ -n "$1" ]; then
412+
if [ -n "\$1" ]; then
413413
log "Executing \"\$@\"."
414-
exec "$@"
414+
exec "\$@"
415415
else
416416
log "No command provided to execute."
417417
fi

test/desktop-lite/scenarios.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212
"noVncVersion": "1.2.0"
1313
}
1414
}
15-
},
15+
},
1616
"test_vnc_resolution_as_container_env_var": {
1717
"image": "ubuntu:noble",
1818
"features": {
1919
"desktop-lite": {}
20-
}
21-
,
20+
},
2221
"containerEnv": {
2322
"VNC_RESOLUTION": "1920x1080x32"
2423
},
@@ -45,5 +44,11 @@
4544
"features": {
4645
"desktop-lite": {}
4746
}
47+
},
48+
"test_desktop_init_exec_passthrough": {
49+
"image": "ubuntu:noble",
50+
"features": {
51+
"desktop-lite": {}
52+
}
4853
}
4954
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Optional: Import test library
6+
source dev-container-features-test-lib
7+
8+
# Verify that desktop-init.sh correctly passes through commands.
9+
# Previously, the heredoc in install.sh did not escape $1 and $@, causing them to expand
10+
# to empty strings at install time, so any command passed to desktop-init.sh was silently ignored.
11+
12+
check "command is passed through and executed" \
13+
bash -c "result=\$(/usr/local/share/desktop-init.sh echo 'passthrough-test-token' 2>/dev/null) && echo \"\$result\" | grep -q 'passthrough-test-token'"
14+
15+
# Report result
16+
reportResults

0 commit comments

Comments
 (0)