rev 4755 - in trunk/packages/kdebase/debian: . patches

Christopher Martin chrsmrtn at costa.debian.org
Sun Oct 22 18:42:13 UTC 2006


Author: chrsmrtn
Date: 2006-10-22 18:42:12 +0000 (Sun, 22 Oct 2006)
New Revision: 4755

Removed:
   trunk/packages/kdebase/debian/patches/31_umount_before_eject.diff
Modified:
   trunk/packages/kdebase/debian/changelog
   trunk/packages/kdebase/debian/patches/29_halbackend_fstab_improvements.diff
   trunk/packages/kdebase/debian/patches/30_mediamanager_followsymlinks.diff
Log:
Update mounting patches.


Modified: trunk/packages/kdebase/debian/changelog
===================================================================
--- trunk/packages/kdebase/debian/changelog	2006-10-21 18:32:10 UTC (rev 4754)
+++ trunk/packages/kdebase/debian/changelog	2006-10-22 18:42:12 UTC (rev 4755)
@@ -1,7 +1,7 @@
 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:
+  * Add two new patches. Thanks to Sune Vuorela for investigating and
+    to Modestas Vainius for creating them:
     * 29_halbackend_fstab_improvements
       * fixes HALBackend::inInFstab() to correctly match a fstab device node
         that is a symlink.
@@ -12,11 +12,10 @@
       * 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.
+    * 30_mediamanager_followsymlinks
+      * MediaManager::properties() follows symlinks on local paths.
 
   * Add psmisc to Depends of kdebase-kio-plugins since it provides 'fuser'
     utility, needed for listUsingProcesses() function added in
@@ -32,7 +31,7 @@
   * Drop thunderbird icons from the tarball, as they are non-free.
     (Closes: #394045)
 
- -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Wed, 18 Oct 2006 14:30:20 +0200
+ -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Sun, 22 Oct 2006 14:08:55 -0400
 
 kdebase (4:3.5.5a-2) unstable; urgency=low
 

Modified: trunk/packages/kdebase/debian/patches/29_halbackend_fstab_improvements.diff
===================================================================
--- trunk/packages/kdebase/debian/patches/29_halbackend_fstab_improvements.diff	2006-10-21 18:32:10 UTC (rev 4754)
+++ trunk/packages/kdebase/debian/patches/29_halbackend_fstab_improvements.diff	2006-10-22 18:42:12 UTC (rev 4755)
@@ -1,14 +1,15 @@
---- 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 @@
+--- kde.orig/kioslave/media/mediamanager/halbackend.cpp
++++ kde.patched/kioslave/media/mediamanager/halbackend.cpp
+@@ -21,6 +21,8 @@
  
  #include <stdlib.h>
  
 +#include <kapplication.h>
++#include <qeventloop.h>
  #include <qfile.h>
  #include <klocale.h>
  #include <kurl.h>
-@@ -978,14 +979,76 @@
+@@ -978,15 +980,79 @@
  
  }
  
@@ -28,7 +29,7 @@
 +            tmp = QStyleSheet::escape(tmp) + "\n";
 +
 +            proclist += tmp;
-+            if (counter++ > 20)
++            if (counter++ > 10)
 +            {
 +                proclist += "...";
 +                break;
@@ -39,8 +40,9 @@
 +    }
 +    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.");
