[ BUG ] --debug leaves an HTML dump in TMPDIR for remote documents
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 58/100
Direzione di ricerca
Inizia leggendo internal/core/usecase/localmd/localmd.go e internal/core/usecase/remotemd/remotemd.go, quindi esegui la riproduzione con TMPDIR dell’issue. Traccia l’interazione tra il dump di debug e la pulizia differita dei file temporanei e verifica che remote --debug non lasci più un dump orfano, preservando al contempo l’ispezionabilità prevista dell’output.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
With --debug, a run against a remote URL leaves an orphaned ghtoc-remote-txt-*.debug.html file in the temporary directory. Nothing ever removes it, so the files accumulate.
RemoteMd downloads the document into a temporary file and delegates to LocalMd. In debug mode LocalMd writes its HTML dump next to the file it was handed, producing <temp>.debug.html. RemoteMd's deferred cleanup removes only the downloaded copy, not the dump.
The dump is also useless where it lands: it is named after a random temporary file, so there is no obvious way to connect it back to the URL that produced it.
To Reproduce
export TMPDIR=/tmp/ghtoc-dbg && mkdir -p "$TMPDIR"
gh-md-toc --debug https://raw.githubusercontent.com/ekalinin/github-markdown-toc.go/master/README.md > /dev/null
ls -1 "$TMPDIR"
Actual:
ghtoc-remote-txt-482196719.debug.html
Expected: nothing left in TMPDIR, or a dump the user can actually find.
Expected behavior
Two reasonable options, and the choice affects whether --debug stays useful for remote input:
- Remove it.
RemoteMddeletes<temp>.debug.htmlalongside the temporary Markdown. Smallest change, but--debugthen produces nothing inspectable for a remote document, which defeats the flag for that input type. - Relocate it. Write the dump into the working directory under a name derived from the URL, for example
README.md.debug.html. Keeps the flag useful and matches what already happens for local files, where the dump lands next to the document and is covered by the*.debug.htmlrule in.gitignore.
Environment (please complete the following information):
- OS: macOS (darwin/arm64), reproduces on any platform
- Version: reproduced at 2.0.1 and on current
master
Additional context
Pre-existing, not introduced by any open pull request.
The same class of bug affected --skip-header, where the dump was named after an internal trimmed copy and stranded in TMPDIR the same way. That one is fixed in #79 by naming the dump after the document the user passed rather than after the internal temporary file. RemoteMd was deliberately left out of that change: its display path is a URL, not a filesystem path, so the same fix does not apply directly and the destination is a real decision rather than a mechanical one.
See internal/core/usecase/localmd/localmd.go (debug dump) and internal/core/usecase/remotemd/remotemd.go (temporary file cleanup).
- Lingua principale
- Go
- Stelle
- 525
- Fork
- 90
- Merge medio
- 2g 1h
- PR unite (30g)
- 1
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ekalinin/github-markdown-toc.go
-
[Feature] Usage as a libraryApertaenhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
[BUG] TOC picks up YAMLApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
Tutte le issue di ekalinin/github-markdown-toc.go
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
NVIDIA/k8s-device-plugin#2076 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
area/release kind/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
kubernetes-sigs/kueue#16455 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno