Fix Windows path-separator mismatch in vault_graph(); bump to 0.6.3#47
Merged
Conversation
vault_graph() filtered out control files (schema.md, index.md, log.md) at the vault root with: all_md[!basename(all_md) %in% control | dirname(all_md) != vault] On Linux dirname() returns paths with the system separator (/), which matches normalizePath()'s output. On Windows dirname() converts backslashes to forward slashes in its OUTPUT while normalizePath() defaults to backslashes -- so the comparison was always false and control files leaked into the graph. CRAN's win-builder caught it on 0.6.2 with: expect_error(vault_graph(vault = empty), "No pages in vault") returning "No error" because the empty-vault check never fired. Normalise vault with winslash = "/" so it matches dirname()'s forward-slash output on both platforms. Test reorganisation: the empty-vault regression test moves between the saber-installed gate and the saber-graph_svg gate, since vault_graph() errors before reaching the renderer and doesn't need graph_svg(). That way the test runs on machines whose saber is still at the current CRAN release (0.3.0). Same class of bug as 0.6.2 -- Windows path conventions diverging from Linux -- but a different mechanism. The 0.6.2 regex fix was masking this one.
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.
0.6.2 fixed the regex backreference in category_from_path(). That was masking a second Windows bug: vault_graph()'s control-file filter compared normalizePath(vault) (backslashes on Windows) against dirname(file) (forward slashes from dirname's normalisation). The comparison was always false, control files leaked, the 'No pages in vault' error never fired. CRAN's win-builder caught it on 0.6.2 with: 'expect_error(vault_graph(vault = empty), "No pages in vault")' returning 'No error'. Fix uses winslash = '/' in normalizePath. The empty-vault test also moves above the graph_svg gate so it runs on machines whose saber is at CRAN's current 0.3.0.