fastfetch-cli / fastfetch-cli/fastfetch
Don't rely on path_max
Personne n'a encore pris cette issue.
- Langage dominant
- C
- Étoiles
- 24.7k
- Forks
- 895
- Merge moyen
- 1 j 4 h
- PR mergées (30 j)
- 15
Description
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?
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par localiser chaque utilisation de PATH_MAX liée à realpath(3) et readlink(2), puis examinez les alias static inline de realpath pour Windows ainsi que le FF_EXE_PATH_LEN de terminalshell_linux. Comparez le comportement d’allocation sur Hurd et Linux, et déterminez si des helpers partagés peuvent remplacer les conditions dispersées ; le travail est terminé lorsque le hack PATH_MAX de Hurd n’est plus nécessaire sans casser ces chemins spécifiques aux plateformes.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- c, linux
- Domaine
- cli, operating-systems
- Type d'issue
- Refactorisation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100