Shell installer: updating PATH replaces symlinked profiles and changes existing file permissions
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 85/100
Direzione di ricerca
Il bug si trova nella logica di riscrittura del blocco PATH dell'installer, specificamente nella funzione rewrite_path_block che scrive su un file temporaneo e lo sposta sul pathname del profilo. Parti dallo script dell'installer (probabilmente sotto scripts/install.sh) e dal fixture di test in scripts/install/test_install_sh.py. Usa lo script di riproduzione fornito per confermare il problema, poi modifica la riscrittura in modo da risolvere i symlink, conservare la modalità del file originale e aggiornare il file di destinazione invece di sostituire il symlink. Esegui la suite di test dell'installer per verificare la correzione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What issue are you seeing?
When a shell profile already contains a Codex PATH block and is a symlink into a dotfiles directory, rerunning the shell installer replaces that symlink with a regular file. Its original dotfiles target is not updated. The same rewrite also changes an existing regular profile's mode to the temporary file's mode.
Confirmed on main ac9b5b8380517ded445b09dd3196d8d9e2ba3c59 with the existing local installer fixture on Linux, using its macOS mock. This does not establish behavior on an actual macOS host.
What steps can reproduce the bug?
Save and run python installer-profile-symlink-repro.py /path/to/codex-checkout. All package downloads are mocked by the existing local fixture; all profile writes remain in a temporary directory.
#!/usr/bin/env python3
"""Local installer fixture on Linux with mocked macOS; no network or user profile writes.
Usage: python installer-profile-symlink-repro.py /path/to/codex-checkout
"""
import importlib.util
from pathlib import Path
import stat
import sys
import tempfile
checkout = Path(sys.argv[1]).resolve()
spec = importlib.util.spec_from_file_location(
"installer_fixture", checkout / "scripts/install/test_install_sh.py"
)
fixture = importlib.util.module_from_spec(spec)
spec.loader.exec_module(fixture)
with tempfile.TemporaryDirectory(prefix="codex profile repro ") as temporary:
root = Path(temporary).resolve()
archive, checksum, metadata = fixture.create_package_release(root)
(root / "home").mkdir()
(root / "dotfiles").mkdir()
target = root / "dotfiles/profile"
profile = root / "home/.profile"
profile.symlink_to("../dotfiles/profile")
target.write_text(
'export EXISTING_SETTING="keep this"\n'
'# >>> Codex installer >>>\nexport PATH="/old/bin:$PATH"\n'
"# <<< Codex installer <<<\n"
)
target.chmod(0o640)
result, _ = fixture.run_installer_in(
root,
fixture.VERSION,
metadata_json=metadata,
archive_path=archive,
checksum_path=checksum,
force_macos=True,
)
print(f"installer_exit={result.returncode}")
print(f"profile_is_symlink={profile.is_symlink()}")
print(f"dotfiles_target_updated={str(root / 'install-bin') in target.read_text()}")
print(f"profile_mode={oct(stat.S_IMODE(profile.stat().st_mode))}")
print(f"dotfiles_target_mode={oct(stat.S_IMODE(target.stat().st_mode))}")
print(f"existing_setting_preserved={'keep this' in profile.read_text()}")
if result.stderr:
print(f"stderr={result.stderr.strip()}")
With the original installer:
installer_exit=0
profile_is_symlink=False
dotfiles_target_updated=False
profile_mode=0o600
dotfiles_target_mode=0o640
existing_setting_preserved=True
The resulting mode depends on the ambient umask; 0600 is the observed value here, not a universal value.
What is the expected behavior?
Updating the installer-managed PATH block should preserve the user's profile symlink, update its target, retain unrelated content, and preserve the existing profile permissions.
Additional information
rewrite_path_block() writes a temporary file and moves it over the profile pathname. The move replaces the symlink instead of following it, and the temporary file does not retain the original file's mode.
I tested a candidate that resolves the final profile target, stages the update beside that target while retaining its file metadata, and replaces the target instead of the profile symlink. The reproduction then preserves the symlink, updates the dotfiles target, and retains mode 0640. The complete installer suite passes 23 tests and 11 subtests; coverage includes linked profile chains, a regular profile's mode, first-time appends, first-time writes through a broken link whose target directory exists, and failure cleanup that leaves original content intact. Shell syntax and diff checks pass.
Searched installer/profile/symlink and dotfiles reports and found no equivalent issue. No external PR is requested, consistent with the contribution policy.
- Lingua principale
- Rust
- Stelle
- 130k
- Fork
- 20.5k
- Merge medio
- 1m
- PR unite (30g)
- 996
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
-
CLI pets: recognize rozi and herdr as Kitty graphics terminalsForse già presa @akhil9tiet l’ha presa oggi. Apertabug CLI pets
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
openai/codex#57541 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Hooks see a multi-agent v2 launch as collaborationspawn_agent, so spawn_agent and Agent matchers miss itForse già presa @akhil9tiet l’ha presa oggi. Apertabug CLI hooks subagent
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
openai/codex#57539 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Image previews disabled inside Herdr despite Kitty graphics supportForse già presa @akhil9tiet l’ha presa 1 giorno fa. Apertabug CLI TUI
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
openai/codex#57329 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
app bug plan
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
CLI documentation hooks windows-os
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di openai/codex
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
plrigaux/sysd-manager#85 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
dsx-ai-factory/infra-controller#8341 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement triage:deciding
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
open-telemetry/otel-arrow#4540 ·
I maintainer di solito rispondono entro 2 giorni
-
benchmark: CSV report files contain blank records on WindowsForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertacomponent:benchmark
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
agentic-os-org/ANOLISA#9177 ·
I maintainer di solito rispondono entro 1 giorno
-
area/mcp area/modeling effort/s impact/few priority/p3 severity/low triaged type/bug urgency/this-quarter
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
cristim/AztecCraft#336 ·
I maintainer di solito rispondono entro 1 giorno