RE: nano hangs when pasting five characters

"Doug Smythies" <[email protected]>
Newsgroups gmane.editors.nano.devel
Message-ID <[email protected]>
On 2025.02.27 03:05 Benno Schulenberg wrote:
> Op 26-02-2025 om 17:36 schreef Doug Smythies:
>> The patch seems to work. It leaves the spurious "~" character in the pasted
>> text. But rings the bell and has a clear error message.
>
> The spurious "~" surprises me.  Are you sure you applied the patch
> to a clean git checkout or cleanly unpacked tarball (apart from the
> commenting of the #ifdef/#endif)?

Yes. I am using a git clone. And the patch did apply without issue.

>> 7 character paste buffer:
>> Sequence of hex codes: 102
>> Sequence of hex codes:  1b  5b  32  30  30  7e  31  32  33  34  35  36  37  1b  5b  32  30  31  7e
>> Sequence of hex codes:  18
>> Sequence of hex codes:  6e
>> 
>> 10 character paste buffer:
>> Sequence of hex codes: 102
>> Sequence of hex codes:  1b  5b  32  30  30  7e  31  32  33  34  35  36  37  38  39  30
>> Sequence of hex codes:  1b  5b  32  30  31  7e
>> Sequence of hex codes:  18
>> Sequence of hex codes:  6e
>
> Now I'm curious what happens for an 8 and 9 character paste.
> Because the above seems to suggest that OpenSSH_for_Windows
> /does/ know not to break escape sequences, but that the logic
> is faulty and goes wrong sometimes.

Agreed. I spent more time yesterday trying to find the spot in the
code but was not successful.

I didn't include the 8 and 9 character paste files, because they are
the same as the 7, but with the one extra character. The 10 character
one goes to 2 lines, but cleanly. Anyway, the 8 and 9 are below:

8 character:
Sequence of hex codes: 102
Sequence of hex codes:  1b  5b  32  30  30  7e  31  32  33  34  35  36  37  38  1b  5b  32  30  31  7e
Sequence of hex codes:  18
Sequence of hex codes:  6e

9 character
Sequence of hex codes: 102
Sequence of hex codes:  1b  5b  32  30  30  7e  31  32  33  34  35  36  37  38  39  1b  5b  32  30  31  7e
Sequence of hex codes:  18
Sequence of hex codes:  6e

> Anyway, please try the attached patch.  Make sure to apply it
> to a freshly unpacked and fully unmodified 8.3 tarball.  Both
> hunks should apply cleanly.  Then compile and run the new nano
> and paste five characters, a dozen or so times.  There should
> be no spurious tildes, no warnings, no bell.

Okay. Starting point:

doug@s19:~/temp-git-nano/nano$ git branch
* benno
  master
  v4
  v5
  v97a993

doug@s19:~/temp-git-nano/nano$ git status
On branch benno
nothing to commit, working tree clean
doug@s19:~/temp-git-nano/nano$ git log --oneline
63a7be11 (HEAD -> benno, origin/master, origin/HEAD, master) syntax: po: colorize also a 'msgctxt' line, and the 'c++-format' flag
fed31f2a syntax: po: colorize also Python's "%(name)x" format specifiers
5d496b31 syntax: po: colorize also the Python-specific conversion specifier "%r"
...

doug@s19:~/temp-git-nano/nano$ git apply wait-200ms.patch
doug@s19:~/temp-git-nano/nano$       <<<<< Applied without issue. Will check via git diff but not post here. Then edit for the "Sequence of hex codes" part. Then "make". Then execute via

doug@s19:~/c$ /home/doug/temp-git-nano/nano/src/nano bla2.txt 2>TRAIL-patch3-005
doug@s19:~/c$ doug@s19:~/c$ cat TRAIL-patch3-005
Sequence of hex codes: 102
Sequence of hex codes: 102
Sequence of hex codes:  1b  5b  32  30  30  7e  31  32  33  34  35  1b  5b  32  30  31
Sequence of hex codes:  18
Sequence of hex codes:   e

The patch worked as described, but that was just one paste. Then more 5 character pastes were done:

doug@s19:~/c$ /home/doug/temp-git-nano/nano/src/nano bla2.txt 2>TRAIL-patch3-005-2
doug@s19:~/c$ cat TRAIL-patch3-005-2
Sequence of hex codes: 102
Sequence of hex codes: 102
Sequence of hex codes:  1b  5b  32  30  30  7e  31  32  33  34  35  1b  5b  32  30  31
Sequence of hex codes:  1b  5b  32  30  30  7e  31  32  33  34  35  1b  5b  32  30  31  7e
Sequence of hex codes:  1b  5b  32  30  30  7e  31  32  33  34  35  1b  5b  32  30  31  7e
Sequence of hex codes:  1b  5b  32  30  30  7e  31  32  33  34  35  1b  5b  32  30  31  7e
Sequence of hex codes:  1b  5b  32  30  30  7e  31  32  33  34  35  1b  5b  32  30  31  7e
Sequence of hex codes:  1b  5b  32  30  30  7e  31  32  33  34  35  1b  5b  32  30  31  7e
Sequence of hex codes:  1b  5b  32  30  30  7e  31  32  33  34  35  1b  5b  32  30  31  7e
Sequence of hex codes:  1b  5b  32  30  30  7e  31  32  33  34  35  1b  5b  32  30  31  7e
Sequence of hex codes:  1b  5b  32  30  30  7e  31  32  33  34  35  1b  5b  32  30  31  7e
Sequence of hex codes:  1b  5b  32  30  30  7e  31  32  33  34  35  1b  5b  32  30  31
Sequence of hex codes:  1b  5b  32  30  30  7e  31  32  33  34  35  1b  5b  32  30  31  7e
Sequence of hex codes:  1b  5b  32  30  30  7e  31  32  33  34  35  1b  5b  32  30  31  7e
Sequence of hex codes:  1b  5b  32  30  30  7e  30  31  32  33  34  35  1b  5b  32  30  31  7e  <<< Okay, I did 6 not 5.
Sequence of hex codes: 105
Sequence of hex codes: 105
...
Sequence of hex codes: 105
Sequence of hex codes: 105
Sequence of hex codes:  1b  5b  32  30  30  7e  30  31  32  33  34  35  1b  5b  32  30  31  7e  <<<< Okay, did 6 again
Sequence of hex codes:  18
Sequence of hex codes:  6e

As mentioned yesterday, notice how sometimes the 5 character paste is not split and sometimes is.

... Doug
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.