increasing LINES and COLS [was Re: suggestion]



Hi Pavel,

On Sun, 2004-10-10 at 10:40, Pavel Tsekov wrote:
> I suggest that we alter the check in src/slint.c to something like that:
> 
> if ((COLS < 10) || (LINES < 5) ||
>     (SLang_Version < 10407 && (COLS > 255 || LINES > 255)) ||
>     (SLang_Version >= 10407 && (COLS > 512 || LINES > 512)))
> 
> Also the in-tree version of S-Lang should be brought to the current
> version. Now we have 1.4.5 while latest stable S-Lang is 1.4.9.

I don't see a crash when resizing an instance of mc in an xterm to more
than 600 columns on Fedora Core 1, slang-1.4.5. I do of course get the
error when starting an instance of mc in such a large terminal.

The version of slang coming with FC1 is patched. Two of the patches,
namely slang-debian-utf8.patch and slang-utf8-fix.patch affect
send_attr_str(). I suspect the following part of the
slang-debian-utf8.patch to hold the fix for this issue which is:

 static void send_attr_str (SLsmg_Char_Type *s)
 {
-   unsigned char out[256], ch, *p;
+#ifdef UTF8
+   SLsmg_Char_Type out[1024], ch, *p;
+#else
+   unsigned char out[1024], ch, *p;
+#endif /* UTF8 */
    register SLtt_Char_Type attr;

Indeed in 1.4.9 the above 256 has been replaced with
SLTT_MAX_SCREEN_COLS.

I understand Roland can reproduce the crash when resizing the screen
horizontally, but is the crash also reproducible when resizing a
terminal vertically?

If we do patch the included version of slang by increasing the size of
out[] in send_attr_str the below patch might also need a test whether
the internal slang is used (patching SLang_Version in the internal
slang.h and testing for this version as well as 10407).

--- slint.c.000	2004-09-26 00:02:15.000000000 +0200
+++ slint.c	2004-10-31 23:07:16.000000000 +0100
@@ -183,7 +183,10 @@ slang_init (void)
     * (as of S-Lang 1.4.4). Detect it and abort. Also detect extremely
     * small, large and negative screen dimensions.
     */
-    if ((COLS < 10) || (LINES < 5) || (COLS > 255) || (LINES > 255)) {
+    if ((COLS < 10) || (LINES < 5) ||
+    (SLang_Version < 10407 && (COLS > 255 || LINES > 255)) ||
+    (SLang_Version >= 10407 && (COLS > 512 || LINES > 512))) {
+
 	fprintf (stderr,
 		 _("Screen size %dx%d is not supported.\n"
 		   "Check the TERM environment variable.\n"),

I think we should wait with upgrading the included version of slang
until after 4.6.1, but if there is need we could fix the screen size
according to the above.

And of course there is the issue that LINES and COLS should be checked
on resize and not only on initialization of slang. The segfault is
probably still reproducible for COLS > 1024 on FC1 or COLS > 512 when
using slang 1.4.9.

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research





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