Shell installer: literal $ in CODEX_INSTALL_DIR corrupts generated profile PATH
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
バグは scripts/install/install.sh の add_to_path() にあります。ここでは PATH の行が、ダブルクォートされた文字列の中で BIN_DIR から組み立てられています。issue にある単独のスニペットで再現し、既存の $PATH が profile の読み込み時にも展開されたままになるよう、BIN_DIR のリテラル部分だけをシェル用にクォートしてください。リテラルのドル記号を含むディレクトリで、新しく source したシェルから codex が解決でき、テストフィクスチャがそのケースを扱っていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
What issue are you seeing?
The standalone shell installer can complete successfully but leave Codex unavailable in a new shell when CODEX_INSTALL_DIR is an absolute path containing a literal dollar sign followed by variable-name characters.
The installed executable exists and is runnable by its full path. The generated shell-profile PATH entry reinterprets part of the literal directory name as an environment-variable expansion, so normal command lookup cannot find it.
Affected source: main 4dcd8df891ad38ed7d4ea59c44b817c293ffc0e2, also verified on 1885417cd45a8da5bfdeb7864a5380a7481d48f2.
Platform tested: Linux x86_64, /bin/sh. The full installer was also exercised with the repository's local download/package fixture, without network calls; the fixture reports package version 0.142.5 (not an assertion about the currently released Codex version).
What steps can reproduce the bug?
This minimal standalone reproduction exercises the exact PATH-line construction used in add_to_path(), followed by sourcing that line in a new POSIX shell. It makes no changes to your real home directory:
set -eu
root="$(mktemp -d)"
trap 'rm -rf "$root"' EXIT
# The dollar sign is literal and part of this absolute directory name.
BIN_DIR="$root/literal\$CODEX_TEST_UNSET/install-bin"
mkdir -p "$BIN_DIR"
printf '#!/bin/sh\necho codex-fixture\n' > "$BIN_DIR/codex"
chmod +x "$BIN_DIR/codex"
# The expression from scripts/install/install.sh:add_to_path().
path_line="export PATH=\"$BIN_DIR:\$PATH\""
printf '%s\n' "$path_line" > "$root/profile"
printf 'generated profile: '
cat "$root/profile"
# A new shell reads that generated profile without this variable set.
env -u CODEX_TEST_UNSET /bin/sh -c '
. "$1"
command -v codex || echo NOT_FOUND
test -x "$2/codex" && echo ACTUAL_BINARY_EXISTS
' sh "$root/profile" "$BIN_DIR"
Actual output (temporary prefix abbreviated):
generated profile: export PATH="/tmp/.../literal$CODEX_TEST_UNSET/install-bin:$PATH"
NOT_FOUND
ACTUAL_BINARY_EXISTS
In a complete unchanged-installer fixture, an ordinary absolute install path succeeded and resolved from a fresh shell, while the same absolute path with literal $CODEX_TEST_UNSET installed successfully but failed fresh-shell lookup with exit 127. The original executable was present in both cases.
What is the expected behavior?
A generated profile entry should preserve CODEX_INSTALL_DIR exactly as a literal filesystem path. After installation and sourcing the supported profile, command -v codex should locate the installed binary regardless of literal dollar signs in the directory.
Additional information
Root cause: scripts/install/install.sh:add_to_path() constructs:
path_line="export PATH=\"$BIN_DIR:\$PATH\""
The installer substitutes BIN_DIR without escaping shell-significant characters inside a double-quoted assignment. This text is later written to the selected profile. When sourced, the shell expands the apparent variable inside what should have been the literal directory.
Suggested fix: POSIX-shell-quote the literal BIN_DIR component in the generated profile, while intentionally allowing the existing PATH to expand at source time. Test with a directory containing a dollar sign (and ideally quote/backslash characters), and assert that the newly sourced profile resolves the actual binary.
Related but distinct: #51538 covers relative CODEX_HOME/CODEX_INSTALL_DIR paths and cwd-dependent links. This bug uses an absolute path and is caused by shell interpolation within the generated profile. I searched issues/PRs for the literal-dollar/path-escaping case and did not find an existing equivalent report.
Limits: Confirmed on Linux /bin/sh; actual macOS shells and release downloads were not exercised. No claim of arbitrary command execution is made here; the demonstrated failure is incorrect PATH generation and inability to locate the installed command.
- 主要言語
- Rust
- スター
- 133k
- フォーク
- 21.1k
- 平均マージ
- 1分
- マージ済み PR(30日)
- 995
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
openai/codex のほかの issue
-
app-server bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
openai/codex#60595 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
CLI / TypeScript SDK: image paths containing commas are split into separate attachments対応中かも @akhil9tiet が今日担当しました。 オープンbug CLI exec
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
openai/codex#60587 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
app bug pets
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug skills
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
enhancement good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
area:ui
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
openfootmanager/openfootmanager#1365 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 1/5 1〜3時間 初心者へのやさしさ 90/100
JackMechem/marbble#305 ·
メンテナーはふだん 1 日以内に返信
-
ci:stability
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 5 日以内に返信
-
antora bug review-2026-11-11
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
bovinemagnet/AdocFoundry#546 ·
メンテナーはふだん 1 日以内に返信