Skip to content

emrg: the index guard reads a Windows path as a URL and never measures it #2949

Closed

Description

@pm25coder

scripts/check-memory-index.py exempts a row link from the resolution reading when it looks like an external URL or a bare anchor. On Windows that exemption also swallows an absolute Windows path, because a drive letter spells C: and the pattern for a URL scheme is [a-z][a-z0-9+.-]*:.

What was observed

The guard resolves each row link against the index's own directory and reports the ones that name no file. NON_FILE_TARGET is the exemption list: a string starting with a URL scheme, or with #.

NON_FILE_TARGET = ^(?:[a-z][a-z0-9+.-]*:|#)

Measured on this host, with one row in the index and the target written three ways:

relative, beside it (control)  entry.md          exempt=False
forward-slash Windows path     C:/…/real-entry.md   exempt=True
backslash Windows path         C:\…\real-entry.md   exempt=True
a real URL                     https://example.com/x.md   exempt=True
a bare anchor                  #heading                    exempt=True

Because the target is exempted rather than measured, row_targets is empty and the run reports:

no row carries a ](target) link, so the resolution reading had no subject here
row links read: 0 - not one index read carries a ](target) link, so the resolution
reading had no subject anywhere here

That sentence is false about this index. The row did carry a ](target) link; it was excluded before the count. The exit code is 0 either way.

Why it matters

The cost is not the wording. An absolute path is a real pointer a reader follows, and it is the one carrier that never gets checked: if the file it names is gone, nothing reports it, and the report says the reading had no subject rather than that it declined to read one. The two outcomes - "no row links here" and "the row links here were not measured" - are the same sentence, which is the distinction the rest of this tool is careful to keep.

The tool's own docstring calls the exemption list complete, in as many words:

Named here as the whole exemption list, because an exemption that grows silently is how a check becomes vacuous.

A Windows drive letter grew into it silently: no argument was made for exempting it, and the code that would have argued it (#anchor and an external URL are not this tree's to resolve) does not apply to a path that names a file on this machine.

What the fix must satisfy

  1. A Windows drive-letter target is measured like any other path, not exempted: C:/… and C:\… both count as row links.
  2. A target that exists is resolved and not reported; a drive-letter target that does not exist is reported with its line number, like any other missing file.
  3. The exemptions the tool documents keep working: https://…, notes:… and #heading are still not measured, and an index whose only link is one of those still reports that the resolution reading had no subject.
  4. The exemption pattern still accepts a scheme name of two or more characters, so nothing legitimately URL-shaped starts being resolved as a path.

Acceptance

An index whose one row links C:/definitely/not/here.md exits 1 and names that target and its line. The same index with an existing drive-letter target exits 0 with row links 1. An index whose one row links https://example.com/x.md still exits 0 with the "resolution reading had no subject" sentence.

Activity

  1. pm25coder commented on Nov 17, 2026

    @pm25coder
    CollaboratorAuthor

    Handled by #2950

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions