a ? at the end of a no line is not a question: no vlan 42 name ? deletes VLAN 42 and no hostname ? clears the name #1694

Closed
opened 2026-11-16 16:47:10 +00:00 by jaylouisw · 0 comments
Owner

The measurement

Found while sweeping the free-text positions for #1691. The no forms read the tokens they need and
ignore everything after them, so a ? typed where the operator expects help does not ask: it acts.

Catalyst2960(config)# hostname lab-1
Catalyst2960(config)# no hostname ?
Hostname cleared (device is now Catalyst 2960-d1)

Catalyst2960(config)# vlan 42 name lab
Catalyst2960(config)# no vlan 42 name ?
VLAN 42 removed

Catalyst2960(config-if)# description lab
Catalyst2960(config-if)# no description ?
Description removed: lab

no vlan 42 name ? is the worst of the three: the operator asked what name wants after
no vlan 42, and the VLAN is gone — with a receipt that reads like success, exactly the shape #1497
removed from the set forms and #1685 removed from the free-text ones.

Why this is not #1691

#1691 is a value that is stored: the key became a name, and refusing it at the point where the name
is written fixes it. Here the key is the last of several tokens, and the damage is done by the tokens
before it — no vlan 42 is a complete, destructive line on its own. The check has to run before the
no branch acts, and it has to know the syntax of the branch it is guarding, so the refusal can name
what was wanted instead of just complaining.

The shape of the fix

In config and interface mode, if the last token of a no line is exactly ?, refuse and change
nothing:

% "?" is the help key, not a value: `no vlan <id>` removes a VLAN - nothing was removed

The noun and the syntax come from the branch, so the answer is useful. A ? inside a longer word
(no vlan 42 name lab?1) is still part of the value. Worth pinning per branch: no hostname,
no vlan, no description, and the same sweep over the other no heads (no ip route, no ip nat pool, no spanning-tree) to see which of them also ignore trailing tokens.

## The measurement Found while sweeping the free-text positions for #1691. The `no` forms read the tokens they need and ignore everything after them, so a `?` typed where the operator expects help does not ask: it acts. ``` Catalyst2960(config)# hostname lab-1 Catalyst2960(config)# no hostname ? Hostname cleared (device is now Catalyst 2960-d1) Catalyst2960(config)# vlan 42 name lab Catalyst2960(config)# no vlan 42 name ? VLAN 42 removed Catalyst2960(config-if)# description lab Catalyst2960(config-if)# no description ? Description removed: lab ``` `no vlan 42 name ?` is the worst of the three: the operator asked what `name` wants after `no vlan 42`, and the VLAN is gone — with a receipt that reads like success, exactly the shape #1497 removed from the set forms and #1685 removed from the free-text ones. ## Why this is not #1691 #1691 is a value that is *stored*: the key became a name, and refusing it at the point where the name is written fixes it. Here the key is the last of several tokens, and the damage is done by the tokens *before* it — `no vlan 42` is a complete, destructive line on its own. The check has to run before the `no` branch acts, and it has to know the syntax of the branch it is guarding, so the refusal can name what was wanted instead of just complaining. ## The shape of the fix In config and interface mode, if the last token of a `no` line is exactly `?`, refuse and change nothing: ``` % "?" is the help key, not a value: `no vlan <id>` removes a VLAN - nothing was removed ``` The noun and the syntax come from the branch, so the answer is useful. A `?` inside a longer word (`no vlan 42 name lab?1`) is still part of the value. Worth pinning per branch: `no hostname`, `no vlan`, `no description`, and the same sweep over the other `no` heads (`no ip route`, `no ip nat pool`, `no spanning-tree`) to see which of them also ignore trailing tokens.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge#1694
No description provided.