Skip to content

fix(amuleweb): change --upnp-port from switch to numeric option - #820

Merged
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:fix-amuleweb-upnp-port-option
Jun 2, 2026
Merged

fix(amuleweb): change --upnp-port from switch to numeric option#820
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:fix-amuleweb-upnp-port-option

Conversation

@got3nks

@got3nks got3nks commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #816amuleweb's --upnp-port (-U) was declared as a switch but the parser tries to read a numeric value from it via parser.Found("upnp-port", &port), so the flag silently never worked.

Fix

One-line change in src/webserver/src/WebInterface.cpp:248: switch from AddSwitch to AddOption with wxCMD_LINE_VAL_NUMBER, mirroring the --server-port declaration a few lines above.

Verify

  • macOS local build (cmake --build build --target amuleweb) green.
  • amuleweb --help shows the option as accepting a value:
      -s, --server-port=<num>      Web server HTTP port
      -U, --upnp-port=<num>        UPnP port
    
  • CI green.
  • Manual: amuleweb --upnp-port=4729 accepts the value and uses it (no "Cannot find option/switch" error).

The --upnp-port (-U) command-line argument was declared with
AddSwitch — a flag that takes no value — while OnCmdLineParsed
later reads a numeric port from it via parser.Found("upnp-port",
&port). Switches never carry a value, so the call silently
failed and m_UPnPTCPPort could only be set by editing
remote.conf directly.

Switch to AddOption with wxCMD_LINE_VAL_NUMBER, matching the
existing --server-port declaration a few lines above.

Closes amule-project#816.
@ngosang

ngosang commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

@got3nks the man page is correct?

@got3nks

got3nks commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

Yes, the man page is already correct — amuleweb.1 documents -U <port> / --upnp-port <port> in both the SYNOPSIS (line 19) and the option description block (lines 85-86):

[ -U <port>, --upnp-port <port> ]

UPnP port.

The bug was just the C++ declaration disagreeing with the man page; this PR makes the code match what was already documented. Post-PR amuleweb --help lines up with it (-U, --upnp-port=<num>, as in the PR body).

@got3nks

got3nks commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

@ngosang — packaging dispatched, all platforms, branch fix-amuleweb-upnp-port-option:

https://github.com/got3nks/amule/actions/runs/26841643217

Once it's green, scroll to "Artifacts" at the bottom (GitHub login needed). Extracted amuleweb --help should show -U, --upnp-port=<num> (with =<num> showing it now takes a value), and amuleweb --upnp-port 4729 should accept the port instead of erroring as a switch.

@mrjimenez
mrjimenez merged commit 2f89cb1 into amule-project:master Jun 2, 2026
7 checks passed
@got3nks
got3nks deleted the fix-amuleweb-upnp-port-option branch June 3, 2026 14:16
mrjimenez pushed a commit to mrjimenez/amule that referenced this pull request Aug 8, 2026
…ject#820)

WITH_LIBAYATANA_APPINDICATOR is flipped on by a pkg_check_modules probe for
ayatana-appindicator3-0.1, so whether the SNI tray backend compiles depends
on whether that dev package happens to be installed. It was in no workflow's
cmake_ubuntu_deps, so the appindicator half of the tray code -- the backend
used on Linux desktops -- was #ifdef'd out on every pre-merge job.

packaging.yml does build it, via the AppImage Dockerfile and the Flatpak
manifest, but that workflow fires on push to master rather than on open PRs.
So a break in that half passed every check on the PR and was first compiled
once it had already landed.

ccpp.yml, clang-tidy.yml and codeql.yml each carry their own dep list, so all
three needed it: one to compile the code, the others to lint and analyse it.

Tier-1 clang-tidy is a zero-warnings-under-src gate, so making previously
invisible code visible could have turned it red on pre-existing findings. It
does not: all four files referencing the option -- MuleTrayIcon.cpp,
MuleTrayIcon.h, amule.cpp and amuleDlg.cpp -- report zero Tier-1 findings
with the backend enabled. Each zero was control-checked with
readability-magic-numbers (124/136/162 warnings) to confirm the translation
units were really analysed rather than skipped.

Confirmed in this PR's own CI: both Ubuntu jobs report "AppIndicator3 found:
ayatana-appindicator3-0.1 0.5.90 — tray icon uses SNI backend".
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.

amuleweb: -U / --upnp-port is registered as a switch and cannot accept a port value

3 participants