Bug 45554 - space in mountpoint don't work
Summary: space in mountpoint don't work
Status: RESOLVED FIXED
Alias: None
Product: kdf
Classification: Applications
Component: general (show other bugs)
Version: 0.5
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Michael Kropfberger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-21 10:48 UTC by nils-eric
Modified: 2003-02-12 04:21 UTC (History)
0 users

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 nils-eric 2002-07-21 10:41:00 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kdf
Version:           v0.5 (using KDE 3.0.0 )
Severity:          normal
Installed from:    SuSE
Compiler:          gcc version 2.95.3 20010315 (SuSE)
OS:                Linux (i686) release 2.4.18-4GB
OS/Compiler notes: 

When writing somthing like

/dev/hdb2 /two\040words vfat ...

it mounts correct in "/two words" but in Kdiskfree it shows up as two rows. One withe mountpoint "/two/040words" and one withe mountpoint "/two". The first one is not available but the second is.

Further...

When writing somthing like

/dev/hdb2 /two\040words vfat ... 
/dev/hdb2 /two\040bananas vfat ...

There will be three rows in Kdiskfree. These "rows" has the following mountpoints:

/two
/two\040words
/two\040bananas

Only the first one is mount

(Submitted via bugs.kde.org)
(Called from KBugReport dialog)
Comment 1 George Staikos 2003-02-12 04:21:56 UTC
Subject: kdeutils/kdf

CVS commit by staikos: 

Lazy fix for #45554
expandEscapes() expands \\ to \ and \0nn to octal(nn).  If anyone cares, they
can enhance this as they like.

CCMAIL: 45554-done@bugs.kde.org


  M +31 -3     disklist.cpp   1.28


--- kdeutils/kdf/disklist.cpp  #1.27:1.28
@@ -154,4 +154,32 @@ void DiskList::loadSettings()
 }
 
+
+static QString expandEscapes(const QString& s) {
+QString rc;
+    for (int i = 0; i < s.length(); i++) {
+        if (s[i] == '\\') {
+            i++;
+            switch(s[i]) {
+            case '\\':  // slash \\   
+               rc += '\\';
+               break;
+            case '0': // octal 0nn
+               rc += static_cast<char>(s.mid(i,3).toInt(0, 8));
+               i += 2;
+               break;
+            default:
+               // give up and not process anything else because I'm too lazy
+               // to implement other escapes
+               rc += '\\';
+               rc += s[i];
+               break;
+            }
+        } else {
+            rc += s[i];
+        }
+    }
+return rc;
+}
+
 /***************************************************************************
   * tries to figure out the possibly mounted fs
@@ -177,5 +205,5 @@ QFile f(FSTAB);
         disk = new DiskEntry();// Q_CHECK_PTR(disk);
         disk->setMounted(FALSE);
-        disk->setDeviceName(s.left(s.find(BLANK)) );
+        disk->setDeviceName(expandEscapes(s.left(s.find(BLANK))));
             s=s.remove(0,s.find(BLANK)+1 );
             //  kdDebug() << "    deviceName:    [" << disk->deviceName() << "]" << endl;
@@ -184,5 +212,5 @@ QFile f(FSTAB);
             s=s.remove(0,s.find(BLANK)+1 );
 #endif
-         disk->setMountPoint(s.left(s.find(BLANK)) );
+         disk->setMountPoint(expandEscapes(s.left(s.find(BLANK))));
             s=s.remove(0,s.find(BLANK)+1 );
             //kdDebug() << "    MountPoint:    [" << disk->mountPoint() << "]" << endl;