Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Environ drops the final variable when the trailing NUL is absent

Chiusa
#883 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 4 giorni

Una pull request collegata è già stata integrata.

  • #884 di @gerardrecinto — integrata

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go, linux

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Go
Stelle
883
Fork
395
Merge medio
6g 17h
PR unite (30g)
7

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di prometheus/procfs

Tutte le issue di prometheus/procfs

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.