cli(hostname): a name past 63 characters is refused, and the old name kept #2532

Merged
jaylouisw merged 1 commit from rev/1124-0412 into main 2026-11-24 05:38:05 +00:00
Owner

One narrow question: what does an IOS-like box do with a hostname longer than the 63 characters every reference calls the ceiling — refuse it, truncate it, or store it anyway?

Verdict: refused, in a fixed sentence, and the name is left alone. The console had no length rule, so hostname <64 chars> renamed the device everywhere (config line, device.name, prompt, canvas label) into a name no box will hold.

sw1(config)# hostname aaaa…aaaa        <- 64 characters
% Hostname must have more than 1 character and must not exceed the maximum 63 character length.
  64 characters, so the name is still "sw1"

The first line is the vendor's, verbatim. The second is this console's: the count, and the name that survived, following the same rule as the existing missing-argument refusal (#1497).

Evidence

Source Says
Cisco IOS Configuration Fundamentals Command Reference, F–K — hostname "Names must be 63 characters or fewer", stated as a rule of the command.
IOS XE 17.12.x Catalyst 9300 — System Management Commands, hostname Same limit, same words, on IOS XE.
Cisco Learning Network, "Hostname length" A live session on the boundary: 63 taken, 64 refused with the sentence above, prompt unchanged afterwards.
Cisco Community, "Maximum length Hostname" The apparent contradiction: a CAT6500 reporting names "truncated to 12 characters" — that is the prompt field, not the stored name.
Aruba AOS-CX hostname Another vendor refusing the same shape, so 63 is not one vendor's quirk.

Changes

  • engine/cli.js: HOSTNAME_MAX = 63 + hostnameLengthRefusal(), asked after the help-key refusal and before the all-numeric warning — a 64-digit name breaches both, and the box answers the one that stops the command. A refusal changes no state.
  • test/hostname-length-limit.test.js (new): 25 assertions — 63 taken whole (config, device.name, prompt, running-config), 64 refused with both lines and all state unchanged, 200-character count, 64-digit precedence, spaces counted at the boundary, no hostname still working after a refusal.
  • test/config-roundtrip.test.js: the four catalogue models whose default name is a >63-character model string (three Huawei NetEngine 8000 M14 variants, one Aruba Instant On 1830) now seed a legal name — the sweep was replaying a hostname line a real box refuses. Fixture, not rule.
  • docs/CLI.md, research/hostname-length-limit.md: the rule, the citations, and what is still unmodelled.

Quality gates

  • node scripts/syntax-check.js: 563 files (554 JS, 9 TS), all OK.
  • Full npm test: 479 suites, 16,089 assertions, 0 failed (763 s).

Remaining unresolved

  1. The lower bound in the same sentence ("more than 1 character"): a one-character name is still accepted here; no capture shows it refused.
  2. Whether an unrenamed device should print a hostname line at all — the printer writes config.hostname || device.name, which is what put a 100-character line in those four configs. A printer question, left for its own run.
  3. The 30-column prompt field (and the CAT6500's 12) is unmodelled.
One narrow question: what does an IOS-like box do with a `hostname` longer than the 63 characters every reference calls the ceiling — refuse it, truncate it, or store it anyway? **Verdict: refused, in a fixed sentence, and the name is left alone.** The console had no length rule, so `hostname <64 chars>` renamed the device everywhere (config line, `device.name`, prompt, canvas label) into a name no box will hold. ``` sw1(config)# hostname aaaa…aaaa <- 64 characters % Hostname must have more than 1 character and must not exceed the maximum 63 character length. 64 characters, so the name is still "sw1" ``` The first line is the vendor's, verbatim. The second is this console's: the count, and the name that survived, following the same rule as the existing missing-argument refusal (#1497). ### Evidence | Source | Says | | --- | --- | | [Cisco IOS Configuration Fundamentals Command Reference, F–K — `hostname`](https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/fundamentals/command/cf_command_ref/F_through_K.html) | "Names must be 63 characters or fewer", stated as a rule of the command. | | [IOS XE 17.12.x Catalyst 9300 — System Management Commands, `hostname`](http://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst9300/software/release/17-12/command_reference/b_1712_9300_cr/system_management_commands.html) | Same limit, same words, on IOS XE. | | [Cisco Learning Network, "Hostname length"](https://learningnetwork.cisco.com/s/question/0D53i00000KsyjTCAR/hostname-length) | A live session on the boundary: 63 taken, 64 refused with the sentence above, prompt unchanged afterwards. | | [Cisco Community, "Maximum length Hostname"](https://community.cisco.com/t5/other-network-architecture-subjects/maximum-length-hostname/td-p/529327) | The apparent contradiction: a CAT6500 reporting names "truncated to 12 characters" — that is the **prompt** field, not the stored name. | | [Aruba AOS-CX `hostname`](https://arubanetworking.hpe.com/techdocs/AOS-CX/10.18.xxxx/HTML/Fundamentals_6300-6400/switch-system-and-hardware-commands/hostname.html) | Another vendor refusing the same shape, so 63 is not one vendor's quirk. | ### Changes - `engine/cli.js`: `HOSTNAME_MAX = 63` + `hostnameLengthRefusal()`, asked after the help-key refusal and **before** the all-numeric warning — a 64-digit name breaches both, and the box answers the one that stops the command. A refusal changes no state. - `test/hostname-length-limit.test.js` (new): 25 assertions — 63 taken whole (config, `device.name`, prompt, running-config), 64 refused with both lines and all state unchanged, 200-character count, 64-digit precedence, spaces counted at the boundary, `no hostname` still working after a refusal. - `test/config-roundtrip.test.js`: the four catalogue models whose default name is a >63-character model string (three Huawei NetEngine 8000 M14 variants, one Aruba Instant On 1830) now seed a legal name — the sweep was replaying a `hostname` line a real box refuses. Fixture, not rule. - `docs/CLI.md`, `research/hostname-length-limit.md`: the rule, the citations, and what is still unmodelled. ### Quality gates - `node scripts/syntax-check.js`: 563 files (554 JS, 9 TS), all OK. - Full `npm test`: **479 suites, 16,089 assertions, 0 failed** (763 s). ### Remaining unresolved 1. The lower bound in the same sentence ("more than 1 character"): a one-character name is still accepted here; no capture shows it refused. 2. Whether an unrenamed device should print a `hostname` line at all — the printer writes `config.hostname || device.name`, which is what put a 100-character line in those four configs. A printer question, left for its own run. 3. The 30-column prompt field (and the CAT6500's 12) is unmodelled.
cli(hostname): a name past 63 characters is refused, and the old name kept
All checks were successful
CI / Typecheck (pull_request) Successful in 16s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 12s
CI / Server smoke and Docker build (pull_request) Successful in 46s
CI / Test (Node 22) (pull_request) Successful in 55s
CI / Test (Node 24) (pull_request) Successful in 59s
CI / Arm auto-merge (pull_request) Successful in 4s
29c013a8dd
Every IOS/IOS XE hostname reference states the 63-character ceiling, and a
recorded session on the boundary shows the 64-character name refused with
'% Hostname must have more than 1 character and must not exceed the maximum 63
character length.' and the prompt unchanged. The console had no length rule, so
hostname <64 chars> renamed the device everywhere.

The rule is asked before the all-numeric warning, since a 64-digit name breaches
both and the box answers the one that stops the command. The lower bound the
same sentence names is left unmodelled: no capture shows a one-character name
refused (research/hostname-length-limit.md).

test/config-roundtrip.test.js seeds a legal name for the four catalogue models
whose default name is a model string past the ceiling, because the printer wrote
it as the hostname line and the sweep replayed a name a box refuses.
forgejo-actions scheduled this pull request to auto merge when all checks succeed 2026-11-24 05:29:49 +00:00
jaylouisw deleted branch rev/1124-0412 2026-11-24 05:38:10 +00:00
Sign in to join this conversation.
No description provided.