Skip to content

fix: cap export filename length to stay within NAME_MAX - #119

Merged
lance0 merged 1 commit into
masterfrom
fix/export-filename-length-cap
Jul 6, 2026
Merged

lance0 merged 1 commit into
masterfrom
fix/export-filename-length-cap

Conversation

@lance0

@lance0 lance0 commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Problem

export_json_file builds ttl-<target>-<timestamp>.json from the sanitized target. A maximum-length FQDN is 253 characters; with the ~25-byte fixed overhead the component exceeds the 255-byte NAME_MAX on Linux/macOS, so File::create fails with ENAMETOOLONG. Today that surfaces as a propagated error rather than a written file.

Fix

Cap the sanitized target to 200 bytes, truncating on a UTF-8 char boundary so multibyte targets don't panic.

Testing

  • New unit test: a 500-char ASCII target and a 300-char multibyte target both produce a <= 200-byte component with no panic.
  • cargo fmt, cargo clippy --all-targets -- -D warnings, and the full test suite pass locally.

A maximum-length FQDN (253 chars) plus the fixed ttl-<target>-<timestamp>.json
overhead exceeds the 255-byte per-component filesystem limit, so JSON export
failed with ENAMETOOLONG. Cap the sanitized target component to 200 bytes,
truncating on a char boundary so multibyte targets don't panic.
@lance0
lance0 merged commit 211ab3b into master Jul 6, 2026
5 checks passed
@lance0
lance0 deleted the fix/export-filename-length-cap branch July 6, 2026 17:19
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