From nobody@FreeBSD.org  Mon Feb 14 07:14:41 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 44EE216A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 14 Feb 2005 07:14:41 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 0836B43D5D
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 14 Feb 2005 07:14:40 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j1E7Ee22060511
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 14 Feb 2005 07:14:40 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j1E7Eext060510;
	Mon, 14 Feb 2005 07:14:40 GMT
	(envelope-from nobody)
Message-Id: <200502140714.j1E7Eext060510@www.freebsd.org>
Date: Mon, 14 Feb 2005 07:14:40 GMT
From: Axel Gonzalez <loox@e-shell.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: sysutils/lineakd fails to run on AMD64 [patch]
X-Send-Pr-Version: www-2.3

>Number:         77479
>Category:       ports
>Synopsis:       sysutils/lineakd fails to run on AMD64 [patch]
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pav
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 14 07:20:19 GMT 2005
>Closed-Date:    Tue Feb 15 22:03:42 GMT 2005
>Last-Modified:  Tue Feb 15 22:03:42 GMT 2005
>Originator:     Axel Gonzalez
>Release:        5.3-STABLE
>Organization:
>Environment:
FreeBSD moonlight.e-shell.net 5.3-STABLE FreeBSD 5.3-STABLE #0: Thu Feb  3 23:08:02 CST 2005     loox@moonlight.e-shell.net:/usr/obj/usr/src/sys/LXAMD64  amd64
>Description:
Make and install of lineakd goes well, but when you try to run, you get endless messages like:

$ lineakd -l
Attempted to add an empty toggle name:  to object: Back
Attempted to add an empty toggle name:  to object: Back
Attempted to add an empty toggle name:  to object: Back
..

(listing the keyboards, or trying to run the daemon)

CPU usage goes to 100%
>How-To-Repeat:
Install lineakd from ports

$ lineakd -l

or

$ lineakd
>Fix:
The problem is due to a bug in the routine that loads the keyboards list (lineakkb.def).

At some point it tries to compare 32 unsigned int to 64 bit unsigned it, the result is 2^32-1 != 2^64-1, so it fails, and gets in an endless loop.

This patch fixes the problem (and should be ok with 32 bits platforms):

**** begin patch-lineak__defloader.cpp ***
--- lineak/defloader.cpp.orig   Sun Feb 13 23:54:36 2005
+++ lineak/defloader.cpp        Sun Feb 13 23:54:57 2005
@@ -157,13 +157,13 @@
                 //cout << akey;
                 /** Now determine if this is a toggleable key. We will have toparse
                     the name format name1|name2 if indeed it is a toggleable key. */
-                if ((unsigned int)key.find('|') != string::npos) {
+                if ((unsigned int)key.find('|') != (unsigned int)string::npos){
                    key+='|';
                    akey->setToggle(true);
                    int index;
                    string tmp;
                    //vector<string>names;
-                   while (((unsigned int)(index = key.find('|'))) != string::npos) {
+                   while (((unsigned int)(index = key.find('|'))) != (unsignedint)string::npos) {
                       tmp = key.substr(0,index);
                       //cout << "adding toggle name: " << tmp << " to " << akey->getName() << endl;
                        akey->addToggleName(tmp);
**** end patch-lineak__defloader.cpp ***
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: pav 
State-Changed-When: Mon Feb 14 21:18:40 GMT 2005 
State-Changed-Why:  
Asked maintainer for opinion. 


Responsible-Changed-From-To: freebsd-ports-bugs->pav 
Responsible-Changed-By: pav 
Responsible-Changed-When: Mon Feb 14 21:18:40 GMT 2005 
Responsible-Changed-Why:  
Handle. 

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

From: Pav Lucistnik <pav@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, kay_lehmann@web.de
Cc:  
Subject: Re: ports/77479: sysutils/lineakd fails to run on AMD64 [patch]
Date: Mon, 14 Feb 2005 22:18:37 +0100

 Dear maintainer of FreeBSD port sysutils/lineakd, please take a look at
 
 http://www.freebsd.org/cgi/query-pr.cgi?q=77479
 
 Do you approve this patch?
 
 -- 
 Pav Lucistnik <pav@oook.cz>
               <pav@FreeBSD.org>
 
 It's the classic Microsoft security-bulletin formula: "The vulnerability is
 important (never dangerous); you have nothing to fear and no reason to regret
 trusting us; we have no intention of apologizing for it or even explaining it
 adequately; now go get your patch, shut up, and be grateful nothing bad has
 happened.
   -- The Register

From: Kay Lehmann <Kay_Lehmann@web.de>
To: pav@FreeBSD.org
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: ports/77479: sysutils/lineakd fails to run on AMD64 [patch]
Date: Tue, 15 Feb 2005 08:59:43 +0100

 Hello,
 
 the patch is ok, but it is missing a line, which needs some change, too. 
 Exactly this problem was fixed in cvs of lineak last week. I will fill 
 another pr, including the patches from cvs as soon as possible.
 
 Greets,
 Kay
 
 Pav Lucistnik schrieb:
 > Dear maintainer of FreeBSD port sysutils/lineakd, please take a look at
 > 
 > http://www.freebsd.org/cgi/query-pr.cgi?q=77479
 > 
 > Do you approve this patch?
 > 
 
 
State-Changed-From-To: feedback->suspended 
State-Changed-By: pav 
State-Changed-When: Tue Feb 15 08:48:59 GMT 2005 
State-Changed-Why:  
Waiting for maintainer's patch. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=77479 
State-Changed-From-To: suspended->closed 
State-Changed-By: pav 
State-Changed-When: Tue Feb 15 22:03:21 GMT 2005 
State-Changed-Why:  
Problem fixed in CVS! Thank you for your report. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=77479 
>Unformatted:
