From szalai.bandi@gmail.com  Wed Feb 18 21:41:15 2009
Return-Path: <szalai.bandi@gmail.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CAC971065675
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 18 Feb 2009 21:41:15 +0000 (UTC)
	(envelope-from szalai.bandi@gmail.com)
Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.159])
	by mx1.freebsd.org (Postfix) with ESMTP id 4E1A78FC16
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 18 Feb 2009 21:41:14 +0000 (UTC)
	(envelope-from szalai.bandi@gmail.com)
Received: by fg-out-1718.google.com with SMTP id l26so827021fgb.35
        for <FreeBSD-gnats-submit@freebsd.org>; Wed, 18 Feb 2009 13:41:14 -0800 (PST)
Received: by 10.86.94.11 with SMTP id r11mr3032003fgb.11.1234991923859;
        Wed, 18 Feb 2009 13:18:43 -0800 (PST)
Received: from tristania.mooo.com (94-21-15-87.pool.digikabel.hu [94.21.15.87])
        by mx.google.com with ESMTPS id 4sm242929fge.54.2009.02.18.13.18.42
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Wed, 18 Feb 2009 13:18:43 -0800 (PST)
Received: by tristania.kispest.home (Postfix, from userid 1000)
	id 55865D4C69; Wed, 18 Feb 2009 22:14:43 +0100 (CET)
Message-Id: <20090218211443.GA6476@tristania.kispest.home>
Date: Wed, 18 Feb 2009 22:14:43 +0100
From: Szalai Andras <szalai.bandi@gmail.com>
Reply-To: Szalai Andras <szalai.bandi@gmail.com>
To: FreeBSD-gnats-submit@freebsd.org
Subject: [patch] devel/libslang2 line drawing characters bug
X-Send-Pr-Version: 3.113

>Number:         131857
>Category:       ports
>Synopsis:       [patch] devel/libslang2 line drawing characters bug
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    garga
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 18 21:50:00 UTC 2009
>Closed-Date:    Sat Feb 21 20:34:33 UTC 2009
>Last-Modified:  Sat Feb 21 20:40:04 UTC 2009
>Originator:     Szalai Andras
>Release:        FreeBSD 7.1-RELEASE-p1 i386
>Organization:
none
>Environment:
System: FreeBSD tristania.kispest.home 7.1-RELEASE-p1 FreeBSD 7.1-RELEASE-p1 #0: Sun Jan 11 17:34:03 CET 2009 root@tristania.kispest.home:/disk/ad8p5/root.usr/src/sys/i386/compile/TRISTANIA i386

Relevant package versions:

mc-4.6.2
libslang2-2.1.4

>Description:

If you execute an application (e.g. mc), which uses devel/libslang2 to
do screen I/O on a non-unicode terminal then the line drawing characters
will appear as spaces.

>How-To-Repeat:

$ export LANG=en_US.ISO8859-1
$ mc

>Fix:

I have tracked the problem down to a bug in the slang2 library. In the file
src/sldisply.c there is a function named tt_tgetstr which reads out capability
strings from termcap.

This function calls ncurses' tgetstr which does the real work, however the
buffer for the capability string is a local variable (which will be filled by
tgetstr). But in case of the "ac" capability, tt_tgetstr returns with the
address of this buffer, and therefore it will point to an invalid address.

The attached patch solves this isssue.

--- src.diff begins here ---
diff -ru orig/src/sldisply.c new/src/sldisply.c
--- orig/src/sldisply.c	2008-08-25 02:20:40.000000000 +0200
+++ new/src/sldisply.c	2009-02-15 16:58:30.000000000 +0100
@@ -2229,14 +2229,6 @@
    s = _pSLtt_tigetstr (Terminfo, cap);
 #endif
 
