One Extra Slash: Hunting a Windows Path Bug Down to a Single Formatter
This is my entry for DEV's Summer Bug Smash — Smash Stories. Not every good bug is an epic. Some of them are one character long, and the interesting part is entirely in the hunt. I was consuming the JSON output of a developer CLI — machine-readable mode, the structured projection you're supposed to build tooling against. My code was doing something completely ordinary: taking a file path out of…
This is the account of a bug discovered during DEV's Summer Bug Smash. The issue was a single extra slash in a Windows file path, caused by a formatter in a CLI tool. The bug was initially missed because it did not cause an error in the path handling process. The issue was identified after comparing the raw bytes emitted by the CLI tool with the code that processed them.
The bug was found to be in a single point of path construction, specifically when a drive root was used. The cause was that a trailing separator was added to a string that already ended with one, resulting in a doubled slash. This bug can lead to issues downstream, such as duplicate entries in caches or incorrect comparisons between files.
To properly report the issue, a minimal reproduction, scoping evidence, and a proposed mechanism were provided. The bug was reported upstream with all necessary details to help the maintainers identify and fix the issue.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.