Shell installer: relative CODEX_HOME breaks package links and relative CODEX_INSTALL_DIR writes a cwd-dependent PATH
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 85/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- bash
- Ambito
- cli
Direzione di ricerca
L'installatore shell scrive percorsi relativi come destinazioni di symlink e voci di profilo quando CODEX_HOME o CODEX_INSTALL_DIR sono relativi. Parti dallo script di installazione esercitato da scripts/install/test_install_sh.py, individua dove CODEX_HOME_DIR e BIN_DIR vengono usati per costruire il symlink corrente e la voce PATH, e convertili in percorsi assoluti. Esegui la suite di test dell'installatore per confermare la correzione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What issue are you seeing?
The shell installer generates a broken current symlink when CODEX_HOME is relative. The package is unpacked successfully, but a normal install exits 127 when it verifies the visible command. In daemon-only mode installation can exit 0 while current/bin/codex remains unusable.
A related path problem occurs when CODEX_INSTALL_DIR is relative: the visible link works from the installation directory, but the generated profile PATH entry is relative, so codex stops resolving after the working directory changes.
Checked main at ac9b5b8380517ded445b09dd3196d8d9e2ba3c59. Evidence below uses the existing local installer fixture on Linux, with its macOS mock; this is not a test on a real macOS host.
What steps can reproduce the bug?
Save the following script and run python installer-relative-home-repro.py /path/to/codex-checkout. It uses the checkout's existing package/download fixture, requires no network, and confines profile writes to a temporary directory.
#!/usr/bin/env python3
"""Local installer reproduction; uses Linux with the fixture's macOS mock.
Usage: python installer-relative-home-repro.py /path/to/codex-checkout
All downloads and profile writes are confined to the existing local fixture.
"""
import importlib.util
from pathlib import Path
import subprocess
import sys
import tempfile
from unittest.mock import patch
checkout = Path(sys.argv[1]).resolve()
fixture_path = checkout / "scripts/install/test_install_sh.py"
spec = importlib.util.spec_from_file_location("installer_fixture", fixture_path)
fixture = importlib.util.module_from_spec(spec)
spec.loader.exec_module(fixture)
original_run = subprocess.run
with tempfile.TemporaryDirectory(prefix="codex installer repro ") as temporary:
root = Path(temporary).resolve()
archive, checksum, metadata = fixture.create_package_release(root)
def run_with_relative_home(args, **kwargs):
if len(args) > 1 and Path(args[1]) == fixture.INSTALL_SCRIPT:
kwargs["env"] = {**kwargs["env"], "CODEX_HOME": "codex-home"}
kwargs["cwd"] = root
return original_run(args, **kwargs)
with patch.object(fixture.subprocess, "run", side_effect=run_with_relative_home):
result, _ = fixture.run_installer_in(
root,
fixture.VERSION,
metadata_json=metadata,
archive_path=archive,
checksum_path=checksum,
force_macos=True,
)
current = root / "codex-home/packages/standalone/current"
package = current.parent / "releases" / f"{fixture.VERSION}-aarch64-apple-darwin"
visible = root / "install-bin/codex"
print(f"installer_exit={result.returncode}")
print(f"installed_package_binary_exists={(package / 'bin/codex').exists()}")
print(f"current_target={current.readlink()}")
print(f"current_target_exists={current.exists()}")
print(f"visible_command_exists={visible.exists()}")
if result.stderr:
print(f"stderr={result.stderr.strip()}")
if visible.exists():
print(subprocess.check_output([str(visible), "--version"], text=True).strip())
On unmodified main:
installer_exit=127
installed_package_binary_exists=True
current_target=codex-home/packages/standalone/releases/0.142.5-aarch64-apple-darwin
current_target_exists=False
visible_command_exists=False
The final installer error is that the temporary install-bin/codex command is not found, despite the package binary existing. The fixture's version is 0.142.5; the defect is in the current install script's link construction rather than the CLI executable.
What is the expected behavior?
Resolve configured relative installation directories against the installer's initial working directory so package links and profile entries continue to work independently of later working directories.
Additional information
CODEX_HOME_DIR is used unchanged to derive STANDALONE_ROOT, then the relative release path is written as the target of current. A relative symlink target is resolved from the symlink's parent, not from the installer's working directory, producing the wrong path. BIN_DIR is likewise written as a relative path in the profile block.
A local candidate converts relative CODEX_HOME_DIR and BIN_DIR to absolute paths before deriving the other paths. The reproduction then exits 0, both links resolve, and the command prints codex-cli 0.142.5. Added fixture cases also cover daemon-only installation and sourcing the generated profile from a different directory; temporary paths include spaces. The complete installer suite passes 22 tests and 9 subtests, and sh -n and diff checks pass. Actual macOS and native release downloads were not tested.
Searched for relative CODEX_HOME/CODEX_INSTALL_DIR installer reports and did not find an equivalent issue. No external PR is requested, consistent with the contribution policy.
- Lingua principale
- Rust
- Stelle
- 128k
- Fork
- 20.1k
- Merge medio
- 1m
- PR unite (30g)
- 994
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di openai/codex
-
bug CLI sandbox
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
CLI config custom-model documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
CLI documentation TUI
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
CLI documentation mcp
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Desktop SSH bootstrap uses ~/.code typo for forwarded SSH agent fallbackForse già presa @nightcityblade l’ha presa oggi. Apertaapp app-server bug remote
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 78/100
openai/codex#52026 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di openai/codex
Issue simili
-
defect
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 2 giorni
-
enhancement user-priority/P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno