From mellon@happy.checkpoint.com  Sat Mar 11 18:40:42 2000
Return-Path: <mellon@happy.checkpoint.com>
Received: from happy.checkpoint.com (happy.checkpoint.com [199.203.156.224])
	by hub.freebsd.org (Postfix) with ESMTP id 7B8CA37BD39
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 11 Mar 2000 18:40:38 -0800 (PST)
	(envelope-from mellon@happy.checkpoint.com)
Received: (from mellon@localhost)
	by happy.checkpoint.com (8.9.3/8.9.3) id EAA15687;
	Sun, 12 Mar 2000 04:41:57 GMT
	(envelope-from mellon)
Message-Id: <200003120441.EAA15687@happy.checkpoint.com>
Date: Sun, 12 Mar 2000 04:41:57 GMT
From: mellon@pobox.com
Sender: mellon@happy.checkpoint.com
Reply-To: mellon@pobox.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: kbdmap/vidfont bug
X-Send-Pr-Version: 3.2

>Number:         17330
>Category:       bin
>Synopsis:       a bug in the routine reading rc.conf
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    sheldonh
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 11 18:50:01 PST 2000
>Closed-Date:    Tue Mar 14 01:33:43 PST 2000
>Last-Modified:  Tue Nov 27 18:32:18 PST 2001
>Originator:     Anatoly Vorobey
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
>Environment:

	latest CURRENT.

>Description:
	
	In usr.sbin/kbdmap/kbdmap.pl, the routine &font_current
        which reads /etc/rc.conf to determine the current font
        does not handle correctly the quotation marks around fontname, 
        which causes later regexp in &vidcontrol to fail, as a
        consequence vidcontrol(1) is not invoked. 
 

>How-To-Repeat:

	Install a non-standard font not matching your LANG vars
        in /etc/rc.conf . Run vidfont(1),
        but do not choose any font, rather exit by Canceling. Your
        font will be changed to the one matching your $LANG, but then
        it'll fail to revert to your default font on exit. 

>Fix:

--- /usr/src/usr.sbin/kbdmap/kbdmap.pl	Sat Aug 28 01:16:39 1999
+++ /usr/sbin/kbdmap	Sun Mar 12 04:38:02 2000
@@ -86,7 +86,7 @@
     while(<F>) {
 	/^#/ && next;
 	if (/^\s*font[0-9]+x[0-9]+\s*=\s*(\S+)/) {
-	    $font_current = $1 if $1 ne "NO";
+	    ($font_current = $1) =~ s/"//g  if $1 ne "NO";
 	}
     }
     close F;



>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: sheldonh 
State-Changed-When: Mon Mar 13 07:42:20 PST 2000 
State-Changed-Why:  
Waiting for feedback on an alternative patch. 


Responsible-Changed-From-To: freebsd-bugs->sheldonh 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Mon Mar 13 07:42:20 PST 2000 
Responsible-Changed-Why:  
I'll take this one. 

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: mellon@pobox.com
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/17330: kbdmap/vidfont bug 
Date: Mon, 13 Mar 2000 17:42:17 +0200

 On Sun, 12 Mar 2000 04:41:57 GMT, mellon@pobox.com wrote:
 
 > -	    $font_current = $1 if $1 ne "NO";
 > +	    ($font_current = $1) =~ s/"//g  if $1 ne "NO";
 
 Do you agree that the following is preferable?
 
 Ciao,
 Sheldon.
 
 Index: kbdmap.pl
 ===================================================================
 RCS file: /home/ncvs/src/usr.sbin/kbdmap/kbdmap.pl,v
 retrieving revision 1.10
 diff -u -d -r1.10 kbdmap.pl
 --- kbdmap.pl	1999/08/28 01:16:39	1.10
 +++ kbdmap.pl	2000/03/13 15:41:21
 @@ -85,7 +85,7 @@
  
      while(<F>) {
  	/^#/ && next;
 -	if (/^\s*font[0-9]+x[0-9]+\s*=\s*(\S+)/) {
 +	if (/^\s*font[0-9]+x[0-9]+\s*=\s*\"?([^\s\"]+)\"?/) {
  	    $font_current = $1 if $1 ne "NO";
  	}
      }
 
State-Changed-From-To: feedback->closed 
State-Changed-By: sheldonh 
State-Changed-When: Tue Mar 14 01:33:43 PST 2000 
State-Changed-Why:  
Committed and merged onto the RELENG_4 and RELENG_3 branches.   
Unfortunately, this one missed 4.0-RELEASE. 

Note that kbdmap.pl is still problematic.  It should really use 
something like a perl wrapper module for Daniel Sobral's libconf, 
which understands /etc/defaults/rc.conf et al, but the problem 
you reported has been fixed. 

Thanks! 
>Unformatted:
