[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#408767: kde mount removable media without iocharset and ignore HAL mountoptions



Package: kdebase-kio-plugins
Version: 4:3.5.5a.dfsg.1-5
Severity: important
Tags: patch

Hi there.

KDE allow users to mount removable media via HAL.
HAL has some system-wide settings for media mounting
(volume.policy.mount_option.* keys which are accessible via libhal_volume_policy_get_mount_options()).
This settins are depricated for now, but gnome, ivman, pmount-hal and
may be other soft still use this settings.
Non-uft8, non-latin1 systems need codepage=,iocharset= for mounting some
media (e.g. vfat).
KDE don't allow to configure mounting, to force using of this settins,
and doesn't use mount options from HAL.
(Look at http://bugs.kde.org/show_bug.cgi?id=133456 also)

So KDE doesn't use HAL settins (as most analogous software do), and
doesn't allow Russian (and other non-latin1) non-utf8 users mount vfat
media in their local codepage. If we force KDE a little bit, it will use
HAL settings and that will solve our problem.

Unability to mount vfat with iocharset,codepage is very serious problem
with makes KDE's mounting useless for most of Russian (and other non-latin1)
users.

Unfortunately I've found this problem so late. If it's impossible to
include the following patch into Etch release, may be it's possible to
push it into one of following proposed-update builds? And into r1?

kdebase-kio-plugins from experimental looks also affected by this bug.

Regards, Alexander.

Patch is very simple:

It reads mount options from HAL with libhal_volume_policy_get_mount_options(),
add options from there to mount options used in mount process, and remove utf8 
option if meet iocharset in the HAL mountoptions.

Patch is attached.

-- System Information:
Debian Release: 4.0
  APT prefers testing-proposed-updates
  APT policy: (720, 'testing-proposed-updates'), (720, 'testing'), (670, 'proposed-updates'), (670, 'stable'), (600, 'unstable'), (550, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-vserver-686
Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R)

Versions of packages kdebase-kio-plugins depends on:
ii  kdelibs4c2a         4:3.5.5a.dfsg.1-5    core libraries and binaries for al
ii  kdesktop            4:3.5.5a.dfsg.1-5    miscellaneous binaries and files f
ii  libc6               2.3.6.ds1-8          GNU C Library: Shared libraries
ii  libdbus-1-3         1.0.2-1              simple interprocess messaging syst
ii  libdbus-qt-1-1c2    0.62.git.20060814-2  simple interprocess messaging syst
ii  libgcc1             1:4.1.1-21           GCC support library
ii  libhal-storage1     0.5.8.1-6            Hardware Abstraction Layer - share
ii  libhal1             0.5.8.1-6            Hardware Abstraction Layer - share
ii  libldap2            2.1.30-13.2          OpenLDAP libraries
ii  libopenexr2c2a      1.2.2-4.3            runtime files for the OpenEXR imag
ii  libqt3-mt           3:3.3.7-2            Qt GUI Library (Threaded runtime v
ii  libsasl2-2          2.1.22.dfsg1-8       Authentication abstraction library
ii  libsasl2-modules    2.1.22.dfsg1-8       Pluggable Authentication Modules f
ii  libsmbclient        3.0.23d-4            shared library that allows applica
ii  libstdc++6          4.1.1-21             The GNU Standard C++ Library v3
ii  libxcursor1         1.1.7-4              X cursor management library
ii  psmisc              22.3-1               Utilities that use the proc filesy
ii  zlib1g              1:1.2.3-13           compression library - runtime

Versions of packages kdebase-kio-plugins recommends:
ii  hal                          0.5.8.1-6   Hardware Abstraction Layer
ii  kamera                       4:3.5.5-2   digital camera io_slave for Konque
ii  kdemultimedia-kio-plugins    4:3.5.5-2   enables the browsing of audio CDs 
ii  pmount                       0.9.13-1+b1 mount removable devices as normal 

-- no debconf information
diff -r -u kdebase-3.5.5a.dfsg.1.orig/kioslave/media/mediamanager/halbackend.cpp kdebase-3.5.5a.dfsg.1/kioslave/media/mediamanager/halbackend.cpp
--- kdebase-3.5.5a.dfsg.1.orig/kioslave/media/mediamanager/halbackend.cpp	2007-01-25 12:34:07.805485000 +0300
+++ kdebase-3.5.5a.dfsg.1/kioslave/media/mediamanager/halbackend.cpp	2007-01-25 16:46:59.118184525 +0300
@@ -745,6 +745,33 @@
     s_HALBackend->DeviceCondition(udi, condition_name);
 }
 
+QStringList HALBackend::getHALmountoptions(QString udi)
+{
+    const char*   _ppt_string;
+    LibHalVolume* volume;
+    LibHalDrive* drive;
+
+    QString _ppt_QString;
+    
+    volume = libhal_volume_from_udi( m_halContext, udi.latin1() );
+    if( volume )
+        drive = libhal_drive_from_udi( m_halContext, libhal_volume_get_storage_device_udi( volume ) );
+    else
+        drive = libhal_drive_from_udi( m_halContext, udi.latin1() );
+
+    if( !drive )
+	    return QString::null;
+
+    if( volume )
+       _ppt_string = libhal_volume_policy_get_mount_options ( drive, volume, NULL );
+    else
+       _ppt_string = libhal_drive_policy_get_mount_options ( drive, NULL );
+
+    _ppt_QString = QString(_ppt_string ? _ppt_string : "");
+
+   return QStringList::split(",",_ppt_QString);
+}
+
 QStringList HALBackend::mountoptions(const QString &name)
 {
     const Medium* medium = m_mediaList.findById(name);
@@ -1069,10 +1096,25 @@
             soptions << QString("data=ordered");
     }
 
+    QStringList hal_mount_options = getHALmountoptions(medium->id());
+    for (QValueListIterator<QString> it=hal_mount_options.begin();it!=hal_mount_options.end();it++)
+    {
+    	soptions << *it;
+	kdDebug()<<"HALOption: "<<*it<<endl;
+	if ((*it).startsWith("iocharset="))
+	{
+	    soptions.remove("utf8");
+	    kdDebug()<<"\"iocharset=\" found. Removing \"utf8\" from options."<<endl;
+	}
+    }
+
     const char **options = new const char*[soptions.size() + 1];
     uint noptions = 0;
     for (QStringList::ConstIterator it = soptions.begin(); it != soptions.end(); ++it, ++noptions)
+    {
         options[noptions] = (*it).latin1();
+        kdDebug()<<"Option: "<<*it<<endl;
+    }
     options[noptions] = NULL;
 
     QString qerror = mount_priv(medium->id().latin1(), mount_point.utf8(), options, noptions, dbus_connection);
diff -r -u kdebase-3.5.5a.dfsg.1.orig/kioslave/media/mediamanager/halbackend.h kdebase-3.5.5a.dfsg.1/kioslave/media/mediamanager/halbackend.h
--- kdebase-3.5.5a.dfsg.1.orig/kioslave/media/mediamanager/halbackend.h	2007-01-25 12:34:07.133446000 +0300
+++ kdebase-3.5.5a.dfsg.1/kioslave/media/mediamanager/halbackend.h	2007-01-25 16:33:54.413638693 +0300
@@ -192,6 +192,7 @@
 				const char* message
 				);
 
+	QStringList getHALmountoptions(QString udi);
 /* HAL and DBus structures */
 private:
 	/**

Reply to: