Repository navigation
fix(graph): don't put ':' in node file names on Windows - #1313
Merged
evilsocket merged 1 commit intoNov 3, 2026
Merged
Conversation
Node files are named after their key, e.g. endpoint_8c:1d:89:fe:12:eb.json. Windows can't create files with ':' in the name, so `graph on` failed with "The filename, directory name, or volume label syntax is incorrect" as soon as a node had to be read or written. Build the file name through one helper that replaces the characters Windows rejects with '_' there and leaves the names untouched elsewhere, so existing graph databases on Linux and macOS keep working. Fixes #1280
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1280
graph onfails on Windows withThe filename, directory name, or volume label syntax is incorrect. The graph module names each node file after its key, e.g.endpoint_8c:1d:89:fe:12:eb.json, and Windows can't create files with:in the name.All node file names now go through one helper (
Graph.nodeFile). On Windows it replaces the characters Windows rejects (< > : " / \ | ? *) with_. On other platforms the name is left as it is, so graph databases already on disk for Linux and macOS keep working. Node IDs and the keys inedges.jsonare unchanged; only the file name differs.Tests (
modules/graph/graph_test.go):TestSafeFileName: table test of the name mapping, withwindowstrue and false.TestNodeFileRoundTrip: creates a node with a MAC id and reads it back throughFindNode.TestEachNodeReadsBackNodes: theEachNodewalk thatgraph ondoes.The two round-trip tests fail on Windows without the change, with the same error as in the issue, and pass with it.
What I could not check:
graph onrun on Windows with a live network. I only ran the module's tests.pcap.h. The non-Windows path is only covered by thesafeFileNameunit test.go build ./...on my Windows box fails in cgo (no 64-bit gcc), with or without this change.I used an AI assistant while working on this.