Skip to content

Normalize large alias file IDs#23

Merged
jozefizso merged 1 commit into
mainfrom
codex/dmg-rtf-large-alias-file-ids
Apr 30, 2026
Merged

Normalize large alias file IDs#23
jozefizso merged 1 commit into
mainfrom
codex/dmg-rtf-large-alias-file-ids

Conversation

@jozefizso

Copy link
Copy Markdown
Member

Summary

Normalize macOS alias file IDs before writing them into the 32-bit fields used by the alias binary format.

Root Cause

APFS inode/file IDs on GitHub macOS runners can exceed uint32. create() copied fs.statSync(...).ino directly into the alias info object, then wrote the parent ID into the type-1 extra record with Buffer.writeUInt32BE(). The same IDs are also written by encode() into the base parent and target ID fields. When a runner returned an inode such as 12888353118, Node raised ERR_OUT_OF_RANGE before the alias could be encoded.

Fix

Added a small file-ID normalizer that keeps valid UInt32 values unchanged and reduces larger positive integer IDs modulo 2^32, matching the storage width of the alias format. create() uses it for target IDs, parent IDs, and the type-1 parent-ID extra record; encode() uses it for the base parent and target ID fields.

Validation

  • npm ci
  • npm test
  • npm audit --audit-level=moderate
  • npm ls --omit=dev --all
  • npm pack --dry-run
  • node --check index.js lib/create.js lib/encode.js lib/file-id.js lib/decode.js lib/is-alias.js lib/values.js test/basics.js test/addon.js

Beads: dmg-rtf

@jozefizso jozefizso merged commit b8da50f into main Apr 30, 2026
4 checks passed
@jozefizso jozefizso deleted the codex/dmg-rtf-large-alias-file-ids branch April 30, 2026 20:55
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