tech-userlevel archive

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

Re: vi(1) one line crasher



Le Thu, Jun 22, 2023 at 08:00:22PM +0200, Martin Neitzel a écrit :
> Hi Thierry,
> 
> > If one opens this one line script in vi, in an xterm with default size,
> > using the dollar '$' to go to the end of the line crashes vi(1).
> 
> I cannot reproduce that with:
> 
> % env TERM=xterm LC_ALL=fr_FR.ISO8859-15 vi vi_crasher.txt 
> 
> with local (linux) xterm -> ssh netbsd-host -> vi
> 
> NetBSD 8.2_STABLE (GENERIC), amd64,  #3: Sat May  2 15:05:24 CEST 2020
> 
> /usr/bin/vi,
> :ve yields:  Version (1.81.6-2013-11-20nb4)
> and ts=8

Others seem unable to reproduce also, but for me it is 100%
reproducible.

So trying to put every info:

$ xwininfo


xwininfo: Please select the window about which you
          would like information by clicking the
          mouse in that window.

xwininfo: Window id: 0x60000d "xterm"

  Absolute upper-left X:  3
  Absolute upper-left Y:  24
  Relative upper-left X:  0
  Relative upper-left Y:  21
  Width: 884
  Height: 556
  Depth: 16
  Visual: 0x21
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x20 (installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +3+24  -713+24  -713-320  +3-320
  -geometry 80x24+1+1

(Note: the position has nothing to do with, the geometry has).

vi: set ts=8

A vis version of the one line

$ vis -w
\011\011v_stack[nval].ival\040=\040v_stack[nval-1].ival\040+\040v_stack[nval-1].len\011\012

Suspicious thing: when it crashes with ts=8, the last char displayed
just against the right border of the window (the remaining of the line
is not wrapped; it is simply not displayed) is the 'l' of the third
"nval". Then there are exactly 8 chars after before new line, the
last one being a tab (a tab and 8; and the width is 80)...

How to reproduce: in vi(1), use '$' to go to the end of the line.

Other way to reproduce for me. Set ts=4, move to the end of the line,
and then set ts=8.

The locales:
$ locale
LANG="POSIX"
LC_CTYPE="fr_FR.ISO8859-15"
LC_COLLATE="POSIX"
LC_TIME="POSIX"
LC_NUMERIC="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="fr_FR.ISO8859-15"
LC_ALL=""

and finally the window manager is twm (all are from NetBSD X11; not
pkgsrc).
-- 
        Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
                     http://www.kergis.com/
                    http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


Home | Main Index | Thread Index | Old Index