tagline: bump max length 260 -> 400, replace magic number with named constant#14
Open
vjt wants to merge 2 commits intoazzurra:masterfrom
Open
tagline: bump max length 260 -> 400, replace magic number with named constant#14vjt wants to merge 2 commits intoazzurra:masterfrom
vjt wants to merge 2 commits intoazzurra:masterfrom
Conversation
…constant Introduce TAGLINE_MAX_LEN in inc/tagline.h and replace the three literal 260 occurrences in src/tagline.c (ADD bound check, DEL bound check, and the error message sent to the caller) with references to it. The error string now interpolates the constant via %d so it stays in sync if the cap is ever adjusted again. The new value is 400 bytes. The accompanying block comment in tagline.h explains why this is not a free parameter: taglines are emitted via send_globops() which produces a server-wide NOTICE bounded by the IRC protocol's 512-byte line cap (RFC 1459 s.2.3.1). A realistic envelope -- server prefix + OperServ + the optional '(through <oper>)' variant + fixed boilerplate -- consumes ~100-110 bytes, so 400 leaves headroom for multibyte glyphs and long operator/server names without risking silent truncation at the uplink. Requested on #it-opers by Hypnotize (2026-04-21) as part of a general tagline-capacity bump; the named-constant + explanatory comment are his direct requirement.
Per Sonic's review on #it-opers: my previous comment underestimated the outbound GLOBOPS envelope. The binding constraint is not the client→hub PRIVMSG (short-form server-to-server prefix leaves ~480 bytes for the tagline text), but the NOTICE that bahamut produces out of the GLOBOPS broadcast to every +g operator. bahamut's src/send.c:send_globops prefixes the pattern with ":<server> NOTICE <destnick> :*** Global -- " before forwarding to each local +g client. Combined with services' own template "\2<caller>\2 (through \2<oper>\2) added the following tagline: <text>" the worst-case byte budget works out to ~230 + text against the 512-byte line cap (RFC 1459 s.2.3.1), i.e. a theoretical hard ceiling of ~280 with all three nicks at NICKMAX=32 and a 63-byte server hostname. Realistic Azzurra params (21-byte server name, 8-12 byte operator nicks) leave much more room, but 400 sat uncomfortably close to the worst case. 350 preserves a bump from the previous 260 while keeping clear of truncation in both realistic and near-worst-case combinations. The block comment now spells out the full envelope math so the next person bumping this value has a concrete formula rather than a hand-wave. Addresses review feedback from @azzurra-nethack / Sonic on PR azzurra#14.
Contributor
Author
|
Per request di @Hypnotize su #it-opers: @Essency (Sonic) per code review. Note: il valore finale nel PR è 350 (non 400). Il block comment in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TAGLINE_MAX_LENininc/tagline.hwith an English block comment explaining why the value is not a free parameter (512-byte IRC line cap,send_globops()envelope math).260insrc/tagline.c(ADD bound, DEL bound, error message) withTAGLINE_MAX_LEN; the user-facing error now formats the constant via%dinstead of hardcoding the number in the English string, so the two will never drift.Rationale
Requested on #it-opers by @Hypnotize (2026-04-21): existing limit felt tight and he wanted an increase. The final shape — named constant in the header, block comment documenting the constraint, no raw magic number left — is his direct requirement ("magic number non ne voglio vedere, constant" / "metti un commento in inglese sopra la costante per spiegare che non puoi bumpare arbitrariamente oltre").
Safety / Byte budget
Final value revised from the initial 400 to 350 after review with @Essency, who correctly flagged that the outbound NOTICE wrap in bahamut's
send_globops()includes both the services-side*** Global -- from <caller>: ...framing and the ircd-side:<server> NOTICE <dest> :*** Global -- ...envelope. Worst-case (HOSTMAX=63, NICKMAX=32 across caller/through/destnick, bold markers, full fixed tail) lands at ~230 bytes of overhead, leaving ~280 for the text. 350 is past the theoretical worst case for fully-loaded parameters but stays safely under 512 for every realistic Azzurra combination (server name ~16–21, oper nicks ~8–12) — see the block comment aboveTAGLINE_MAX_LENfor the full derivation and the explicit warning to re-derive both envelopes before bumping again.Test plan
make -C src(no warnings introduced).master+ servicesrefs/pull/14/head, 3-server topology (hub + leaf-v4 + leaf-v6 + services):TAGLINE ADD <349-byte string>→Your tagline has been added successfully.TAGLINE ADD <350-byte string>→Your tagline has been added successfully.TAGLINE ADD <351-byte string>→The maximum length for a tagline is 350 characters. Your tagline has 351.(constant + actual length both via%d, no drift).TAGLINE LISTafter the run shows the 349 and 350 entries (the 351 was rejected before storage).:hub.azzurra.chat NOTICE testoper :*** Global -- from OperServ: testoper added the following tagline: <350-byte text>GLOBOPS broadcast measured at 454 bytes on the wire, well under the 512 cap.Smoke harness notes
Auth trick for the testnet: REGISTER → /OPER → IDENTIFY in that order.
check_oper()atsrc/oper.c:603only promotes pastULEVEL_HOPwhenuser_is_ircop()is already true, so IDENTIFYing before /OPER leavesuser->oper == NULLand every ULEVEL_MASTER dispatch returnsAccess denied. Withtestoperalso configured asM:in services.conf,check_oper()auto-creates the Master oper entry (oper.c:586-591) on first identify — no pre-seeded oper db needed.