Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Environ drops the final variable when the trailing NUL is absent

Cerrado
#883 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 4 días

Ya se ha fusionado un pull request relacionado.

  • #884 de @gerardrecinto — fusionado

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
30/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go, linux

Línea de trabajo

Start in Proc.Environ, where the data split on NUL unconditionally drops the last element. The reporter describes a table-driven regression that uses NewFS, FS.Proc and a temporary proc fixture. Done means unterminated inputs (A=1, A=1\0B=2, B=) keep every variable, while terminated inputs and embedded empty entries behave as before. The reporter says they are already working on a fix, so check with them before starting.

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

Descripción

Proc.Environ() unconditionally removes the last element after splitting on NUL. When /proc/<pid>/environ has no trailing NUL, this drops the final variable: A=1 becomes an empty slice, and A=1\0B=2 becomes ["A=1"].

The Linux manual explicitly allows the trailing NUL to be absent: https://man7.org/linux/man-pages/man5/proc_pid_environ.5.html.

Reproduced on current master 13dc9c2 through the public NewFS, FS.Proc and Proc.Environ APIs with a temporary proc fixture. A table-driven regression fails for a single unterminated entry, multiple unterminated entries, and an unterminated empty value (B=). Terminated inputs and embedded empty entries pass unchanged.

I am working on a focused fix that removes the final split element only when it is empty. This preserves the empty entries discussed in #680 and does not filter environment contents or change read-error behavior.

Thanks
Gerard Recinto

Lenguaje dominante
Go
Estrellas
883
Forks
395
Merge medio
6 d 17 h
PR fusionados (30 d)
7

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 prometheus/procfs

Todos los issues de prometheus/procfs

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.