[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: The ls command



On 2025-10-31 21:31:32 +0000, David wrote:
> On Fri, 31 Oct 2025 at 17:43, Vincent Lefevre <vincent@vinc17.net> wrote:
> > And one can make xterm on trixie (not that old) crash:
> 
> >   xterm -k8 -e 'printf "\x9a\x85\x08"; sleep 2'
> 
> Thanks for the runnable demo!
[...]
> When I copied and pasted the above into vim to write this message, I can
> see that the 'echo *' did output the bytes <9a><85>. I guess there might
> have also been a bell <08> that I did not hear (for whatever reason, that's
> not important).

It is the bell character, but it ends an escape sequence, i.e. it
has a special meaning.

> But the xterm did not crash, it continued to function.

Not sure whether you did it right, but to make the crash occurs
depends on the context.

> So that made your demo less convincing to me, I was hoping it would crash.
> 
> Do you have a better example?

Perhaps something like an escape sequence to clear the screen first
(just before the \x9a\x85\x08). I have not tried.

> Why did you choose the bytes \x9a\x85\x08 ?

The bug initially occurred when I ran a command generating binary
data for which I forgot to redirect the output to a file. The file
was initially huge (several MB, IIRC). Then I tried to get a minimal
example. To make things easier, I did my tests with something like

  xterm -e 'cat file'

(the -k8 is not needed for me since this is from my default config
via X resources -- I had added it in 2005 for more security, at the
time ISO-8859-1 was still in use, to prevent the characters 128-159
from being regarded as control characters).

I think that the "sleep 2" was not needed initially because there
were additional characters from the file that were introducing the
needed delay. In a text editor, I reduced the file with some form
of dichotomy, and eventually obtained a file reduced to the above
3 characters.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)


Reply to: