From owner-freebsd-ports-bugs@FreeBSD.ORG Sat Nov 16 04:40:02 2013 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 295AD4F6 for ; Sat, 16 Nov 2013 04:40:02 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0B7A82B4F for ; Sat, 16 Nov 2013 04:40:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id rAG4e1kR073353 for ; Sat, 16 Nov 2013 04:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id rAG4e1vp073352; Sat, 16 Nov 2013 04:40:01 GMT (envelope-from gnats) Resent-Date: Sat, 16 Nov 2013 04:40:01 GMT Resent-Message-Id: <201311160440.rAG4e1vp073352@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Henry Hu Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6127A4DB for ; Sat, 16 Nov 2013 04:38:06 +0000 (UTC) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 514572B44 for ; Sat, 16 Nov 2013 04:38:06 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rAG4c66M088430 for ; Sat, 16 Nov 2013 04:38:06 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rAG4c6re088419; Sat, 16 Nov 2013 04:38:06 GMT (envelope-from nobody) Message-Id: <201311160438.rAG4c6re088419@oldred.freebsd.org> Date: Sat, 16 Nov 2013 04:38:06 GMT From: Henry Hu To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: ports/184015: [patch] sysutils/synergy: hang on reading config X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2013 04:40:02 -0000 >Number: 184015 >Category: ports >Synopsis: [patch] sysutils/synergy: hang on reading config >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Nov 16 04:40:01 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Henry Hu >Release: FreeBSD 11-CURRENT >Organization: Columbia University >Environment: FreeBSD pepsi 11.0-CURRENT FreeBSD 11.0-CURRENT #3 r257801M: Thu Nov 7 22:36:32 EST 2013 root@pepsi:/usr/obj/usr/src/sys/MYKERNEL amd64 >Description: Currently, with sysutils/synergy 1.3.8, if you 1. create a config file ~/.synergy.conf 2. run synergys -f You can see that synergys hangs on reading the config file, and its CPU usage is 100%. The reason is that, in the freebsd patch to CConfig.cpp, it writes --- src/lib/server/CConfig.cpp.orig 2011-01-21 11:51:35.000000000 +0800 +++ src/lib/server/CConfig.cpp 2013-09-12 17:23:04.000000000 +0800 @@ -1908,9 +1908,9 @@ return m_line; } -CConfigReadContext::operator void*() const +CConfigReadContext::operator bool() const { - return m_stream; + return !m_stream.bad(); } However, when m_stream hit eof, its eof() is true, but its bad() is false. So although the stream has reached its end, the program still tries to read from it. The correct way to check this is by checking the good() flag. After changing that line to return m_stream.good(); synergys works correctly. >How-To-Repeat: 1. install sysutils/synergy 2. create a config file ~/.synergy.conf 3. run synergys -f It hangs. >Fix: Patch attached with submission follows: Index: files/patch-CConfig.cpp =================================================================== --- files/patch-CConfig.cpp (版本 333477) +++ files/patch-CConfig.cpp (工作副本) @@ -8,7 +8,7 @@ +CConfigReadContext::operator bool() const { - return m_stream; -+ return !m_stream.bad(); ++ return m_stream.good(); } bool >Release-Note: >Audit-Trail: >Unformatted: