From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Feb 8 23:10:23 2007 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DD0DC16A40F for ; Thu, 8 Feb 2007 23:10:22 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id B7F1F13C47E for ; Thu, 8 Feb 2007 23:10:22 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l18NAMMK019794 for ; Thu, 8 Feb 2007 23:10:22 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l18NAMAN019793; Thu, 8 Feb 2007 23:10:22 GMT (envelope-from gnats) Resent-Date: Thu, 8 Feb 2007 23:10:22 GMT Resent-Message-Id: <200702082310.l18NAMAN019793@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Maxim Samsonov Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A724E16A405 for ; Thu, 8 Feb 2007 23:03:40 +0000 (UTC) (envelope-from xors@sendmail.ru) Received: from softel.ru (mail.softel.ru [217.25.84.28]) by mx1.freebsd.org (Postfix) with ESMTP id CCBF713C442 for ; Thu, 8 Feb 2007 23:03:39 +0000 (UTC) (envelope-from xors@sendmail.ru) Received: from pg.org ([217.25.92.202]) by softel.ru (8.12.10/8.12.10/check_local-5) with ESMTP id l18MDipR000953 for ; Fri, 9 Feb 2007 01:13:44 +0300 Received: from xors.pg.org (localhost.pg.org [127.0.0.1]) by pg.org (8.13.8/8.13.8) with ESMTP id l18MJpcm021037 for ; Fri, 9 Feb 2007 01:19:51 +0300 (MSK) (envelope-from xors@xors.pg.org) Received: (from xors@localhost) by xors.pg.org (8.13.8/8.13.8/Submit) id l18MJpBe021036; Fri, 9 Feb 2007 01:19:51 +0300 (MSK) (envelope-from xors) Message-Id: <200702082219.l18MJpBe021036@xors.pg.org> Date: Fri, 9 Feb 2007 01:19:51 +0300 (MSK) From: Maxim Samsonov To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/108949: [PATCH]: x11/kdebase3 [kioslave/media] media ejecting, various HAL backend problems X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Maxim Samsonov List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Feb 2007 23:10:23 -0000 >Number: 108949 >Category: ports >Synopsis: [PATCH]: x11/kdebase3 [kioslave/media] media ejecting, various HAL backend problems >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Feb 08 23:10:22 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Maxim Samsonov >Release: FreeBSD 6.2-STABLE i386 >Organization: >Environment: >Description: This patch tries to solve the problems in kioslave/media which are listed below: 1. Correct ejecting of mounted volumes (unmount before eject). 2. Mounting of removable media drives (such as CD-ROM drives) listed in /etc/fstab (removes checking linux's "user" mount option). 3. Polling floppy drives over the mount state (FreeBSD HAL doesn't do this). 4. Informing the fileview when HAL notifies that mounting is completed. 5. Mounting cdrom volume in locale charset. >How-To-Repeat: >Fix: --- kdebase3.diff begins here --- diff -ubdBrN kdebase3.orig/Makefile kdebase3/Makefile --- kdebase3.orig/Makefile Mon Jan 8 13:35:52 2007 +++ kdebase3/Makefile Thu Feb 8 23:51:24 2007 @@ -71,7 +71,8 @@ .endif .if defined(WITH_HAL) && ${OSVERSION} > 500035 -EXTRA_PATCHES= ${FILESDIR}/extrapatch-kioslave_media_mediamanager-halbackend.cpp +EXTRA_PATCHES= ${FILESDIR}/extrapatch-kioslave_media_mediamanager-halbackend.cpp \ + ${FILESDIR}/extrapatch-kioslave_media_mediamanager-halbackend.h LIB_DEPENDS+= dbus-qt-1.1:${PORTSDIR}/devel/dbus-qt3 \ hal.1:${PORTSDIR}/sysutils/hal PLIST_SUB+= MEDIA="" diff -ubdBrN kdebase3.orig/files/extrapatch-kioslave_media_mediamanager-halbackend.cpp kdebase3/files/extrapatch-kioslave_media_mediamanager-halbackend.cpp --- kdebase3.orig/files/extrapatch-kioslave_media_mediamanager-halbackend.cpp Wed Dec 20 23:42:54 2006 +++ kdebase3/files/extrapatch-kioslave_media_mediamanager-halbackend.cpp Thu Feb 8 23:38:29 2007 @@ -1,14 +1,43 @@ ---- kioslave/media/mediamanager/halbackend.cpp.orig Sun Oct 1 19:31:54 2006 -+++ kioslave/media/mediamanager/halbackend.cpp Wed Dec 20 20:22:28 2006 -@@ -17,7 +17,6 @@ +--- kioslave/media/mediamanager/halbackend.cpp.orig Sun Oct 1 21:31:54 2006 ++++ kioslave/media/mediamanager/halbackend.cpp Tue Feb 6 02:14:55 2007 +@@ -17,9 +17,13 @@ */ #include "halbackend.h" -#include "linuxcdpolling.h" #include ++#ifdef Q_OS_FREEBSD ++#include ++#include ++#include ++#endif -@@ -242,11 +241,11 @@ + #include + #include +@@ -66,6 +70,10 @@ + /* Close HAL connection */ + if (m_halContext) + { ++#ifdef Q_OS_FREEBSD ++ m_pollTimer.stop(); ++ m_pollMediaList.clear(); ++#endif + const QPtrList medlist = m_mediaList.list(); + QPtrListIterator it (medlist); + for ( const Medium *current_medium = it.current(); current_medium; current_medium = ++it) +@@ -185,6 +193,10 @@ + + libhal_free_string_array( halDeviceList ); + ++#ifdef Q_OS_FREEBSD ++ connect(&m_pollTimer, SIGNAL(timeout()), ++ this, SLOT(pollMediaList())); ++#endif + return true; + } + +@@ -242,11 +254,11 @@ Medium* medium = new Medium(udi, ""); QMap options = MediaManagerUtils::splitOptions(mountoptions(udi)); @@ -22,7 +51,44 @@ } setVolumeProperties(medium); m_mediaList.addMedium(medium, allowNotification); -@@ -326,7 +325,7 @@ +@@ -264,6 +276,11 @@ + Medium* medium = new Medium(udi, ""); + setFloppyProperties(medium); + m_mediaList.addMedium(medium, allowNotification); ++#ifdef Q_OS_FREEBSD ++ m_pollTimer.stop(); ++ m_pollMediaList.append(medium); ++ m_pollTimer.start(250); ++#endif + return; + } + +@@ -285,12 +302,23 @@ + + void HALBackend::RemoveDevice(const char *udi) + { ++#ifdef Q_OS_FREEBSD ++ m_pollMediaList.remove(m_mediaList.findById(udi)); ++ if (m_pollMediaList.isEmpty()) ++ m_pollTimer.stop(); ++#endif + m_mediaList.removeMedium(udi, true); + } + + void HALBackend::ModifyDevice(const char *udi, const char* key) + { +- Q_UNUSED(key); ++ if ( ++ !( strcmp(key, "info.hal_mount.created_mount_point") ++ && strcmp(key, "info.hal_mount.mounted_by_uid") ++ && strcmp(key, "volume.mount_point") ++ && strcmp(key, "volume.is_mounted_read_only"))) ++ return; ++ + const char* mediumUdi = findMediumUdiFromUdi(udi); + if (!mediumUdi) + return; +@@ -326,7 +354,7 @@ } const char* mediumUdi = findMediumUdiFromUdi(udi); @@ -31,7 +97,7 @@ if (!mediumUdi) return; -@@ -384,7 +383,7 @@ +@@ -384,7 +412,7 @@ { Medium m( *cmedium ); if ( setFstabProperties( &m ) ) { @@ -40,7 +106,15 @@ m_mediaList.changeMediumState(m, false); } return; -@@ -469,28 +468,23 @@ +@@ -399,6 +427,7 @@ + setFloppyProperties(m); + if (libhal_device_query_capability(m_halContext, mediumUdi, "camera", NULL)) + setCameraProperties(m); ++ m->setHalMounted(libhal_device_get_property_string(m_halContext, mediumUdi, "info.hal_mount.created_mount_point", NULL)); + + m_mediaList.changeMediumState(*m, false); + +@@ -469,28 +498,23 @@ else mimeType = "media/dvd" + MOUNT_SUFFIX; @@ -80,7 +154,7 @@ } else { -@@ -575,7 +569,7 @@ +@@ -575,7 +599,7 @@ } } @@ -89,7 +163,7 @@ QString fstype = medium->fsType(); if ( fstype.isNull() ) fstype = "auto"; -@@ -762,7 +756,7 @@ +@@ -762,7 +786,7 @@ if (t.endsWith("=")) t = t.left(t.length() - 1); valids[t] = true; @@ -98,7 +172,17 @@ } libhal_free_string_array(array); QStringList result; -@@ -887,7 +881,7 @@ +@@ -882,12 +906,17 @@ + result << "journaling=ordered"; + } + ++ if (valids.contains("-C")) ++ { ++ result << QString("charset=%1").arg(KGlobal::locale()->encoding()); ++ } ++ + return result; + } bool HALBackend::setMountoptions(const QString &name, const QStringList &options ) { @@ -107,7 +191,7 @@ KConfig config("mediamanagerrc"); config.setGroup(name); -@@ -927,7 +921,7 @@ +@@ -927,7 +956,7 @@ if (!(dmesg = dbus_message_new_method_call ("org.freedesktop.Hal", udi, "org.freedesktop.Hal.Device.Volume", "Mount"))) { @@ -116,7 +200,7 @@ return i18n("Internal Error"); } -@@ -935,7 +929,7 @@ +@@ -935,7 +964,7 @@ DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &poptions, noptions, DBUS_TYPE_INVALID)) { @@ -125,7 +209,7 @@ dbus_message_unref (dmesg); return i18n("Internal Error"); } -@@ -963,7 +957,7 @@ +@@ -963,7 +992,7 @@ return qerror; } @@ -134,7 +218,7 @@ dbus_message_unref (dmesg); dbus_message_unref (reply); -@@ -974,7 +968,7 @@ +@@ -974,15 +1003,33 @@ void HALBackend::slotResult(KIO::Job *job) { @@ -143,7 +227,34 @@ if (job->error()) { KMessageBox::error(0, job->errorText()); -@@ -992,7 +986,7 @@ + } +- ResetProperties( mount_jobs[job].latin1() ); + mount_jobs.remove(job); + } + ++#ifdef Q_OS_FREEBSD ++void HALBackend::pollMediaList() ++{ ++ struct statfs *mntBuf; ++ int mntNum = getmntinfo(&mntBuf, MNT_NOWAIT); ++ QPtrList::iterator it = m_pollMediaList.begin(); ++ QPtrList::iterator end = m_pollMediaList.end(); ++ for (; it!=end; ++it) ++ { ++ bool mounted = false; ++ const char *dev = (*it)->deviceNode().ascii(); ++ for (int n = mntNum-1; n >= 0 && !mounted; n--) ++ mounted = !strcmp(dev, mntBuf[n].f_mntfromname); ++ if ((*it)->isMounted() != mounted) ++ ResetProperties((*it)->id().latin1()); ++ } ++} ++#endif ++ + QString HALBackend::isInFstab(const Medium *medium) + { + KMountPoint::List fstab = KMountPoint::possibleMountPoints(KMountPoint::NeedMountOptions|KMountPoint::NeedRealDeviceName); +@@ -992,11 +1039,13 @@ for (; it!=end; ++it) { @@ -151,8 +262,14 @@ + kdDebug(1219) << "isInFstab -" << medium->deviceNode() << "- -" << (*it)->realDeviceName() << "- -" << (*it)->mountedFrom() << endl; if ((*it)->mountedFrom() == medium->deviceNode() || ( !medium->deviceNode().isEmpty() && (*it)->realDeviceName() == medium->deviceNode() ) ) { ++#ifndef Q_OS_FREEBSD QStringList opts = (*it)->mountOptions(); -@@ -1012,7 +1006,7 @@ + if (opts.contains("user") || opts.contains("users")) ++#endif + return (*it)->mountPoint(); + } + } +@@ -1012,7 +1061,7 @@ QString mountPoint = isInFstab(medium); if (!mountPoint.isNull()) { @@ -161,7 +278,7 @@ KIO::Job *job = KIO::mount( false, 0, medium->deviceNode(), mountPoint ); connect(job, SIGNAL( result (KIO::Job *)), SLOT( slotResult( KIO::Job *))); -@@ -1023,7 +1017,7 @@ +@@ -1023,7 +1072,7 @@ QStringList soptions; @@ -170,7 +287,7 @@ QMap valids = MediaManagerUtils::splitOptions(mountoptions(medium->id())); if (valids["flush"] == "true") -@@ -1036,10 +1030,10 @@ +@@ -1036,10 +1085,10 @@ if (valids["ro"] == "true") soptions << "ro"; @@ -183,7 +300,29 @@ if (valids["quiet"] == "true") soptions << "quiet"; -@@ -1121,7 +1115,7 @@ +@@ -1069,6 +1118,11 @@ + soptions << QString("data=ordered"); + } + ++ if (valids.contains("charset")) ++ { ++ soptions << QString("-C=%1").arg(valids["charset"]); ++ } ++ + const char **options = new const char*[soptions.size() + 1]; + uint noptions = 0; + for (QStringList::ConstIterator it = soptions.begin(); it != soptions.end(); ++it, ++noptions) +@@ -1081,9 +1135,6 @@ + return qerror; + } + +- medium->setHalMounted(true); +- ResetProperties(medium->id().latin1()); +- + return QString(); + } + +@@ -1121,7 +1172,7 @@ QString mountPoint = isInFstab(medium); if (!mountPoint.isNull()) { @@ -192,7 +331,7 @@ KIO::Job *job = KIO::unmount( medium->mountPoint(), false ); connect(job, SIGNAL( result (KIO::Job *)), SLOT( slotResult( KIO::Job *))); -@@ -1134,7 +1128,7 @@ +@@ -1134,7 +1185,7 @@ const char *options[2]; const char *udi = medium->id().latin1(); @@ -201,7 +340,7 @@ dbus_error_init(&error); DBusConnection *dbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error); -@@ -1147,7 +1141,7 @@ +@@ -1147,7 +1198,7 @@ if (!(dmesg = dbus_message_new_method_call ("org.freedesktop.Hal", udi, "org.freedesktop.Hal.Device.Volume", "Unmount"))) { @@ -210,7 +349,7 @@ return i18n("Internal Error"); } -@@ -1157,7 +1151,7 @@ +@@ -1157,7 +1208,7 @@ if (!dbus_message_append_args (dmesg, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &options, 0, DBUS_TYPE_INVALID)) { @@ -219,7 +358,7 @@ dbus_message_unref (dmesg); return i18n("Internal Error"); } -@@ -1165,7 +1159,7 @@ +@@ -1165,7 +1216,7 @@ dbus_error_init (&error); if (!(reply = dbus_connection_send_with_reply_and_block (dbus_connection, dmesg, -1, &error))) { @@ -228,7 +367,7 @@ QString qerror = error.message; if (!strcmp(error.name, "org.freedesktop.Hal.Device.Volume.Busy")) { qerror = QString("") + i18n("Device is Busy:"); -@@ -1201,7 +1195,7 @@ +@@ -1201,13 +1252,10 @@ return qerror; } @@ -237,3 +376,9 @@ dbus_message_unref (dmesg); dbus_message_unref (reply); +- +- medium->setHalMounted(false); +- ResetProperties(udi); + + return QString(); + } diff -ubdBrN kdebase3.orig/files/extrapatch-kioslave_media_mediamanager-halbackend.h kdebase3/files/extrapatch-kioslave_media_mediamanager-halbackend.h --- kdebase3.orig/files/extrapatch-kioslave_media_mediamanager-halbackend.h Thu Jan 1 03:00:00 1970 +++ kdebase3/files/extrapatch-kioslave_media_mediamanager-halbackend.h Thu Feb 8 23:38:41 2007 @@ -0,0 +1,33 @@ +--- kioslave/media/mediamanager/halbackend.h.orig Sun Jan 28 23:58:13 2007 ++++ kioslave/media/mediamanager/halbackend.h Thu Feb 1 02:51:48 2007 +@@ -34,6 +34,9 @@ + #include + #include + #include ++#ifdef Q_OS_FREEBSD ++#include ++#endif + + #include + +@@ -154,6 +157,9 @@ + + private slots: + void slotResult(KIO::Job *job); ++#ifdef Q_OS_FREEBSD ++ void pollMediaList(); ++#endif + + /* Hal call-backs -- from gvm*/ + public: +@@ -217,6 +223,10 @@ + DBusConnection *dbus_connection; + + QMap mount_jobs; ++#ifdef Q_OS_FREEBSD ++ QTimer m_pollTimer; ++ QPtrList m_pollMediaList; ++#endif + }; + + #endif /* _HALBACKEND_H_ */ diff -ubdBrN kdebase3.orig/files/patch-kioslave_media_mounthelper-kio_media_mounthelper.cpp kdebase3/files/patch-kioslave_media_mounthelper-kio_media_mounthelper.cpp --- kdebase3.orig/files/patch-kioslave_media_mounthelper-kio_media_mounthelper.cpp Thu Jan 1 03:00:00 1970 +++ kdebase3/files/patch-kioslave_media_mounthelper-kio_media_mounthelper.cpp Thu Feb 8 23:43:59 2007 @@ -0,0 +1,32 @@ +--- kioslave/media/mounthelper/kio_media_mounthelper.cpp.orig Sat Jan 27 01:58:24 2007 ++++ kioslave/media/mounthelper/kio_media_mounthelper.cpp Sat Jan 27 02:35:28 2007 +@@ -77,7 +77,9 @@ + m_isCdrom = medium.mimeType().find("dvd")!=-1 + || medium.mimeType().find("cd")!=-1; + +- if (args->isSet("u")) ++ bool do_eject = args->isSet("s") || args->isSet("e"); ++ ++ if (args->isSet("u") || do_eject) + { + DCOPRef mediamanager("kded", "mediamanager"); + DCOPReply reply = mediamanager.call( "unmount", medium.id()); +@@ -85,13 +87,14 @@ + reply.get(m_errorStr); + kdDebug() << "medium unmount " << m_errorStr << endl; + if (m_errorStr.isNull()) ++ { ++ if( do_eject ) ++ invokeEject(device, true); ++ else + ::exit(0); ++ } + else + error(); +- } +- else if (args->isSet("s") || args->isSet("e")) +- { +- invokeEject(device, true); + } + else + { --- kdebase3.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: