Skip to content

Don't check //HOST/... paths on other hosts in file link detection - #757

Closed
vjohansen wants to merge 1 commit into
dakra:mainfrom
vjohansen:unc-path-fix
Closed

vjohansen wants to merge 1 commit into
dakra:mainfrom
vjohansen:unc-path-fix

Conversation

@vjohansen

Copy link
Copy Markdown
Contributor

This PR causes link checker to ignore //foo paths (UNC paths) on Windows. This fixes the issue where file-exists-p call in ghostel--detect-urls hangs for a 20 seconds (C-g has no effect)

An exception is made for the paths on the same host. I opened a shell on a UNC path and verified the // links were detected

UNC paths are a known source of Windows bugs in Emacs packages, e.g.

On Windows a file name starting with // is a network share, and
checking whether it exists connects to that host.  Terminal output is
full of text the file pattern takes for such a path, like npm's
`//registry.example.com/' warnings or the //localhost half of a ws://
URL, so a scan could freeze Emacs for up to 21 seconds, the TCP connect
timeout, with C-g unable to stop it.

- `ghostel--file-exists-p' treats a //HOST/... path as missing on
  MS-Windows and Cygwin without asking the host, so it is never linked.
  The file pass of `ghostel--detect-urls' checks paths through it.
- A path on the host `default-directory' is on is still checked,
  compared ignoring case (`ghostel--share-host').  A shell running on a
  share has just reached that host, and its relative paths expand to
  //HOST/... too, so its files keep their links.
@dakra

dakra commented Oct 24, 2026

Copy link
Copy Markdown
Owner

@vjohansen Thanks. Do you want to check #759
Would this also be acceptable for you? Yours is slightly "more correct" on Windows but #759 is only 1 line
and also fixes a bug where // in // code comment is not linkified anymore.

@vjohansen

Copy link
Copy Markdown
Contributor Author

Yes, that is fine

@dakra

dakra commented Oct 24, 2026

Copy link
Copy Markdown
Owner

OK, thanks. Closing this PR then in favor of #759

@dakra dakra closed this Oct 24, 2026
@vjohansen
vjohansen deleted the unc-path-fix branch October 24, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants