Skip to content

fix(native): preserve final demangled symbol whitespace - #681

Closed
rudycelekli wants to merge 1 commit into
morluto:mainfrom
rudycelekli:fix/rea-demangle-whitespace-20261006
Closed

rudycelekli wants to merge 1 commit into
morluto:mainfrom
rudycelekli:fix/rea-demangle-whitespace-20261006

Conversation

@rudycelekli

Copy link
Copy Markdown

Problem

The Swift demangler parser calls trimEnd() on the whole utility output before splitting rows. This removes legitimate trailing spaces or tabs from the final unchanged symbol. A final symbol consisting of a space loses its row entirely and the native operation fails with an output-count mismatch.

Change

Remove only the utility's final line terminator, preserving each symbol's content and input ordering. Retain CRLF support and existing invalid/unchanged classifications.

Verification

  • Before fix: the added focused whitespace regression fails.
  • Actual host xcrun swift-demangle --compact preserves the ordinary trailing space, tab and single-space symbols. The public NativeMacOSProvider demangle operation fails with the count mismatch before the fix and returns all four ordered rows after it, including the genuine Swift mangled control.
  • After fix: all 19 focused parser/provider tests pass, and all five npm run check tasks pass using Node 24.18.0 and locked dependencies.

This proves the Swift utility/parser boundary on this host. It does not claim target execution, Ghidra or Hopper verification.

AI assistance was used for investigation, implementation, tests and this description. The patch was independently reviewed, tested and submitted by the contributor; native proof and limitations are stated above.

@morluto morluto left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve: strip only the final line terminator instead of trimEnd so trailing space/tab on the final demangled symbol is preserved; strict count check retained. Co-located tests cover trailing space/tab/lone-space + CRLF ordering. Checks green.

@morluto

morluto commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Superseded by #705, which cherry-picks this change (plus 13 sibling fixes) onto current main with conflict resolution and regenerated catalogs. Closing to keep one reviewable merge unit.

@morluto morluto closed this Oct 6, 2026
@morluto

morluto commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Thanks, @rudycelekli, for your work on “fix(native): preserve final demangled symbol whitespace.” I appreciate your contribution to REA.

@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants