[Bug 118123] kdf shows some entries twice

Nicolas Lécureuil neoclust at mandriva.org
Sat Oct 10 22:48:52 UTC 2009


https://bugs.kde.org/show_bug.cgi?id=118123


Nicolas Lécureuil <neoclust at mandriva.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |neoclust at mandriva.org
     Ever Confirmed|0                           |1




--- Comment #9 from Nicolas Lécureuil <neoclust mandriva org>  2009-10-11 00:48:41 ---
i done a patch to handle UUID=, can someone tell me if i can commit it on trunk
?


Index: kdf/disklist.cpp                                                         
===================================================================             
--- kdf/disklist.cpp    (révision 1031780)                                      
+++ kdf/disklist.cpp    (copie de travail)                                      
@@ -28,6 +28,7 @@                                                               

 #include <QtCore/QTextStream>                                                  
 #include <QtCore/QFile>                                                        
+#include <QRegExp>                                                             

 #include <kdebug.h>                                                            
 #include <kglobal.h>                                                           
@@ -216,23 +217,41 @@                                                           
         {                                                                      
             s=t.readLine();                                                    
             s=s.simplified();                                                  
-            if ( (!s.isEmpty() ) && (s.indexOf(Delimiter)!=0) )                
-            {                                                                  
+                                                                               
+           if ( (!s.isEmpty() ) && (s.indexOf(Delimiter)!=0) )                 
+           {                                                                   
                 // not empty or commented out by '#'                           
-                // kDebug() << "GOT: [" << s << "]" ;                          
+                kDebug() << "GOT: [" << s << "]" ;                             
                 disk = new DiskEntry();                                        
                 disk->setMounted(false);                                       
-                disk->setDeviceName(expandEscapes(s.left(s.indexOf(Blank))));  
-                s=s.remove(0,s.indexOf(Blank)+1 );                             
-                //  kDebug() << "    deviceName:    [" << disk->deviceName()
<< "]" ;                                       
+               // We need to remove UUID=                                      
+               bool isUuid = s.contains("UUID=");                              
+               if (isUuid)                                                     
+               {                                                               
+                       QRegExp uuid("UUID=(\\S+)(\\s+)");                      
+                       QString extracted ;                                     
+                       if (uuid.indexIn(s) != -1) {                            
+                               extracted = uuid.cap(1);                        
+                       }                                                       
+                       QString device = QString("/dev/disk/by-uuid/") +
extracted;                                          
+                       QFile file(device);                                     
+                       QString filesym = file.symLinkTarget();                 
+                       disk->setDeviceName(device);                            
+                       s=s.remove(0,s.indexOf(Blank)+1 );                      
+               }                                                               
+               else                                                            
+               {                                                               
+                      
disk->setDeviceName(expandEscapes(s.left(s.indexOf(Blank))));                   
+                       s=s.remove(0,s.indexOf(Blank)+1 );                      
+               }                                                               
+                //kDebug() << "    deviceName:    [" << disk->deviceName() <<
"]" ;                                         
 #ifdef _OS_SOLARIS_                                                            
                 //device to fsck
                 s=s.remove(0,s.indexOf(Blank)+1 );
 #endif
-
-                disk->setMountPoint(expandEscapes(s.left(s.indexOf(Blank))));
-                s=s.remove(0,s.indexOf(Blank)+1 );
-                //kDebug() << "    MountPoint:    [" << disk->mountPoint() <<
"]" ;
+               disk->setMountPoint(expandEscapes(s.left(s.indexOf(Blank))));
+               s=s.remove(0,s.indexOf(Blank)+1 );
+               //kDebug() << "    MountPoint:    [" << disk->mountPoint() <<
"]" ;
                 //kDebug() << "    Icon:          [" << disk->iconName() <<
"]" ;
                 disk->setFsType(s.left(s.indexOf(Blank)) );
                 s=s.remove(0,s.indexOf(Blank)+1 );
@@ -263,7 +282,7 @@

     loadSettings(); //to get the mountCommands

-    //  kDebug() << "DiskList::readFSTAB DONE" ;
+    //kDebug() << "DiskList::readFSTAB DONE" ;
     return 1;
 }

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the pkg-kde-bugs-fwd mailing list