-   /* Do not strip pad info for alternate character set.  I need to make
-    * this more general.
-    */
-   /* FIXME: Priority=low; */
-   if (0 == strcmp (cap, "ac"))
-     return s;
-
-   s = fixup_tgetstr (s);
 #ifdef USE_TERMCAP
    if ((s >= area_buf) && (s < area_buf + sizeof(area_buf)))
      {
@@ -2249,6 +2241,15 @@
 	s = SLmake_string (s);
      }
 #endif
+
+   /* Do not strip pad info for alternate character set.  I need to make
+    * this more general.
+    */
+   /* FIXME: Priority=low; */
+   if (0 == strcmp (cap, "ac"))
+     return s;
+
+   s = fixup_tgetstr (s);
    return s;
 }
 
--- src.diff ends here ---
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->garga 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Wed Feb 18 21:50:15 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131857 

From: Renato Botelho <garga@FreeBSD.org>
To: bug-followup@FreeBSD.org, szalai.bandi@gmail.com
Cc: davis@space.mit.edu
Subject: Re: ports/131857: [patch] devel/libslang2 line drawing characters
	bug
Date: Thu, 19 Feb 2009 12:37:26 -0300

 S-lang author suggested the following patch, could you test it and let me
 know if it's ok?
 
 Thanks
 
 ------------------------------------------------------------------------
 
 --- sldisply.c~	2008-08-24 20:14:47.000000000 -0400
 +++ sldisply.c	2009-02-19 09:59:08.000000000 -0500
 @@ -2233,10 +2233,9 @@
      * this more general.
      */
     /* FIXME: Priority=low; */
 -   if (0 == strcmp (cap, "ac"))
 -     return s;
 +   if (0 != strcmp (cap, "ac"))
 +     s = fixup_tgetstr (s);
  
 -   s = fixup_tgetstr (s);
  #ifdef USE_TERMCAP
     if ((s >= area_buf) && (s < area_buf + sizeof(area_buf)))
       {
 
 -- 
 Renato Botelho <garga @ FreeBSD.org>
                <garga @ freebsdbrasil.com.br>
 GnuPG Key: http://www.FreeBSD.org/~garga/pubkey.asc
 
 If your life was a horse, you'd have to shoot it.
State-Changed-From-To: open->feedback 
State-Changed-By: garga 
State-Changed-When: Fri Feb 20 14:12:03 UTC 2009 
State-Changed-Why:  
Waiting submitter test new patch 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131857 

From: Szalai Andras <szalai.bandi@gmail.com>
To: Renato Botelho <garga@FreeBSD.org>
Cc: bug-followup@FreeBSD.org, davis@space.mit.edu
Subject: Re: ports/131857: [patch] devel/libslang2 line drawing characters bug
Date: Sat, 21 Feb 2009 11:33:44 +0100

 Hi,
 
 On Thu, Feb 19, 2009 at 12:37:26PM -0300, Renato Botelho wrote:
 
 > S-lang author suggested the following patch, could you test it and let me
 > know if it's ok?
 
 I have tested the patch and it is working well.
 
 Bye,
 andrew
State-Changed-From-To: feedback->closed 
State-Changed-By: garga 
State-Changed-When: Sat Feb 21 20:34:33 UTC 2009 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131857 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/131857: commit references a PR
Date: Sat, 21 Feb 2009 20:34:24 +0000 (UTC)

 garga       2009-02-21 20:34:13 UTC
 
   FreeBSD ports repository
 
   Modified files:
     devel/libslang2      Makefile 
   Added files:
     devel/libslang2/files patch-src__sldisply.c 
   Log:
   - Fix following bug:
   
   If you execute an application (e.g. mc), which uses devel/libslang2 to
   do screen I/O on a non-unicode terminal then the line drawing characters
   will appear as spaces.
   
   PR:             ports/131857
   Submitted by:   Szalai Andras <szalai.bandi@gmail.com>
   Reviewed by:    John E. Davis (author)
   
   Revision  Changes    Path
   1.24      +2 -1      ports/devel/libslang2/Makefile
   1.1       +15 -0     ports/devel/libslang2/files/patch-src__sldisply.c (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
