Skip to content

fix: parse server-name updates as Unicode (no SRV_TCPFLG_UNICODE gate) - #835

Merged
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:fix-server-name-unicode
Jun 3, 2026
Merged

fix: parse server-name updates as Unicode (no SRV_TCPFLG_UNICODE gate)#835
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:fix-server-name-unicode

Conversation

@got3nks

@got3nks got3nks commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #831 — server names with emoji / non-ASCII characters get correctly read from server.met but mangle a few seconds later when amuled reconnects to the server.

Root cause

Server.cpp::AddTagFromFile parses the .met file with hardcoded Unicode=true, so the initial display is correct. Once amuled handshakes with the server, the runtime OP_SERVERIDENT (TCP, ServerSocket.cpp:444) and OP_SERVER_DESC_RES (UDP, ServerUDPSocket.cpp:281) responses re-parse the name via CTag tag(data, update->GetUnicodeSupport()). That gate returns false for servers that don't advertise SRV_TCPFLG_UNICODE — common in the wild even when the actual payload IS UTF-8. The non-Unicode parse mangles the bytes; SetListName overwrites the good name with mojibake.

Fix

Two-line change: force Unicode=true at both runtime parse sites. Matches:

  1. The .met load-time parse (Server.cpp::AddTagFromFile, hardcoded Unicode=true).
  2. Search-result parsing in the same file (ServerSocket.cpp:381), which already does true /*(cur_srv && cur_srv->GetUnicodeSupport())*/ with the original gate commented out.

So this PR aligns the server-name update path with two existing precedents for "GetUnicodeSupport is unreliable; force true."

Verify

  • macOS local build (cmake --build build --target amule) green.
  • CI green.
  • Manual: subscribe to https://upd.emule-security.org/server.met (the URL ngosang flagged in Bad Unicode characters in Networks / ED2k server list #831); the emoji server's name stays intact after connecting to it.

@ngosang's report on amule-project#831 (with @got3nks's timing observation): a
server whose .met name contains emoji/non-ASCII characters initially
displays correctly in the Networks tab, then a few seconds later
turns into mojibake.

Root cause: the .met-file load-time parse hardcodes Unicode=true
(Server.cpp::AddTagFromFile, line 157), so the name is read correctly
from disk. Once amuled connects to the server, the server's
OP_SERVERIDENT / OP_SERVER_DESC_RES response carries an updated name
parsed via `CTag tag(data, update->GetUnicodeSupport())`. That gate
returns false unless the server advertised SRV_TCPFLG_UNICODE — many
real-world servers ship UTF-8 strings without that capability flag,
and the non-Unicode parse mangles the bytes. SetListName then
overwrites the correct .met name with the corrupted one, and the UI
refreshes to show the mojibake.

Match the .met parse: force Unicode=true at both server-name update
sites — ServerSocket.cpp::OP_SERVERIDENT and ServerUDPSocket.cpp::
OP_SERVER_DESC_RES. There's existing precedent in the same file at
ServerSocket.cpp:381 where search-result parsing hardcodes Unicode=
true with the original GetUnicodeSupport() check commented out, so
this aligns with the search-list approach already in use.

Closes amule-project#831.
@mrjimenez
mrjimenez merged commit c0788e9 into amule-project:master Jun 3, 2026
7 checks passed
@got3nks
got3nks deleted the fix-server-name-unicode branch June 3, 2026 14:16
got3nks added a commit to got3nks/amule that referenced this pull request Jun 4, 2026
…ndex

Adds 55+ merged PRs to the 3.0.0 changelog since the last update
(amule-project#747, 2026-05-27). Narrative additions cover:

- Packaging: expanded the top list to include the macOS per-arch .app
  bundles and the Windows NSIS installer alongside the existing
  AppImage / Flatpak / .dmg / .zip entries. New bullets for amule-project#785
  (alc/alcc/cas/wxcas everywhere + Windows amuleweb), amule-project#794 (.dmg
  amuleweb path), amule-project#789 (<OS>-<arch> artifact naming), amule-project#780 / amule-project#796
  (Windows DPI + comctl32 manifest), amule-project#784 (FHS share/amule paths).

