rev 4749 - in trunk/packages/kdebase/debian: . patches
Fathi Boudra
fboudra-guest at costa.debian.org
Sat Oct 21 16:02:30 UTC 2006
Author: fboudra-guest
Date: 2006-10-21 16:02:30 +0000 (Sat, 21 Oct 2006)
New Revision: 4749
Added:
trunk/packages/kdebase/debian/patches/29_halbackend_fstab_improvements.diff
trunk/packages/kdebase/debian/patches/30_mediamanager_followsymlinks.diff
trunk/packages/kdebase/debian/patches/31_umount_before_eject.diff
Modified:
trunk/packages/kdebase/debian/changelog
Log:
Add media kioslave patches from modax
Modified: trunk/packages/kdebase/debian/changelog
===================================================================
--- trunk/packages/kdebase/debian/changelog 2006-10-21 15:41:21 UTC (rev 4748)
+++ trunk/packages/kdebase/debian/changelog 2006-10-21 16:02:30 UTC (rev 4749)
@@ -1,5 +1,23 @@
kdebase (4:3.5.5a.dfsg.1-1) UNRELEASED; urgency=medium
+ * Add 3 patches. Thanks to Sune Vuorela for investigating and
+ to Modestas Vainius for providing them:
+ * 29_halbackend_fstab_improvements
+ * fixes HALBackend::inInFstab() to correctly match a fstab device node
+ that is a symlink.
+ * If unmounting the device that is in fstab fails, include the list of
+ processes using the device in the error message (in the same way as for
+ HAL mounted devices).
+ * Make the umount error message steal focus from other active window.
+ * Improve wording of the fstab umount error message and make it
+ translatable.
+ * Improve HAL umount error messages.
+ * 30_mediamanager_followsymlinks
+ * MediaManager::properties() follows symlinks on local paths.
+ * 31_umount_before_eject
+ * Revert patch from KDE bug #116209 to make KDE display informative
+ errors in case umount/eject fails.
+
* Promote eject from Recommends to Depends.
* Version our build-conflict with nvidia-glx, since newer packages should
Added: trunk/packages/kdebase/debian/patches/29_halbackend_fstab_improvements.diff
===================================================================
--- trunk/packages/kdebase/debian/patches/29_halbackend_fstab_improvements.diff (rev 0)
+++ trunk/packages/kdebase/debian/patches/29_halbackend_fstab_improvements.diff 2006-10-21 16:02:30 UTC (rev 4749)
@@ -0,0 +1,194 @@
+--- kdebase-3.5.5a/kioslave/media/mediamanager/halbackend.cpp 2006-10-19 15:06:18.000000000 +0300
++++ kdebase-3.5.5a/kioslave/media/mediamanager/halbackend.cpp 2006-10-20 13:54:09.000000000 +0300
+@@ -21,6 +21,7 @@
+
+ #include <stdlib.h>
+
++#include <kapplication.h>
+ #include <qfile.h>
+ #include <klocale.h>
+ #include <kurl.h>
+@@ -978,14 +979,76 @@
+
+ }
+
++QString HALBackend::listUsingProcesses(const Medium* medium)
++{
++ QString proclist, fullmsg;
++ QString cmdline = QString("/usr/bin/env fuser -vm %1 2>&1").arg(KProcess::quote(medium->mountPoint()));
++ FILE *fuser = popen(cmdline.latin1(), "r");
++
++ uint counter = 0;
++ if (fuser) {
++ proclist += "<pre>";
++ QTextIStream is(fuser);
++ QString tmp;
++ while (!is.atEnd()) {
++ tmp = is.readLine();
++ tmp = QStyleSheet::escape(tmp) + "\n";
++
++ proclist += tmp;
++ if (counter++ > 20)
++ {
++ proclist += "...";
++ break;
++ }
++ }
++ proclist += "</pre>";
++ (void)pclose( fuser );
++ }
++ if (counter) {
++ fullmsg = i18n("Moreover, programs still using the device "
++ "have been detected. They are listed below. Close them "
++ "or change their working directory and try again.");
++ fullmsg += "<br>" + proclist;
++ return fullmsg;
++ } else {
++ return QString::null;
++ }
++}
++
+ void HALBackend::slotResult(KIO::Job *job)
+ {
+ kdDebug() << "slotResult " << mount_jobs[job] << endl;
+- if (job->error())
+- {
+- KMessageBox::error(0, job->errorText());
++ QString qerror;
++ const Medium* medium = mount_jobs[job];
++
++ if (job->error() == KIO::ERR_COULD_NOT_UNMOUNT) {
++ QString proclist(listUsingProcesses(medium));
++
++ qerror = "<qt>";
++ qerror += i18n("Unfortunately, the device <b>%1</b> (%2) named <b>'%3'</b> and "
++ "currently mounted at <b>%4</b> could not be unmounted. ").arg(
++ "system:/media/" + medium->name(),
++ medium->deviceNode(),
++ medium->prettyLabel(),
++ medium->prettyBaseURL().pathOrURL());
++ qerror += i18n("The following error was returned by umount command:");
++ qerror += "<br><pre>" + job->errorText() + "</pre>";
++
++ if (!proclist.isEmpty()) {
++ qerror += proclist;
++ }
++ qerror += "</qt>";
++ } else if (job->error()) {
++ qerror = job->errorText();
++ }
++
++ if (job->error()) {
++ // Update user timestamp to steal focus from currently
++ // active window
++ kapp->updateUserTimestamp();
++ KMessageBox::error(0, qerror);
+ }
+- ResetProperties( mount_jobs[job].latin1() );
++ ResetProperties( mount_jobs[job]->id().latin1() );
+ mount_jobs.remove(job);
+ }
+
+@@ -1002,7 +1065,7 @@
+ if ( reald.endsWith( "/" ) )
+ reald = reald.left( reald.length() - 1 );
+ kdDebug() << "isInFstab -" << medium->deviceNode() << "- -" << reald << "- -" << (*it)->mountedFrom() << "-" << endl;
+- if ((*it)->mountedFrom() == medium->deviceNode() || ( !medium->deviceNode().isEmpty() && (*it)->realDeviceName() == medium->deviceNode() ) )
++ if ((*it)->mountedFrom() == medium->deviceNode() || ( !medium->deviceNode().isEmpty() && reald == medium->deviceNode() ) )
+ {
+ QStringList opts = (*it)->mountOptions();
+ if (opts.contains("user") || opts.contains("users"))
+@@ -1025,7 +1088,7 @@
+ KIO::Job *job = KIO::mount( false, 0, medium->deviceNode(), mountPoint );
+ connect(job, SIGNAL( result (KIO::Job *)),
+ SLOT( slotResult( KIO::Job *)));
+- mount_jobs[job] = medium->id();
++ mount_jobs[job] = medium;
+ return QString(); // we won't report an error here
+ } else if (medium->id().startsWith("/org/kde/") )
+ return i18n("Permissions denied");
+@@ -1134,7 +1197,7 @@
+ KIO::Job *job = KIO::unmount( medium->mountPoint(), false );
+ connect(job, SIGNAL( result (KIO::Job *)),
+ SLOT( slotResult( KIO::Job *)));
+- mount_jobs[job] = medium->id();
++ mount_jobs[job] = medium;
+ return QString(); // we won't report an error here
+ }
+
+@@ -1174,35 +1237,31 @@
+ dbus_error_init (&error);
+ if (!(reply = dbus_connection_send_with_reply_and_block (dbus_connection, dmesg, -1, &error)))
+ {
++ QString qerror, reason;
++
+ kdDebug() << "unmount failed for " << udi << ": " << error.name << " " << error.message << endl;
+- QString qerror = error.message;
++ qerror = "<qt>";
++ qerror += i18n("Unfortunately, the device <b>%1</b> (%2) named <b>'%3'</b> and "
++ "currently mounted at <b>%4</b> could not be unmounted. ").arg(
++ "system:/media/" + medium->name(),
++ medium->deviceNode(),
++ medium->prettyLabel(),
++ medium->prettyBaseURL().pathOrURL());
++ qerror += i18n("Unmounting failed due to the following error:");
+ if (!strcmp(error.name, "org.freedesktop.Hal.Device.Volume.Busy")) {
+- qerror = QString("<qt>") + i18n("Device is Busy:");
+- QString cmdline = QString("/usr/bin/env fuser -vm %1 2>&1").arg(KProcess::quote(medium->mountPoint()));
+- FILE *fuser = popen(cmdline.latin1(), "r");
+- uint counter = 0;
+- if (fuser) {
+- qerror += "<pre>";
+- QTextIStream is(fuser);
+- QString tmp;
+- while (!is.atEnd()) {
+- tmp = is.readLine();
+- tmp = QStyleSheet::escape(tmp) + "\n";
+-
+- qerror += tmp;
+- if (counter++ > 20)
+- {
+- qerror += "...";
+- break;
+- }
+- }
+- qerror += "</pre>";
+- (void)pclose( fuser );
+- }
+- qerror += "</qt>";
++ reason = i18n("Device is Busy:");
+ } else if (!strcmp(error.name, "org.freedesktop.Hal.Device.Volume.NotMounted")) {
+ // this is faking. The error is that the device wasn't mounted by hal (but by the system)
+- qerror = i18n("Permissions denied");
++ reason = i18n("Permissions denied");
++ } else {
++ reason = error.message;
++ }
++ qerror += "<p><b>" + reason + "</b></p>";
++
++ // Include list of processes (if any) using the device in the error message
++ reason = listUsingProcesses(medium);
++ if (!reason.isEmpty()) {
++ qerror += reason;
+ }
+
+ dbus_message_unref (dmesg);
+--- kdebase-3.5.5a/kioslave/media/mediamanager/halbackend.h 2006-10-19 11:31:47.000000000 +0300
++++ kdebase-3.5.5a/kioslave/media/mediamanager/halbackend.h 2006-10-19 11:36:42.000000000 +0300
+@@ -151,6 +151,7 @@
+ void setCameraProperties(Medium* medium);
+ QString generateName(const QString &devNode);
+ static QString isInFstab(const Medium *medium);
++ static QString listUsingProcesses(const Medium *medium);
+
+ private slots:
+ void slotResult(KIO::Job *job);
+@@ -216,7 +217,7 @@
+
+ DBusConnection *dbus_connection;
+
+- QMap<KIO::Job *, QString> mount_jobs;
++ QMap<KIO::Job *, const Medium*> mount_jobs;
+ };
+
+ #endif /* _HALBACKEND_H_ */
Added: trunk/packages/kdebase/debian/patches/30_mediamanager_followsymlinks.diff
===================================================================
--- trunk/packages/kdebase/debian/patches/30_mediamanager_followsymlinks.diff (rev 0)
+++ trunk/packages/kdebase/debian/patches/30_mediamanager_followsymlinks.diff 2006-10-21 16:02:30 UTC (rev 4749)
@@ -0,0 +1,26 @@
+--- kdebase-3.5.5a/kioslave/media/mediamanager/mediamanager.cpp 2006-10-19 02:23:49.000000000 +0300
++++ kdebase-3.5.5a/kioslave/media/mediamanager/mediamanager.cpp 2006-10-19 02:24:33.000000000 +0300
+@@ -26,6 +26,7 @@
+ #include <klocale.h>
+
+ #include <kdirnotify_stub.h>
++#include <kstandarddirs.h>
+
+ #include "mediamanagersettings.h"
+
+@@ -162,10 +163,13 @@
+ QPtrList<Medium> list = m_mediaList.list();
+ QPtrList<Medium>::const_iterator it = list.begin();
+ QPtrList<Medium>::const_iterator end = list.end();
++ QString path;
++
+ for (; it!=end; ++it)
+ {
+- kdDebug() << "comparing " << (*it)->mountPoint() << " " << u.path() << " " << (*it)->deviceNode() << endl;
+- if ((*it)->mountPoint() == u.path() || (*it)->deviceNode() == u.path()) {
++ path = KStandardDirs::realFilePath(u.path());
++ kdDebug() << "comparing " << (*it)->mountPoint() << " " << path << " " << (*it)->deviceNode() << endl;
++ if ((*it)->mountPoint() == path || (*it)->deviceNode() == path) {
+ m = *it;
+ break;
+ }
Added: trunk/packages/kdebase/debian/patches/31_umount_before_eject.diff
===================================================================
--- trunk/packages/kdebase/debian/patches/31_umount_before_eject.diff (rev 0)
+++ trunk/packages/kdebase/debian/patches/31_umount_before_eject.diff 2006-10-21 16:02:30 UTC (rev 4749)
@@ -0,0 +1,22 @@
+--- kdebase/kioslave/media/mounthelper/kio_media_mounthelper.cpp 2006/06/12 10:31:42 550578
++++ kdebase/kioslave/media/mounthelper/kio_media_mounthelper.cpp 2006/06/15 22:13:23 551890
+@@ -91,6 +91,19 @@
+ }
+ else if (args->isSet("s") || args->isSet("e"))
+ {
++ if (medium.isMounted())
++ {
++ DCOPRef mediamanager("kded", "mediamanager");
++ DCOPReply reply = mediamanager.call( "unmount", medium.id());
++ if (reply.isValid())
++ reply.get(m_errorStr);
++ m_device = device;
++ if (!m_errorStr.isNull())
++ {
++ error();
++ return;
++ }
++ }
+ invokeEject(device, true);
+ }
+ else
More information about the pkg-kde-commits
mailing list