ports/184015: [patch] sysutils/synergy: hang on reading config
Henry Hu
henry.hu.sh at gmail.com
Sat Nov 16 04:40:02 UTC 2013
>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 at 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:
More information about the freebsd-ports-bugs
mailing list