recent dfaure's fixes sent to @kde-packager

This commit is contained in:
Lukas Tinkl 2009-01-30 15:21:21 +00:00
parent 08038486de
commit f716adc79c
4 changed files with 363 additions and 1 deletions

View File

@ -0,0 +1,130 @@
Index: kio/kio/copyjob.h
===================================================================
--- kio/kio/copyjob.h (revision 917169)
+++ kio/kio/copyjob.h (revision 917170)
@@ -245,6 +245,7 @@
protected:
CopyJob(CopyJobPrivate &dd);
+ void emitResult();
private:
Q_PRIVATE_SLOT(d_func(), void slotStart())
Index: kio/kio/copyjob.cpp
===================================================================
--- kio/kio/copyjob.cpp (revision 917169)
+++ kio/kio/copyjob.cpp (revision 917170)
@@ -153,7 +153,7 @@
QList<CopyInfo> dirs;
KUrl::List dirsToRemove;
KUrl::List m_srcList;
- KUrl::List m_skippedSourceUrls;
+ KUrl::List m_successSrcList;
KUrl::List::const_iterator m_currentStatSrc;
bool m_bCurrentSrcIsDir;
bool m_bCurrentOperationIsLink;
@@ -770,10 +770,6 @@
void CopyJobPrivate::skip( const KUrl & sourceUrl )
{
- // If this is one if toplevel sources,
- // remove it from d->m_srcList, for a correct FilesRemoved() signal
- // But don't do it right away, we have iterators into that list (#157601)
- m_skippedSourceUrls.append( sourceUrl );
dirsToRemove.removeAll( sourceUrl );
}
@@ -857,6 +853,7 @@
{
//this is required for the undo feature
emit q->copyingDone( q, (*it).uSource, (*it).uDest, (*it).mtime, true, false );
+ m_successSrcList.append((*it).uSource);
m_directoriesCopied.append( *it );
dirs.erase( it );
}
@@ -1118,6 +1115,7 @@
emit q->copyingDone( q, (*it).uSource, (*it).uDest, (*it).mtime, false, false );
if (m_mode == CopyJob::Move)
org::kde::KDirNotify::emitFileMoved( (*it).uSource.url(), (*it).uDest.url() );
+ m_successSrcList.append((*it).uSource);
}
// remove from list, to move on to next file
files.erase( it );
@@ -1372,7 +1370,7 @@
KIO::Job * newjob = 0;
if ( m_mode == CopyJob::Link ) {
// User requested that a symlink be made
- JobFlags flags = bOverwrite ? Overwrite : DefaultFlags;
+ const JobFlags flags = bOverwrite ? Overwrite : DefaultFlags;
newjob = linkNextFile(uSource, uDest, flags);
if (!newjob)
return;
@@ -1384,7 +1382,7 @@
(uSource.pass() == uDest.pass()))
// Copying a symlink - only on the same protocol/host/etc. (#5601, downloading an FTP file through its link),
{
- JobFlags flags = bOverwrite ? Overwrite : DefaultFlags;
+ const JobFlags flags = bOverwrite ? Overwrite : DefaultFlags;
KIO::SimpleJob *newJob = KIO::symlink( (*it).linkDest, uDest, flags | HideProgressInfo /*no GUI*/ );
Scheduler::scheduleJob(newJob);
newjob = newJob;
@@ -1509,23 +1507,6 @@
// but then we need to jump to the else part below. Maybe with a recursive call?
#endif
} else {
- // Finished - tell the world
- if ( !m_bOnlyRenames )
- {
- KUrl url( m_globalDest );
- if ( m_globalDestinationState != DEST_IS_DIR || m_asMethod )
- url.setPath( url.directory() );
- //kDebug(7007) << "KDirNotify'ing FilesAdded " << url;
- org::kde::KDirNotify::emitFilesAdded( url.url() );
-
- Q_FOREACH(const KUrl& url, m_skippedSourceUrls)
- m_srcList.removeAll(url);
-
- if ( m_mode == CopyJob::Move && !m_srcList.isEmpty() ) {
- //kDebug(7007) << "KDirNotify'ing FilesRemoved " << m_srcList.toStringList();
- org::kde::KDirNotify::emitFilesRemoved( m_srcList.toStringList() );
- }
- }
if (m_reportTimer)
m_reportTimer->stop();
--m_processedFiles; // undo the "start at 1" hack
@@ -1535,6 +1516,27 @@
}
}
+void CopyJob::emitResult()
+{
+ Q_D(CopyJob);
+ // Before we go, tell the world about the changes that were made.
+ // Even if some error made us abort midway, we might still have done
+ // part of the job so we better update the views! (#118583)
+ if (!d->m_bOnlyRenames) {
+ KUrl url(d->m_globalDest);
+ if (d->m_globalDestinationState != DEST_IS_DIR || d->m_asMethod)
+ url.setPath(url.directory());
+ //kDebug(7007) << "KDirNotify'ing FilesAdded " << url;
+ org::kde::KDirNotify::emitFilesAdded( url.url() );
+
+ if (d->m_mode == CopyJob::Move && !d->m_successSrcList.isEmpty()) {
+ kDebug(7007) << "KDirNotify'ing FilesRemoved" << d->m_successSrcList.toStringList();
+ org::kde::KDirNotify::emitFilesRemoved(d->m_successSrcList.toStringList());
+ }
+ }
+ Job::emitResult();
+}
+
void CopyJobPrivate::slotProcessedSize( KJob*, qulonglong data_size )
{
Q_Q(CopyJob);
@@ -1801,6 +1803,7 @@
kDebug(7007) << "Renaming succeeded, move on";
++m_processedFiles;
emit q->copyingDone( q, *m_currentStatSrc, dest, -1 /*mtime unknown, and not needed*/, true, true );
+ m_successSrcList.append(*m_currentStatSrc);
statNextSrc();
}
}

