Skip to content

index: skip entries with invalid bytes instead of panicking#295

Open
amaanq wants to merge 2 commits intonix-community:masterfrom
amaanq:graceful-newlines
Open

index: skip entries with invalid bytes instead of panicking#295
amaanq wants to merge 2 commits intonix-community:masterfrom
amaanq:graceful-newlines

Conversation

@amaanq
Copy link

@amaanq amaanq commented Jan 24, 2026

Problem

The frcode format uses newlines as entry delimiters, so it can't handle paths or symlink targets containing literal newline characters. When indexing encounters such an entry (e.g., from rose-pine-icon-theme which has ~117k symlinks with trailing newlines in their targets), the encoder panics.

There is also a copy-paste bug in write_path where the second assertion checked for \x00 but the error message said "newlines".

Solution

This PR gracefully handles entries with invalid bytes by skipping them instead of panicking, and reporting them at the end. Here's an example of the output:

warning: skipped 1 entries with invalid bytes (newlines/NUL in paths)
  - candy-icons-0-unstable-2026-01-13: 1 entries

By default, only the first 5 broken entries are shown, so I added a verbose flag to show all of them. Frankly, I'd be surprised if someone had many packages with broken entries, so it might be ok to not add the verbose flag, I'll leave that up to the reviewer.

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.

Thread panic w/ reason "entry must not contain newlines"

1 participant