pirania: remove dead code and legacy artifacts

Open
#1,249 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Quiet
Tech stack
lua
Domain
backend

Research direction

Read the listed files in packages/pirania/files/ and check the references to client_ip, show_url, change_url, append_nft_rules, and functools.lua; the issue says the Lua module has no imports and the UCI option has no effect. Remove the specified dead artifacts and stale show_url ACL entries, then verify no references to the removed methods remain. Done means all five cleanup items in the issue are addressed.

Written by the indexing model from the issue text.

Description

Summary

While preparing the pirania package for a merge, several dead code items and legacy artifacts were identified that should be cleaned up in a follow-up.

Items

1. Broken CGI endpoint: client_ip

File: packages/pirania/files/www/cgi-bin/pirania/client_ip

This CGI script imports voucher.logic and voucher.db (lines 4-5) — neither module exists. The modules were renamed to voucher.vouchera, voucher.store, etc. long ago. If this endpoint is ever hit, it produces a 500 error. It is not called by any portal page or JS in the current codebase.

Action: Delete the file.


2. Dead portal_url ubus API (legacy, non-functional)

File: packages/pirania/files/usr/libexec/rpcd/pirania (lines 55-64, 102-103)

The show_url and change_url ubus methods read/write pirania.base_config.portal_url, but this UCI key does not exist in the config. The actual portal redirect uses portal_domain + url_auth/url_portal. These methods are effectively no-ops.

Action: Remove show_url and change_url from the rpcd script and the methods table.


3. Stale UCI option: append_nft_rules

File: packages/pirania/files/etc/config/pirania (line 11)

option append_nft_rules '0'  # if set to 1, iptables rules will be Appended instead of Inserted

The comment still says "iptables" and the option has no effect in the current nftables implementation. The captive-portal script always recreates the table from scratch.

Action: Remove this option from the UCI config.


4. Dead code: functools.lua is never imported

File: packages/pirania/files/usr/lib/lua/voucher/functools.lua

This 90-line module provides curry, reverse, map, filter, and search functions, but nothing in the entire codebase requires or imports it.

Action: Delete the file.

Context

Identified during review of branch hotfix/pirania before merge. These are safe mechanical cleanups that do not affect any working functionality.


5. Stale ACL references to legacy show_url method

File: packages/pirania/files/usr/share/rpcd/acl.d/pirania.json (lines 6, 14)

The ACL file grants access to the legacy show_url method in both the unauthenticated and lime-app roles. When items 1-2 above are resolved (removing show_url/change_url from rpcd), these ACL entries should also be cleaned up.

Action: Remove show_url from the ACL entries and replace with appropriate current methods if needed.'

Dominant language
Lua
Stars
338
Forks
113
Avg merge
8d 3h
Merged PRs (30d)
3

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from libremesh/lime-packages

All issues in libremesh/lime-packages

Similar issues

More Lua issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.