++            "have been detected. They are listed below. You have to "
++            "close them or change their working before attempting to "
++            "unmount the device again.");
 +        fullmsg += "<br>" + proclist;
 +        return fullmsg;
 +    } else {
@@ -54,9 +56,11 @@
 -    if (job->error())
 -    {
 -        KMessageBox::error(0, job->errorText());
-+    QString qerror;
-+    const Medium* medium = mount_jobs[job];
 +
++    struct mount_job_data *data = mount_jobs[job];
++    QString& qerror = data->errorMessage;
++    const Medium* medium = data->medium;
++
 +    if (job->error() == KIO::ERR_COULD_NOT_UNMOUNT) {
 +        QString proclist(listUsingProcesses(medium));
 +
@@ -76,20 +80,20 @@
 +        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() );
++
++    ResetProperties( medium->id().latin1() );
      mount_jobs.remove(job);
++
++    /* Job completed. Notify the caller */
++    data->error = job->error();
++    data->completed = true;
++    kapp->eventLoop()->exitLoop();
  }
  
-@@ -1002,7 +1065,7 @@
+ QString HALBackend::isInFstab(const Medium *medium)
+@@ -1002,7 +1068,7 @@
          if ( reald.endsWith( "/" ) )
              reald = reald.left( reald.length() - 1 );
          kdDebug() << "isInFstab -" << medium->deviceNode() << "- -" << reald << "- -" << (*it)->mountedFrom() << "-" << endl;
@@ -98,25 +102,61 @@
  	{
              QStringList opts = (*it)->mountOptions();
              if (opts.contains("user") || opts.contains("users"))
-@@ -1025,7 +1088,7 @@
+@@ -1021,14 +1087,25 @@
+     QString mountPoint = isInFstab(medium);
+     if (!mountPoint.isNull())
+     {
++        struct mount_job_data data;
++        data.completed = false;
++        data.medium = medium;
++
+         kdDebug() << "triggering user mount " << medium->deviceNode() << " " << mountPoint << " " << medium->id() << endl;
          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
+-        return QString(); // we won't report an error here
++        mount_jobs[job] = &data;
++        // The caller expects the device to be mounted when the function
++        // completes. Thus block until the job completes.
++        while (!data.completed) {
++            kapp->eventLoop()->enterLoop();
++        }
++        // Return the error message (if any) to the caller
++        return (data.error) ? data.errorMessage : QString::null;
++
      } else if (medium->id().startsWith("/org/kde/") )
- 	return i18n("Permissions denied");
-@@ -1134,7 +1197,7 @@
+-	return i18n("Permissions denied");
++	    return i18n("Permissions denied");
+ 
+     QStringList soptions;
+ 
+@@ -1130,12 +1207,22 @@
+     QString mountPoint = isInFstab(medium);
+     if (!mountPoint.isNull())
+     {
++        struct mount_job_data data;
++        data.completed = false;
++        data.medium = medium;
++
+         kdDebug() << "triggering user unmount " << medium->deviceNode() << " " << mountPoint << endl;
          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
+-        return QString(); // we won't report an error here
++        mount_jobs[job] = &data;
++        // The caller expects the device to be unmounted when the function
++        // completes. Thus block until the job completes.
++        while (!data.completed) {
++            kapp->eventLoop()->enterLoop();
++        }
++        // Return the error message (if any) to the caller
++        return (data.error) ? data.errorMessage : QString::null;
      }
  
-@@ -1174,35 +1237,31 @@
+     DBusMessage *dmesg, *reply;
+@@ -1174,35 +1261,31 @@
      dbus_error_init (&error);
      if (!(reply = dbus_connection_send_with_reply_and_block (dbus_connection, dmesg, -1, &error)))
      {
@@ -173,8 +213,8 @@
          }
  
          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
+--- kdebase.orig/kioslave/media/mediamanager/halbackend.h
++++ kdebase.patched/kioslave/media/mediamanager/halbackend.h
 @@ -151,6 +151,7 @@
  	void setCameraProperties(Medium* medium);
  	QString generateName(const QString &devNode);
@@ -183,12 +223,154 @@
  
  private slots:
  	void slotResult(KIO::Job *job);
-@@ -216,7 +217,7 @@
+@@ -216,7 +217,21 @@
  
  	DBusConnection *dbus_connection;
  
 -	QMap<KIO::Job *, QString> mount_jobs;
-+	QMap<KIO::Job *, const Medium*> mount_jobs;
++    /**
++    * Data structure for fstab mount/unmount jobs
++    */
++    struct mount_job_data {
++        // [in] Medium, which is being mounted/unmounted by the job
++        const Medium* medium;
++        // [in,out] Should be set to true when the job completes
++        bool completed;
++        // [out] KIO::Error if an error occured during operation. Otherwise, 0
++        int error;
++        // [out] Error message to be displayed to the user
++        QString errorMessage;
++    };
++
++	QMap<KIO::Job *, struct mount_job_data*> mount_jobs;
  };
  
  #endif /* _HALBACKEND_H_ */
+--- kde.orig/kioslave/media/mounthelper/kio_media_mounthelper.cpp
++++ kde.patched/kioslave/media/mounthelper/kio_media_mounthelper.cpp
+@@ -91,6 +91,23 @@
+ 	}
+ 	else if (args->isSet("s") || args->isSet("e"))
+ 	{
++        /*
++         * We want to call mediamanager unmount before invoking eject. That's
++         * because unmount would provide an informative error message in case of
++         * failure. However, there are cases when unmount would fail
++         * (supermount, slackware, see bug#116209) but eject would succeed.
++         * Thus if unmount fails, save unmount error message and invokeEject()
++         * anyway. Only if both unmount and eject fail, notify the user by
++         * displaying the saved error message (see ejectFinished()).
++         */
++		if (medium.isMounted())
++		{
++		  DCOPRef mediamanager("kded", "mediamanager");
++		  DCOPReply reply = mediamanager.call( "unmount", medium.id());
++		  if (reply.isValid())
++		    reply.get(m_errorStr);
++		  m_device = device;
++		}
+ 		invokeEject(device, true);
+ 	}
+ 	else
+@@ -115,59 +132,27 @@
+ 		*proc << "-q";
+ 	}
+ 	*proc << device;
+-	proc->start();
+ 	connect( proc, SIGNAL(processExited(KProcess *)),
+-	         this, SLOT( finished() ) );
+-}
+-
+-void MountHelper::slotResultSafe(KIO::Job* job)
+-{
+-	if (job->error())
+-	{
+-		m_errorStr = job->errorText();
+-		
+-		if (m_isCdrom)
+-		{
+-			m_errorStr+= i18n("\nPlease check that the disk is"
+-			                  " entered correctly.");
+-		}
+-		else
+-		{
+-			m_errorStr+= i18n("\nPlease check that the device is"
+-			                  " plugged correctly.");
+-		}
+-		
+-		QTimer::singleShot(0, this, SLOT(error()) );
+-	}
+-	else
+-	{
+-		invokeEject(m_device, true);
+-	}
++        this, SLOT( ejectFinished(KProcess *) ) );
++	proc->start();
+ }
+ 
+-void MountHelper::slotResult(KIO::Job* job)
++void MountHelper::ejectFinished(KProcess* proc)
+ {
+-	if (job->error())
+-	{
+-		m_errorStr = job->errorText();
+-		
+-		if (m_isCdrom)
+-		{
+-			m_errorStr+= i18n("\nPlease check that the disk is"
+-			                  " entered correctly.");
+-		}
+-		else
+-		{
+-			m_errorStr+= i18n("\nPlease check that the device is"
+-			                  " plugged correctly.");
+-		}
+-				
+-		QTimer::singleShot(0, this, SLOT(error()) );
+-	}
+-	else
+-	{
+-		QTimer::singleShot(0, this, SLOT(finished()) );
+-	}
++    /*
++     * If eject failed, report the error stored in m_errorStr
++     */
++    if (proc->normalExit() && proc->exitStatus() == 0) {
++        ::exit(0);
++    } else {
++        if (m_errorStr.isEmpty()) {
++            if (m_isCdrom)
++                m_errorStr = i18n("The device was successfully unmounted, but the tray could not be opened");
++            else
++                m_errorStr = i18n("The device was successfully unmounted, but could not be ejected");
++        }
++        QTimer::singleShot(0, this, SLOT(error()));
++    }
+ }
+ 
+ void MountHelper::error()
+@@ -176,11 +161,6 @@
+ 	::exit(1);
+ }
+ 
+-void MountHelper::finished()
+-{
+-        ::exit(0);
+-}
+-
+ static KCmdLineOptions options[] =
+ {
+ 	{ "u", I18N_NOOP("Unmount given URL"), 0 },
+--- kde.orig/kioslave/media/mounthelper/kio_media_mounthelper.h
++++ kde.patched/kioslave/media/mounthelper/kio_media_mounthelper.h
+@@ -42,9 +42,7 @@
+ 	bool m_isCdrom;
+ 
+ private slots:
+-	void slotResult(KIO::Job* job);
+-	void slotResultSafe(KIO::Job* job);
+-	void finished();
++	void ejectFinished(KProcess* proc);
+ 	void error();
+ };
+ 

Modified: trunk/packages/kdebase/debian/patches/30_mediamanager_followsymlinks.diff
===================================================================
--- trunk/packages/kdebase/debian/patches/30_mediamanager_followsymlinks.diff	2006-10-21 18:32:10 UTC (rev 4754)
+++ trunk/packages/kdebase/debian/patches/30_mediamanager_followsymlinks.diff	2006-10-22 18:42:12 UTC (rev 4755)
@@ -1,5 +1,5 @@
---- 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
+--- kde.orig/kioslave/media/mediamanager/mediamanager.cpp
++++ kde.patched/kioslave/media/mediamanager/mediamanager.cpp
 @@ -26,6 +26,7 @@
  #include <klocale.h>
  

Deleted: trunk/packages/kdebase/debian/patches/31_umount_before_eject.diff




More information about the pkg-kde-commits mailing list