Skip to content

Only treat a leading slash as absolute when resolving POSIX paths - #447

Merged
weichsel merged 1 commit into
mainfrom
fix/posix-tilde-symlink-resolution
Nov 20, 2026
Merged

weichsel merged 1 commit into
mainfrom
fix/posix-tilde-symlink-resolution

Conversation

@weichsel

@weichsel weichsel commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

resolvedPathComponents used NSString.isAbsolutePath, which on Darwin treats ~, ~/dir and ~name as absolute. POSIX resolves them relative to the link's parent. Since 3e67a18, extracting alias/document.txt through a symlink alias -> ~ threw Cocoa error 258, and archived symlinks with a ~ destination were rejected as uncontained.

  • On POSIX, a path is only absolute if its first UTF-8 byte is /. Windows still uses NSString.isAbsolutePath.
  • Adds regression tests for writing an entry through a real ~ symlink and for extracting symlinks with ~ destinations.

@weichsel weichsel self-assigned this Nov 20, 2026
NSString.isAbsolutePath classifies `~`, `~/dir` and `~name` as absolute
on Darwin, while the file system resolves them relative to the parent of
a symlink. Entries written through a symlink to a directory named `~`
were rejected, as were archived symlinks with such destinations.
@weichsel
weichsel force-pushed the fix/posix-tilde-symlink-resolution branch from 7d8e668 to c138d81 Compare November 20, 2026 15:59
@weichsel
weichsel merged commit a7e2f45 into main Nov 20, 2026
13 checks passed
@weichsel
weichsel deleted the fix/posix-tilde-symlink-resolution branch November 20, 2026 16:09
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.

1 participant