Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Nov 2013 04:38:06 GMT
From:      Henry Hu <henry.hu.sh@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/184015: [patch] sysutils/synergy: hang on reading config
Message-ID:  <201311160438.rAG4c6re088419@oldred.freebsd.org>
Resent-Message-ID: <201311160440.rAG4e1vp073352@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311160438.rAG4c6re088419>