Skip to content

Tolerate duplicate iconv aliases on macOS - #81

Open
pnavais wants to merge 2 commits into
rrthomas:masterfrom
pnavais:fix/darwin-iconv-duplicate-aliases
Open

pnavais wants to merge 2 commits into
rrthomas:masterfrom
pnavais:fix/darwin-iconv-duplicate-aliases

Conversation

@pnavais

@pnavais pnavais commented Sep 28, 2026

Copy link
Copy Markdown

On macOS, iconv -l lists some charset aliases under more than one group. In particular, WINDOWS-874 appears with both CP1162 and CP874. When tables.py turns that listing into iconvdecl.h, module_iconv then tries to declare the same alias for two different charsets and aborts initialization with a contradiction error. That makes the check phase fail on aarch64-darwin (and likely x86_64-darwin as well).

This change:

  1. In tables.py, when digesting iconv -l, keep only the first occurrence of each alias name.
  2. In module_iconv, if an alias is already bound to a different charset, keep the existing binding instead of failing.

Verified on aarch64-darwin with recode 3.7.16: 488 good tests.

macOS libiconv lists some names (e.g. WINDOWS-874) under more than one
charset group. Treat the first binding as authoritative so module_iconv
initialization no longer fails during the check phase on Darwin.
@pnavais

pnavais commented Sep 30, 2026

Copy link
Copy Markdown
Author

For reference, the macOS job in the existing CI already fails on master with this bug, and it affects both architectures:

I've opened #82 with those workflow changes, adding Intel macOS and fixing the Homebrew paths and the ASAN preload. It depends on this PR, so the two can be reviewed and merged together.

Drop the empty else-if branch; only declare aliases that are not
already known, with the explanatory comment moved above the check.
@pnavais
pnavais force-pushed the fix/darwin-iconv-duplicate-aliases branch from b83b13d to ba15819 Compare September 30, 2026 20:14
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