- Bug Fixes & Stability: post-amule-project#744 fixes including EC notification
  leak (amule-project#797), big-library scaling (amule-project#736, amule-project#840 superseding amule-project#728),
  amulegui ghost entries (amule-project#810, amule-project#819, amule-project#841, amule-project#824, amule-project#830, amule-project#760),
  PartFile early hash (amule-project#762), server protocol fixes (amule-project#835, amule-project#788,
  amule-project#721, amule-project#787), crypto stream UB (amule-project#779), UAF prevention (amule-project#756),
  Kad rotation (amule-project#795, amule-project#799/amule-project#805), GTK warning silencing (amule-project#833,
  amule-project#826/amule-project#836), and the clang-tidy worklist (amule-project#770, amule-project#772-amule-project#774).

- Translations: late-cycle wave covering French/Turkish manpages
  (amule-project#753/amule-project#754/amule-project#776), Galician (amule-project#763), Slovenian (amule-project#771), pt-BR
  (amule-project#768/amule-project#775/amule-project#812), French (amule-project#811), plus man-page tooling for
  date+version drift (amule-project#802).

- Contributors: added ngosang for UX feedback on the late-3.0
  cycle (amule-project#817/amule-project#818/amule-project#821/amule-project#828/amule-project#844) and ongoing work on the
  user-facing manual at amule-org.github.io.

- Merged PRs flat index: extended with amule-project#746-amule-project#845 + amule-project#841.
got3nks added a commit to got3nks/amule that referenced this pull request Jun 4, 2026
…ndex

Adds 55+ merged PRs to the 3.0.0 changelog since the last update
(amule-project#747, 2026-05-27). Narrative additions cover:

- Packaging: expanded the top list to include the macOS per-arch .app
  bundles and the Windows NSIS installer alongside the existing
  AppImage / Flatpak / .dmg / .zip entries. New bullets for amule-project#785
  (alc/alcc/cas/wxcas everywhere + Windows amuleweb), amule-project#794 (.dmg
  amuleweb path), amule-project#789 (<OS>-<arch> artifact naming), amule-project#780 / amule-project#796
  (Windows DPI + comctl32 manifest), amule-project#784 (FHS share/amule paths).

- Bug Fixes & Stability: post-amule-project#744 fixes including EC notification
  leak (amule-project#797), big-library scaling (amule-project#736, amule-project#840 superseding amule-project#728),
  amulegui ghost entries (amule-project#810, amule-project#819, amule-project#841, amule-project#824, amule-project#830, amule-project#760),
  PartFile early hash (amule-project#762), server protocol fixes (amule-project#835, amule-project#788,
  amule-project#721, amule-project#787), crypto stream UB (amule-project#779), UAF prevention (amule-project#756),
  Kad rotation (amule-project#795, amule-project#799/amule-project#805), GTK warning silencing (amule-project#833,
  amule-project#826/amule-project#836), and the clang-tidy worklist (amule-project#770, amule-project#772-amule-project#774).

- Translations: late-cycle wave covering French/Turkish manpages
  (amule-project#753/amule-project#754/amule-project#776), Galician (amule-project#763), Slovenian (amule-project#771), pt-BR
  (amule-project#768/amule-project#775/amule-project#812), French (amule-project#811), plus man-page tooling for
  date+version drift (amule-project#802).

- Contributors: added ngosang for UX feedback on the late-3.0
  cycle (amule-project#817/amule-project#818/amule-project#821/amule-project#828/amule-project#844) and ongoing work on the
  user-facing manual at amule-org.github.io.

- Merged PRs flat index: extended with amule-project#746-amule-project#845 + amule-project#841.
mrjimenez pushed a commit that referenced this pull request Jun 4, 2026
Adds 55+ merged PRs to the 3.0.0 changelog since the last update
(#747, 2026-05-27). Narrative additions cover:

- Packaging: expanded the top list to include the macOS per-arch .app
  bundles and the Windows NSIS installer alongside the existing
  AppImage / Flatpak / .dmg / .zip entries. New bullets for #785
  (alc/alcc/cas/wxcas everywhere + Windows amuleweb), #794 (.dmg
  amuleweb path), #789 (<OS>-<arch> artifact naming), #780 / #796
  (Windows DPI + comctl32 manifest), #784 (FHS share/amule paths).

- Bug Fixes & Stability: post-#744 fixes including EC notification
  leak (#797), big-library scaling (#736, #840 superseding #728),
  amulegui ghost entries (#810, #819, #841, #824, #830, #760),
  PartFile early hash (#762), server protocol fixes (#835, #788,
  #721, #787), crypto stream UB (#779), UAF prevention (#756),
  Kad rotation (#795, #799/#805), GTK warning silencing (#833,
  #826/#836), and the clang-tidy worklist (#770, #772-#774).

- Translations: late-cycle wave covering French/Turkish manpages
  (#753/#754/#776), Galician (#763), Slovenian (#771), pt-BR
  (#768/#775/#812), French (#811), plus man-page tooling for
  date+version drift (#802).

- Contributors: added ngosang for UX feedback on the late-3.0
  cycle (#817/#818/#821/#828/#844) and ongoing work on the
  user-facing manual at amule-org.github.io.

- Merged PRs flat index: extended with #746-#845 + #841.
mrjimenez pushed a commit to mrjimenez/amule that referenced this pull request Aug 8, 2026
…ack (amule-project#835)

Inside a Flatpak a host player such as /usr/bin/vlc is not on the sandbox's
filesystem, so launching it fails -- and nothing could report that. The async
wxExecute returns the pid as soon as the fork succeeds; execvp then fails in
the child, so the caller sees success and the only trace is wx's own
"execvp(/usr/bin/vlc, ...) failed with error 2" in the log.

An absolute program path is now checked before spawning, with IsFileExecutable
rather than a bare existence test -- a path that exists without the exec bit, a
data file or a wrapper script never chmod +x, would otherwise fail in exactly
the same invisible way.

How the failure is reported depends on whether the caller has a second option.
A completed media file falls back to the desktop handler, which in a Flatpak is
the portal and reaches the host's application, so the log line is enough. An
unfinished download has nothing to fall back to -- its ".part" has no handler --
so it says so in front of the user, the same way the no-player-configured case
already did.

A bare command name is left alone: resolving it would mean reimplementing the
PATH search the exec does anyway. Windows paths never reach the test and do not
need to -- CreateProcess fails synchronously, so the existing error path already
reports it; only the POSIX fork/exec pair can succeed at the fork and fail out
of sight in the child.

Not specific to Flatpak: a player uninstalled or renamed since it was
configured behaves the same way anywhere.
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.

Bad Unicode characters in Networks / ED2k server list

2 participants