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

Don't rely on path_max

Aperta
#2,091 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
c, linux

Direzione di ricerca

Inizia individuando ogni uso di PATH_MAX relativo a realpath(3) e readlink(2), quindi esamina gli alias static inline di realpath per Windows e FF_EXE_PATH_LEN di terminalshell_linux. Confronta il comportamento di allocazione su Hurd e Linux e valuta se degli helper condivisi possano sostituire le condizioni sparse; il lavoro è completato quando l’hack PATH_MAX di Hurd non è più necessario senza compromettere questi percorsi specifici della piattaforma.

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

Descrizione

Hi,

Following up to my comment in https://github.com/fastfetch-cli/fastfetch/issues/1895#issuecomment-3206602801 on PATH_MAX.

I would like to get rid of the -DPATH_MAX=4096 hack for hurd.

I had a look where PATH_MAX is used and it is used only for realpath(3) and readlink(2) to allocate a buffer that will be "big enough".

For realpath glibc will allocate a buffer for us with the result when the output is NULL. (this case is not specified by posix). I don't think this is something that other libcs implement though.

The man page for readlink also suggests to not rely on PATH_MAX and suggests to use stat.st_size from lstat and malloc a buffer manually.

The problem with this approach is that while lstat on /proc returns sensible values on hurd e.g. on linux the size is 0 so the PATH_MAX approach is still needed.

Also there are currently at least 2 static inline realpath aliases for windows.

terminalshell_linux has a FF_EXE_PATH_LEN instead.

Before I start to make this work would it make sense to consolidate this into new helpers to not litter #ifdef PATH_MAX everywhere?

Lingua principale
C
Stelle
24.9k
Fork
911
Merge medio
17h 41m
PR unite (30g)
20

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 fastfetch-cli/fastfetch

Tutte le issue di fastfetch-cli/fastfetch

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.