install.sh: `exec 9>&- 2>/dev/null` in `release_install_lock` silences every later warning

Cerrado Apto para principiantes
#58,818 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
Menos de una hora
Aptitud para principiantes
82/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
bash, shell
Área
cli

Línea de trabajo

El error está en release_install_lock en install.sh, donde exec 9>&- 2>/dev/null redirige stderr durante el resto del script. Ejecuta la reproducción del issue (un codex gestionado por npm falso en PATH con CODEX_NON_INTERACTIVE=1) y comprueba con bash -x que la función de bloqueo es donde desaparece stderr. Está terminado cuando la advertencia 'Leaving the existing npm-managed Codex installed' aparece tanto con bash como con sh, sin cambiar cómo se cierra el fd 9.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug CLI

What happens

After release_install_lock runs, the rest of install.sh writes nothing to stderr. The cause is this line:

release_install_lock() {
  ...
  elif [ "$lock_kind" = "flock" ] || [ "$lock_kind" = "lockf" ]; then
    exec 9>&- 2>/dev/null || true

In bash, exec with redirections and no command applies all of them to the shell itself, so 2>/dev/null stays in
force for the rest of the script, not only for closing fd 9. Every warn after that point goes to /dev/null. The
same happens under sh (dash on Ubuntu), which the documented curl -fsSL https://chatgpt.com/codex/install.sh | sh
uses.

What a user misses

handle_conflicting_install runs after release_install_lock. With another Codex on the PATH (an npm copy) and the
uninstall question answered No (or CODEX_NON_INTERACTIVE=1), the user never sees:

WARNING: Leaving the existing npm-managed Codex installed. PATH order will determine which codex runs.

The "Failed to uninstall the existing … Codex" warning after a Yes would be hidden the same way.

How to reproduce (Ubuntu 24.04 in Docker, Codex 0.166.0, install.sh sha256
44ac252c1b9a68c02bdf0de8e1c6cbfde36fc1afa8684624962eae7d4c461e70)

docker run --rm -it ubuntu:24.04 bash
apt-get update && apt-get install -y curl ca-certificates
useradd -m tester && su - tester
mkdir -p ~/.npm-global/bin
printf '#!/usr/bin/env node\n' > ~/.npm-global/bin/codex && chmod +x ~/.npm-global/bin/codex
curl -fsSL https://chatgpt.com/codex/install.sh -o install.sh
CODEX_NON_INTERACTIVE=1 PATH="$HOME/.npm-global/bin:$HOME/.local/bin:$PATH" bash install.sh

The output shows "Detected existing npm-managed Codex at /home/tester/.npm-global/bin/codex" and "installed
successfully", but no "Leaving the existing npm-managed Codex installed" line. bash -x install.sh shows
release_install_lock running exec 9>&- 2>/dev/null, and nothing more traced after it.

Run as written above on a clean ubuntu:24.04 container on 2026-11-02 (the same sha256): exit 0, no "Leaving …" line.

A possible fix

Close the descriptor without touching stderr, for example exec 9>&- alone, or { exec 9>&-; } 2>/dev/null. Both
keep stderr working afterwards in bash (checked); exec 9>&- 2>/dev/null silences it in bash and in dash.

Lenguaje dominante
Rust
Estrellas
133k
Forks
21.1k
Merge medio
1 min
PR fusionados (30 d)
997

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de openai/codex

Todos los issues de openai/codex

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.