[licq/f18] fix RHBZ #894247
François Cami
fcami at fedoraproject.org
Sat Jan 12 21:36:37 UTC 2013
commit b072bedf7c2331f11d08b852983314ec074a1966
Author: F. Cami <fcami at fedoraproject.org>
Date: Sat Jan 12 22:36:24 2013 +0100
fix RHBZ #894247
licq-1.7.0-fix-buddy-icon-hash-length-2.patch | 54 ++++++++++++
licq-1.7.0-fix-possible-deadlock.patch | 108 +++++++++++++++++++++++++
licq.spec | 21 +++++-
3 files changed, 182 insertions(+), 1 deletions(-)
---
diff --git a/licq-1.7.0-fix-buddy-icon-hash-length-2.patch b/licq-1.7.0-fix-buddy-icon-hash-length-2.patch
new file mode 100644
index 0000000..18dbc0a
--- /dev/null
+++ b/licq-1.7.0-fix-buddy-icon-hash-length-2.patch
@@ -0,0 +1,54 @@
+diff --git licq/src/icq/icq-srv.cpp licq/src/icq/icq-srv.cpp
+index 468f12f..67217fa 100644
+--- licq/src/icq/icq-srv.cpp
++++ licq/src/icq/icq-srv.cpp
+@@ -2147,7 +2147,6 @@ void IcqProtocol::processIconHash(User* u, Buffer& packet)
+ case BART_TYPExBUDDY_ICON_PHOTO:
+ {
+ // TODO: Handle photo item
+- packet.incDataPosRead(length);
+ break;
+ }
+ case BART_TYPExBUDDY_ICON:
+@@ -2161,38 +2160,37 @@ void IcqProtocol::processIconHash(User* u, Buffer& packet)
+ u->setBuddyIconType(type);
+ u->setBuddyIconHashType(flags);
+ u->save(Licq::User::SavePictureInfo);
++ continue;
+ }
+ break;
+ }
+ case BART_TYPExSTATUS_STR:
+ {
+ // TODO: Handle status string
+- packet.incDataPosRead(length);
+ break;
+ }
+ case BART_TYPExSTATUS_STR_TIMESTAMP:
+ {
+ // TODO: Handle status string timestamp
+- packet.incDataPosRead(length);
+ break;
+ }
+ case BART_TYPExSTATUS_MOOD:
+ {
+ // TODO: Handle status mood item
+- packet.incDataPosRead(length);
+ break;
+ }
+ case BART_TYPExITUNES_LINK:
+ {
+ // TODO: Handle iTunes music store link
+- packet.incDataPosRead(length);
+ break;
+ }
+ default:
+ gLog.warning(tr("Unknown Extended Status Data type 0x%04x flags 0x%02x length 0x%02x"),
+ type, flags, length);
+- packet.incDataPosRead(length);
+ }
++
++ // Unhandled part, skip the data
++ packet.incDataPosRead(length);
+ }
+ }
diff --git a/licq-1.7.0-fix-possible-deadlock.patch b/licq-1.7.0-fix-possible-deadlock.patch
new file mode 100644
index 0000000..20c356a
--- /dev/null
+++ b/licq-1.7.0-fix-possible-deadlock.patch
@@ -0,0 +1,108 @@
+diff --git licq/include/licq/pipe.h licq/include/licq/pipe.h
+index e5dbb26..8521a5a 100644
+--- licq/include/licq/pipe.h
++++ licq/include/licq/pipe.h
+@@ -1,6 +1,6 @@
+ /*
+ * This file is part of Licq, an instant messaging client for UNIX.
+- * Copyright (C) 2010 Licq developers
++ * Copyright (C) 2010-2012 Licq developers <licq-dev at googlegroups.com>
+ *
+ * Licq is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+@@ -46,6 +46,13 @@ public:
+ ssize_t write(const void* buf, size_t count);
+
+ /**
++ * (Un)block the write end of the pipe
++ *
++ * @param block False to make write fail if it would block
++ */
++ void setWriteBlocking(bool block);
++
++ /**
+ * Reads one byte using read().
+ */
+ char getChar()
+@@ -58,8 +65,8 @@ public:
+ /**
+ * Writes one byte using write().
+ */
+- void putChar(char ch)
+- { write(&ch, sizeof(ch)); }
++ bool putChar(char ch)
++ { return (write(&ch, sizeof(ch)) > 0); }
+
+ int getReadFd() const { return myFds[0]; }
+ int getWriteFd() const { return myFds[1]; }
+diff --git licq/src/logging/pluginlogsink.cpp licq/src/logging/pluginlogsink.cpp
+index ed0aad9..f1ca9ab 100644
+--- licq/src/logging/pluginlogsink.cpp
++++ licq/src/logging/pluginlogsink.cpp
+@@ -1,6 +1,6 @@
+ /*
+ * This file is part of Licq, an instant messaging client for UNIX.
+- * Copyright (C) 2010 Licq Developers <licq-dev at googlegroups.com>
++ * Copyright (C) 2010-2012 Licq developers <licq-dev at googlegroups.com>
+ *
+ * Please refer to the COPYRIGHT file distributed with this source
+ * distribution for the names of the individual contributors.
+@@ -37,8 +37,12 @@ public:
+ void log(Message::Ptr message)
+ {
+ MutexLocker locker(myMutex);
+- myMessages.push_back(message);
+- myPipe.putChar('M');
++
++ // The pipe is non-blocking so we won't risk hanging here while holding
++ // several mutexes. If putChar fails, don't push this message, the receiver
++ // is either overloaded or hanged and it's just a log message anyway.
++ if (myPipe.putChar('M'))
++ myMessages.push_back(message);
+ }
+
+ LogSink::Message::Ptr popMessage(bool readPipe)
+@@ -62,7 +66,11 @@ public:
+ PluginLogSink::PluginLogSink() :
+ myPrivate(new Private())
+ {
+- // Empty
++ LICQ_D();
++
++ // Make the pipe non-blocking. If a logsink is too slow it's better to drop a
++ // few log messages than to block and risk deadlocking the application.
++ d->myPipe.setWriteBlocking(false);
+ }
+
+ PluginLogSink::~PluginLogSink()
+diff --git licq/src/utils/pipe.cpp licq/src/utils/pipe.cpp
+index b4a08e7..3b3b8f3 100644
+--- licq/src/utils/pipe.cpp
++++ licq/src/utils/pipe.cpp
+@@ -1,6 +1,6 @@
+ /*
+ * This file is part of Licq, an instant messaging client for UNIX.
+- * Copyright (C) 2010 Licq developers
++ * Copyright (C) 2010-2012 Licq developers <licq-dev at googlegroups.com>
+ *
+ * Licq is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+@@ -19,6 +19,8 @@
+
+ #include <licq/pipe.h>
+
++#include <fcntl.h>
++
+ using namespace Licq;
+
+ Pipe::Pipe()
+@@ -41,3 +43,9 @@ ssize_t Pipe::write(const void* buf, size_t count)
+ {
+ return ::write(getWriteFd(), buf, count);
+ }
++
++void Pipe::setWriteBlocking(bool block)
++{
++ int f = ::fcntl(getWriteFd(), F_GETFL);
++ ::fcntl(getWriteFd(), F_SETFL, (block ? (f & ~O_NONBLOCK) : (f | O_NONBLOCK)));
++}
diff --git a/licq.spec b/licq.spec
index add9598..64b2b4c 100644
--- a/licq.spec
+++ b/licq.spec
@@ -1,8 +1,13 @@
Name: licq
Version: 1.7.0
-Release: 1%{?dist}
+Release: 4%{?dist}
License: GPLv2+
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
+
+# fcami - credits for these patches go to flynd (#licq on irc://freenode)
+Patch0: licq-1.7.0-fix-buddy-icon-hash-length-2.patch
+Patch1: licq-1.7.0-fix-possible-deadlock.patch
+
URL: http://www.licq.org/
Summary: Licq - A graphical ICQ Client for Linux
Group: Applications/Internet
@@ -15,6 +20,9 @@ BuildRequires: gettext, cmake
BuildRequires: xosd-devel
BuildRequires: cdk-devel ncurses-devel
+# fcami - licq calls "play" directly
+Requires: sox
+
Provides: %{name}-kde = %{version}-%{release}, %{name}-msn = %{version}-%{release}, %{name}-icqnd = %{version}-%{release}, %{name}-auto-reply = %{version}-%{release}
Obsoletes: %{name}-kde < 1.6.1, %{name}-msn < 1.6.1, %{name}-icqnd < 1.6.1, %{name}-auto-reply < 1.6.1
@@ -46,6 +54,8 @@ at this point and does not have all the features that the qt-gui supports.
%setup -q
#remove cvs stuff
rm -rf `find . -name CVS`
+%patch0 -p1
+%patch1 -p1
%build
export CFLAGS="$RPM_OPT_FLAGS"
@@ -186,6 +196,15 @@ rm -rf $RPM_BUILD_ROOT/%{_datadir}/cmake
%doc plugins/console/{README,licq_console.conf}
%changelog
+* Sat Jan 12 2013 François Cami <fcami at fedoraproject.org> - 1.7.0-4
+- add sox as requirement.
+
+* Sat Jan 12 2013 François Cami <fcami at fedoraproject.org> - 1.7.0-3
+- Fix deadlock, RHBZ #894247. Thanks to flynd.
+
+* Sat Jan 12 2013 François Cami <fcami at fedoraproject.org> - 1.7.0-2
+- Not public - test deadlock fix.
+
* Wed Jan 9 2013 François Cami <fcami at fedoraproject.org> - 1.7.0-1
- New upstream release.
More information about the scm-commits
mailing list