tags 432682 + patch
thanks

Sorry, that bug report didn't actually say anything! Here's the real 
backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000403828 in ch_length () at ch.c:508
508             if (ch_flags & CH_HELPFILE)
(gdb) bt
#0  0x0000000000403828 in ch_length () at ch.c:508
#1  0x00000000004041cd in ch_seek (pos=0) at ch.c:419
#2  0x000000000040b7cd in jump_loc (pos=0, sline=0) at jump.c:199
#3  0x000000000040baf4 in repaint () at jump.c:98
#4  0x00000000004105fb in error (fmt=0x415328 "%s", parg=0x7fffd65b9a10) at 
output.c:529
#5  0x00000000004092b6 in edit_ifile (ifile=0x6277d0) at edit.c:311
#6  0x000000000040946a in edit_istep (h=0x6277d0, n=-1, dir=1) at edit.c:527
#7  0x0000000000407167 in commands () at command.c:1412
#8  0x0000000000402158 in main (argc=<value optimized out>, argv=<value 
optimized out>) at main.c:286

My interpretation of the crash is that less is attempting to get information 
about the file it's failing to display in order to decide where to place the 
cursor. It decides that the display is "squished", meaning that the first 
displayed line is not at the top of the screen, and wants to repaint the 
screen. This repaint causes it to try to find out the final cursor location 
from the current position in the (non-existant) file, and crash.

This repainting behaviour seemed to have no effect in any test case I could 
come up with, so I removed it. The patch that does this is:

--- output.c.orig       2007-07-15 18:51:25.000000000 +0100
+++ output.c    2007-07-15 19:07:09.000000000 +0100
@@ -525,8 +525,6 @@

        if (any_display && is_tty)
        {
-               if (!oldbot)
-                       squish_check();
                at_exit();
                clear_bot();
                at_enter(AT_STANDOUT);

Of course, less's assessment that the display is "squished" is wrong anyway 
(it blanked the screen before displaying this short file) which is why I 
believe it's safe to remove it. However, if you disagree with this resolution 
you might like to investigate making the squished detection more clever.

Bruce

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to