install.sh wrapper relative link not resolved correctly
@V-Subhankar-infy is already working on this.
Since Jun 11, 2026.
Assessment
This issue has not been assessed yet.
Description
I'm trying to create a generic install method for a dotfile/software install library I maintain. I want to install a link to the binary in ~/.local/bin/ and keep the devcontainers install under ~/.local/lib/devcontainers/. The install takes care of this via the --prefix ~/.local argument.
The problem is that when I create a relative link called devcontainer from ~/.local/bin to ~/.local/lib/devcontainers/bin/devcontainer and then invoke the devcontainer executable, the generated bin file resolves the link as a relative link, rather than absolute.
Example install method:
INSTALL_DIR=$HOME/.local
curl -sSLO https://raw.githubusercontent.com/devcontainers/cli/main/scripts/install.sh
chmod +x install.sh
./install.sh --prefix "${INSTALL_DIR}"/lib/devcontainers
cd "${INSTALL_DIR}"/bin
ln -s ../lib/devcontainers/bin/devcontainer devcontainer
Example running devcontainer which is already in the PATH of ~/.local/bin/
$devcontainer
/home/vasdee/.local/bin/devcontainer: line 18: cd: ../lib/devcontainers/bin: No such file or directory
In ~/.local/bin/devcontainer i believe if the follow link logic preferred the full path option of readlink, over the relative (which is the opposite of how it is now) then the issue would be solved....at least for me
# Resolve the installation directory
# Handle both direct execution and symlinked scenarios
if [ -L "$0" ]; then
# Follow symlink current logic
SCRIPT_PATH="$(readlink "$0" 2>/dev/null || readlink -f "$0" 2>/dev/null || echo "$0")"
# Follow symlink potential fix by preferring the abs path over relative
# SCRIPT_PATH="$(readlink -f "$0" 2>/dev/null || readlink "$0" 2>/dev/null || echo "$0")"
else
SCRIPT_PATH="$0"
fi
I am happy to contribute a PR, but am not sure of the history behind this choice and what impact the change might have. I'm looking for guidance in that respect.
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 461
- Avg merge
- 18m
- Merged PRs (30d)
- 5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from devcontainers/cli
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
devcontainers/cli#1203 ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 68/100
devcontainers/cli#1178 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
devcontainers/cli#1308 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 78/100
devcontainers/cli#1307 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
devcontainers/cli#1305 ·
All issues in devcontainers/cli
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dennys-bd/agent-hive#184 ·
-
Add: hunch Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AbdelStark/awesome-typesafe#104 ·
-
ai-observability bug team/ai-observability
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vicharanashala/fln#563 ·