View File

@ -0,0 +1,87 @@
Index: kinit/klauncher.cpp
===================================================================
--- kinit/klauncher.cpp (revision 918402)
+++ kinit/klauncher.cpp (revision 918403)
@@ -167,7 +167,7 @@
KLauncher::KLauncher(int _kdeinitSocket)
: QObject(0),
- kdeinitSocket(_kdeinitSocket), dontBlockReading(false)
+ kdeinitSocket(_kdeinitSocket)
{
#ifdef Q_WS_X11
mCached_dpy = NULL;
@@ -276,8 +276,24 @@
{
ssize_t result;
int bytes_left = len;
- while ( bytes_left > 0)
- {
+ while (bytes_left > 0) {
+ // in case we get a request to start an application and data arrive
+ // to kdeinitSocket at the same time, requestStart() will already
+ // call slotKDEInitData(), so we must check there's still something
+ // to read, otherwise this would block
+
+ // Same thing if kdeinit dies without warning.
+
+ fd_set in;
+ timeval tm = { 30, 0 }; // 30 seconds timeout, so we're not stuck in case kdeinit dies on us
+ FD_ZERO ( &in );
+ FD_SET( sock, &in );
+ select( sock + 1, &in, 0, 0, &tm );
+ if( !FD_ISSET( sock, &in )) {
+ kDebug(7016) << "read_socket" << sock << "nothing to read, kdeinit4 must be dead";
+ return -1;
+ }
+
result = read(sock, buffer, bytes_left);
if (result > 0)
{
@@ -298,21 +314,7 @@
{
klauncher_header request_header;
QByteArray requestData;
- if( dontBlockReading )
- {
- // in case we get a request to start an application and data arrive
- // to kdeinitSocket at the same time, requestStart() will already
- // call slotKDEInitData(), so we must check there's still something
- // to read, otherwise this would block
- fd_set in;
- timeval tm = { 0, 0 };
- FD_ZERO ( &in );
- FD_SET( kdeinitSocket, &in );
- select( kdeinitSocket + 1, &in, 0, 0, &tm );
- if( !FD_ISSET( kdeinitSocket, &in ))
- return;
- }
- dontBlockReading = false;
+
int result = read_socket(kdeinitSocket, (char *) &request_header,
sizeof( request_header));
if (result == -1)
@@ -647,17 +649,21 @@
request_header.cmd = LAUNCHER_EXEC_NEW;
#endif
request_header.arg_length = requestData.length();
+
+#ifdef KLAUNCHER_VERBOSE_OUTPUT
+ kDebug(7016) << "Asking kdeinit to start" << request->name << request->arg_list
+ << "cmd=" << commandToString(request_header.cmd);
+#endif
+
write(kdeinitSocket, &request_header, sizeof(request_header));
write(kdeinitSocket, requestData.data(), requestData.length());
// Wait for pid to return.
lastRequest = request;
- dontBlockReading = false;
do {
slotKDEInitData( kdeinitSocket );
}
while (lastRequest != 0);
- dontBlockReading = true;
#endif
}

View File

@ -0,0 +1,129 @@
Index: kinit/klauncher.cpp
===================================================================
--- kinit/klauncher.cpp (revision 918653)
+++ kinit/klauncher.cpp (revision 918654)
@@ -58,6 +58,9 @@
// #define KLAUNCHER_VERBOSE_OUTPUT
+static const char* const s_DBusStartupTypeToString[] =
+ { "DBusNone", "DBusUnique", "DBusMulti", "DBusWait", "ERROR" };
+
using namespace KIO;
IdleSlave::IdleSlave(QObject *parent)
@@ -393,15 +396,19 @@
if (request->pid == pid)
{
if (request->dbus_startup_type == KService::DBusWait)
- request->status = KLaunchRequest::Done;
+ request->status = KLaunchRequest::Done;
else if ((request->dbus_startup_type == KService::DBusUnique)
- && QDBusConnection::sessionBus().interface()->isServiceRegistered(request->dbus_name))
- request->status = KLaunchRequest::Running;
- else
- request->status = KLaunchRequest::Error;
+ && QDBusConnection::sessionBus().interface()->isServiceRegistered(request->dbus_name)) {
+ request->status = KLaunchRequest::Running;
#ifdef KLAUNCHER_VERBOSE_OUTPUT
- kDebug(7016) << pid << "died, requestDone. status=" << request->status;
+ kDebug(7016) << pid << "running as a unique app";
#endif
+ } else {
+ request->status = KLaunchRequest::Error;
+#ifdef KLAUNCHER_VERBOSE_OUTPUT
+ kDebug(7016) << pid << "died, requestDone. status=" << request->status;
+#endif
+ }
requestDone(request);
return;
}
@@ -446,19 +453,29 @@
if (request->status != KLaunchRequest::Launching)
continue;
+#ifdef KLAUNCHER_VERBOSE_OUTPUT
+ kDebug(7016) << "had pending request" << request->name << s_DBusStartupTypeToString[request->dbus_startup_type] << "dbus_name" << request->dbus_name << request->tolerant_dbus_name;
+#endif
// For unique services check the requested service name first
- if ((request->dbus_startup_type == KService::DBusUnique) &&
- ((appId == request->dbus_name) ||
- QDBusConnection::sessionBus().interface()->isServiceRegistered(request->dbus_name)))
- {
- request->status = KLaunchRequest::Running;
- requestDone(request);
- continue;
+ if (request->dbus_startup_type == KService::DBusUnique) {
+ if ((appId == request->dbus_name) || // just started
+ QDBusConnection::sessionBus().interface()->isServiceRegistered(request->dbus_name)) { // was already running
+ request->status = KLaunchRequest::Running;
+#ifdef KLAUNCHER_VERBOSE_OUTPUT
+ kDebug(7016) << "OK, unique app" << request->dbus_name << "is running";
+#endif
+ requestDone(request);
+ continue;
+ } else {
+#ifdef KLAUNCHER_VERBOSE_OUTPUT
+ kDebug(7016) << "unique app" << request->dbus_name << "not running yet";
+#endif
+ }
}
- const QString rAppId = request->dbus_name;
+ const QString rAppId = !request->tolerant_dbus_name.isEmpty() ? request->tolerant_dbus_name : request->dbus_name;
#ifdef KLAUNCHER_VERBOSE_OUTPUT
- kDebug(7016) << "had pending request" << rAppId;
+ //kDebug(7016) << "using" << rAppId << "for matching";
#endif
if (rAppId.isEmpty())
continue;
@@ -818,11 +835,18 @@
request->dbus_name = v.toString().toUtf8();
}
if (request->dbus_name.isEmpty()) {
- request->dbus_name = "*." + QFile::encodeName(KRun::binaryName(service->exec(), true));
+ const QString binName = KRun::binaryName(service->exec(), true);
+ request->dbus_name = "org.kde." + binName;
+ request->tolerant_dbus_name = "*." + binName;
}
}
}
+#ifdef KLAUNCHER_VERBOSE_OUTPUT
+ kDebug(7016) << "name=" << request->name << "dbus_name=" << request->dbus_name
+ << "startup type=" << s_DBusStartupTypeToString[request->dbus_startup_type];
+#endif
+
request->pid = 0;
request->envs = envs;
send_service_startup_info( request, service, startup_id, envs );
@@ -938,7 +962,7 @@
request->arg_list.append(arg.toLocal8Bit());
}
- request->name = app.toLocal8Bit();
+ request->name = app;
if (wait)
request->dbus_startup_type = KService::DBusWait;
@@ -1113,7 +1137,7 @@
}
if (mSlaveValgrind == arg1)
{
- arg_list.prepend(QFile::encodeName(KLibLoader::findLibrary(name.toLocal8Bit())));
+ arg_list.prepend(QFile::encodeName(KLibLoader::findLibrary(name)));
arg_list.prepend(QFile::encodeName(KStandardDirs::locate("exe", "kioslave")));
name = "valgrind";
if (!mSlaveValgrindSkin.isEmpty()) {
Index: kinit/klauncher.h
===================================================================
--- kinit/klauncher.h (revision 918653)
+++ kinit/klauncher.h (revision 918654)
@@ -87,6 +87,7 @@
QString name;
QStringList arg_list;
QString dbus_name;
+ QString tolerant_dbus_name;
enum status_t { Init = 0, Launching, Running, Error, Done };
pid_t pid;
status_t status;

View File

@ -1,6 +1,6 @@
Summary: K Desktop Environment 4 - Libraries
Version: 4.2.0
Release: 5%{?dist}
Release: 6%{?dist}
%if 0%{?fedora} > 8
Name: kdelibs
@ -82,6 +82,10 @@ Patch22: kdelibs-4.1.96-cmake.patch
# upstream
# 4.3 branch
Patch101: kdelibs-4.1.96-AllowExternalPaths.patch
# 4.2 branch
Patch110: kdelibs-4.2.1-kde#917170.patch
Patch111: kdelibs-4.2.1-kde#918403.patch
Patch112: kdelibs-4.2.1-kde#918654.patch
BuildRequires: qt4-devel >= 4.4.0
# qt4%{_?_isa} isn't provided yet -- Rex
@ -211,6 +215,9 @@ sed -i -e "s|@@VERSION_RELEASE@@|%{version}-%{release}|" kio/kio/kprotocolmanage
# upstream patches
%patch101 -p1 -b .AllowExternalPaths
%patch110 -p1 -b .kde#917170
%patch111 -p1 -b .kde#918403
%patch112 -p1 -b .kde#918654
%build
@ -373,6 +380,15 @@ rm -rf %{buildroot}
%changelog
* Fri Jan 30 2009 Lukáš Tinkl <ltinkl@redhat.com> 4.2.0-6
- Emit the correct FilesRemoved signal if the job was aborted in the middle of its operation,
otherwise it can result in confusion and data loss (overwriting files with files
that don't exist). kdebug:118593
- Fix "klauncher hangs when kdeinit4 dies" -- this happened because
klauncher was doing a blocking read forever.
- Repair klauncher support for unique-applications like konsole.
kdebug:162729, kdebug:75492
* Fri Jan 30 2009 Kevin Kofler <Kevin@tigcc.ticalc.org> - 4.2.0-5
- reenable PolicyKit and NTFS workarounds