[Bug 3765] New: Escape sequences are accepted more than documented

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Wed Dec 11 04:42:54 AEDT 2024


https://bugzilla.mindrot.org/show_bug.cgi?id=3765

            Bug ID: 3765
           Summary: Escape sequences are accepted more than documented
           Product: Portable OpenSSH
           Version: 8.9p1
          Hardware: amd64
                OS: Linux
            Status: NEW
          Severity: trivial
          Priority: P5
         Component: ssh
          Assignee: unassigned-bugs at mindrot.org
          Reporter: max.ferger at gmx.de

Hi!

This is only nit-picking, therefore I set "trivial" severity.

The help message displayed by the escape sequence `~?` ends on:
"(Note that escapes are only recognized immediately after newline.)"

But after having displayed this message, the ssh accepts also any other
escape sequence (at least `~?` and `~.`).

That's useful behavior, because one may (re-)call the help escape
sequence and then type the originally-intended escape sequence.

But it slightly contradicts the documented behavior, i.e. from `man 1
ssh`:

```
-e escape_char
             Sets the escape character for sessions with a pty
(default: ‘~’).
--->         The escape character is only recognized at the beginning
of a line.
             The escape character followed by a dot (‘.’) closes the
connection;
             followed by control-Z suspends the connection; and
followed by itself
             sends the escape character once.  Setting the character to
“none”
             disables any escapes and makes the session fully
transparent.
```

## Reproduce

1. Login `ssh example.com`
2. Type `<~> <?> <~> <#> <~> <#> <~> <.>`

## Observation (wrong)

The client shows the help message, then lists the forwarded connections
twice and then terminates the connection.

## Expected

Escape sequences should be ignored.

## Rationale

1. Arguably, right at the start is "at the beginning of a line", but
not "immediately after newline".
2. Escape sequences that follow escape sequences fulfill neither
description.

## Possible fix

Just change the documentation to match the behavior?

I suggest to add a phrase to the man page like: "Recognized escape
sequences are not transmitted."
... which implies that we're still at the beginning of the line.

Or may: "Note that escape sequences also work right at the start and
immediately after one another."

And maybe change the help message to: "(Note that escapes are only
recognized at the beginning of a line.)"

You may use all of the above at your digression.

Enjoy!

Max

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list