gitui-org / gitui-org/gitui

GitUI was close due to an unexpected panic (file: "src/watcher.rs")

Aperta
#2,900 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Rust
Stelle
22.5k
Fork
773
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Using `gitui --watcher` causes "GitUI was closed due to an unexpected panic" when a **directory** belongs to another user.
This happens exclusively when a **directory** has a different owner. The error does NOT occur with files owned by another user.

## Steps to reproduce:
1. `mkdir projectX && cd projectX`
2. Create a directory with a different owner using one of these options:
- Option A:
`sudo install -m 700 -o 65654 -g 65654 -d mydir`
- Option B (the real-world case):
`podman run --rm -v "$(pwd):/workdir" alpine:latest /bin/sh -c 'mkdir /workdir/test && chown 1000:1000 /workdir/test && chmod 700 /workdir/test'`
3. Start gitui with the watcher and logs: `RUST_BACKTRACE=1 RUST_LOG=debug gitui --watcher 2>/tmp/gitui.log`

## Expected behavior
GitUI should open normally.

## Logs
```
❯ cat -pp /tmp/gitui.log

GitUI was closed due to an unexpected panic.
Please file an issue on https://github.com/gitui-org/gitui/issues with the following info:

panicked at src/watcher.rs:79:10:
Watch error: Error { kind: Io(Os { code: 13, kind: PermissionDenied, message: "Permission denied" }), paths: ["/home/user/gitui-test/mydir"] }

trace:
0:
1:
2:
3:
4:
5:
6:
7:
8:
9:

Error: receiving on an empty and disconnected channel

Stack backtrace:
0:
1:
2:
3:
```

**Context:**
- OS/Distro + Version: Ubuntu 24.04 LTS
- GitUI Version: gitui 0.28.1

**Additional context**
- Possibly related: #2710 #2488
- Adding the directory to `.git/info/exclude` does not prevent the error; it still occurs. (`echo -e 'mydir\ntest' >> .git/info/exclude`).

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start by reading src/watcher.rs around line 79 and reproduce the issue with gitui --watcher using the directory ownership steps and logging command in the report. Trace how the permission-denied watch error is handled; done means GitUI opens normally instead of panicking when it encounters an inaccessible directory.

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

Valutazione

Stack tecnologico
rust
Ambito
cli, operating-systems
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
66/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.