Improvement: Add deduplication check in bashrc/zshrc 00-init to prevent unbounded PATH growth
Los mantenedores suelen responder en 1 día
@mylinuxforwork ya está trabajando en esto.
Desde el 5/9/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Describe the bug
In ~/.config/bashrc/00-init and ~/.config/zshrc/00-init, the cargo and local bin directories are appended directly to $PATH without checking if they are already present:
export PATH=$PATH:~/.cargo/bin/
export PATH=$PATH:~/.local/bin/
In standard daily terminal usage, this goes unnoticed because a fresh terminal only sources .bashrc once.
However, in more advanced setups (e.g. running background widgets like Quickshell, custom toolchains, nested subshells invoking bash -c, or scripts that re-source the shell environment), 00-init can be executed multiple times within the same session hierarchy.
Because there is no duplicate check, the exact same paths are appended over and over again. Eventually, $PATH can grow to hundreds of kilobytes and hit the Linux kernel limit (ARG_MAX), resulting in:
E2BIG: Argument list too longon new process executions.- Compositor shortcuts failing to spawn programs.
Adding a simple check before appending makes00-initidempotent and bulletproof against repeated sourcing.
Steps to reproduce
1. Open a terminal and check the length of `$PATH`:
`echo $PATH | wc -c`
2. Simulate repeated subshell invocations or run the desktop session across multiple sleep/wake cycles:
`for i in {1..50}; do bash -c 'true'; done`
3. Inspect `$PATH`:
`echo $PATH`
4. Notice dozens of duplicated `~/.cargo/bin` and `~/.local/bin` entries inflating the environment size.
### Expected behavior
Pads should only be added to `$PATH` if they are not already present, preventing duplicate entries and buffer overflows regardless of how often subshells are spawned.
**Proposed fix for `00-init`:**
```bash
# Add ~/.cargo/bin if not already in PATH
case ":$PATH:" in
*":$HOME/.cargo/bin:"*) ;;
*) export PATH="$PATH:$HOME/.cargo/bin" ;;
esac
# Add ~/.local/bin if not already in PATH
case ":$PATH:" in
*":$HOME/.local/bin:"*) ;;
*) export PATH="$PATH:$HOME/.local/bin" ;;
esac
### Screenshots
_No response_
### Distribution
Other (please specify below)
### If Other, specify
CachyOS
### Additional context
_No response_
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
- Lenguaje dominante
- QML
- Estrellas
- 5.1k
- Forks
- 386
- Merge medio
- 16 h 45 min
- PR fusionados (30 d)
- 14
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de mylinuxforwork/dotfiles
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
mylinuxforwork/dotfiles#1904 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 82/100
mylinuxforwork/dotfiles#1829 ·
Los mantenedores suelen responder en 1 día
-
enhancement solved
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
mylinuxforwork/dotfiles#1807 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
mylinuxforwork/dotfiles#1765 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[FEATURE] add keycap 1 app window over all windowsPosiblemente ocupada @mylinuxforwork la tomó hace 1 día. Abiertoenhancement
mylinuxforwork/dotfiles#1902 · 1 asignado ·
Los mantenedores suelen responder en 1 día