Bug 45274 - KDE desktop icon mounts for smb shares with special characters in name do not work properly
Summary: KDE desktop icon mounts for smb shares with special characters in name do not...
Status: CLOSED FIXED
Alias: None
Product: kdesktop
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-15 23:33 UTC by spamalam
Modified: 2009-01-02 20:19 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description spamalam 2002-07-15 23:32:43 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kdesktop
Version:           KDE 3.0.0 
Severity:          normal
Installed from:    Not Specified
Compiler:          Not Specified
OS:                Linux
OS/Compiler notes: Red Hat Linux 7.3 kernel 2.4.18-5

I am creating mountpoint icons on my KDE desktop for network smb shares in my fstab by right-clicking and choosing "Create New" - "Hard Disc".  They all work fine except for one which has an & (ampersand) in the name.

The share point is 

//server/c & da  

In my fstab I escape the spaces with \040 as 

//server/c\040&\040da  

I have also escaped the ampersand with \046 as 

//server/c\040\046\040da 

with the same results.

When I click on the desktop icon for this mount it does mount but instead of a Konqeror window opening to show the share contents a Konqeror window opens and attempts to connect to
 http://navigation.realnames.com/resolver.dll?action=navigation&realname=file%3A&charset=iso-8859-1&providerid=180&fallbackuri=http%3A//www.google.com/search%3Fq%3Dfile%253A

It is unable to connect and times out.

Also the desktop icon does not change to the "mounted" icon and the "unmount" menu option is not available when I right click on the mount icon.

Thanks

(Submitted via bugs.kde.org)
Comment 1 mark 2003-01-18 17:23:11 UTC
I had a similar setup with KDE 3.1RC. with an escaped space in a samba share name in 
/etc/fstab. I mounted it fine from a desktop icon click. So, "Works for me".  This was  with 
some Debian/woody packages. 
Comment 2 Waldo Bastian 2003-05-10 20:25:49 UTC
Subject: kdebase/kioslave/devices

CVS commit by waba: 

CCMAIL: 45274-done@bugs.kde.org
Fix handling of mountpoints with spaces (BR45274)


  M +2 -0      configure.in.in   1.4
  M +48 -4     kdedmodule/disklist.cpp   1.11


--- kdebase/kioslave/devices/configure.in.in  #1.3:1.4
@@ -21,2 +21,4 @@
 
 AM_CONDITIONAL(include_devicesdir, test -n "$DEVICESDIR")
+
+AC_CHECK_FUNCS(setmntent)

--- kdebase/kioslave/devices/kdedmodule/disklist.cpp  #1.10:1.11
@@ -37,4 +37,9 @@
 #define FULL_PERCENT 95.0
 
+#ifdef HAVE_MNTENT_H
+#include <mntent.h>
+#endif
+
+
 /***************************************************************************
   * constructor
@@ -90,5 +95,43 @@ int DiskList::readFSTAB()
   if (readingDFStdErrOut || dfProc->isRunning()) return -1;
 
-QFile f(FSTAB);
+#ifdef HAVE_SETMNTENT
+
+#define SETMNTENT setmntent
+#define ENDMNTENT endmntent
+#define STRUCT_MNTENT struct mntent *
+#define STRUCT_SETMNTENT FILE *
+#define GETMNTENT(file, var) ((var = getmntent(file)) != 0)
+#define MOUNTPOINT(var) var->mnt_dir
+#define MOUNTTYPE(var) var->mnt_type
+#define MOUNTOPTIONS(var) var->mnt_opts
+#define HASMNTOPT(var, opt) hasmntopt(var, opt)
+#define FSNAME(var) var->mnt_fsname
+
+  STRUCT_SETMNTENT fstab;
+  if ((fstab = SETMNTENT(FSTAB, "r")) == 0)
+     return -1;
+
+  STRUCT_MNTENT fe;
+  while (GETMNTENT(fstab, fe))
+  {
+      DiskEntry *disk = new DiskEntry();
+      disk->setMounted(FALSE);
+      disk->setDeviceName(QFile::decodeName(FSNAME(fe)));
+      //kdDebug() << "    deviceName:    [" << disk->deviceName() << "]" << endl;
+      disk->setMountPoint(QFile::decodeName(MOUNTPOINT(fe)));
+      //kdDebug() << "    MountPoint:    [" << disk->mountPoint() << "]" << endl;
+      disk->setFsType(QFile::decodeName(MOUNTTYPE(fe)));
+      //kdDebug() << "    FS-Type:       [" << disk->fsType() << "]" << endl;
+      disk->setMountOptions(QFile::decodeName(MOUNTOPTIONS(fe)));
+      //kdDebug() << "    Mount-Options: [" << disk->mountOptions() << "]" << endl;
+      if (!ignoreDisk(disk))
+         replaceDeviceEntry(disk);
+      else
+         delete disk;
+  }
+  ENDMNTENT(fstab);
+
+#else
+  QFile f(FSTAB);
   if ( f.open(IO_ReadOnly) ) {
     QTextStream t (&f);
@@ -132,4 +175,5 @@ QFile f(FSTAB);
     f.close();
   } //if f.open
+#endif
 
   //  kdDebug() << "DiskList::readFSTAB DONE" << endl;
@@ -276,6 +320,6 @@ void DiskList::dfDone()
 
       s=s.remove(0,s.find(BLANK)+1 );  // delete the capacity 94%
-      disk->setMountPoint(s.left(s.find(BLANK)) );
-      s=s.remove(0,s.find(BLANK)+1 );
+      s=s.stripWhiteSpace();
+      disk->setMountPoint(s );
       //kdDebug() << "    MountPoint:       [" << disk->mountPoint() << "]" << endl;
 


Comment 3 FiNeX 2009-01-02 20:19:08 UTC
Bug closed. Kdesktop is no more mantained.