Attempt to fix smb mount entry comparison (bnc#710269)
authorMichael Andres <ma@suse.de>
Fri, 5 Aug 2011 13:21:11 +0000 (15:21 +0200)
committerMichael Andres <ma@suse.de>
Fri, 5 Aug 2011 13:21:11 +0000 (15:21 +0200)
zypp/media/Mount.cc

index 3758420..7f8e37f 100644 (file)
@@ -282,7 +282,7 @@ Mount::getEntries(const std::string &mtab)
   {
     mtabs.push_back("/proc/mounts");
     // Also read /etc/mtab if it is a file (on newer sytems
-    // mtab is a symlink to /proc/mounts). 
+    // mtab is a symlink to /proc/mounts).
     // Reason for this is the different representation of
     // mounted loop devices:
     //   /etc/mtab:    /tmp/SLES-11-SP2-MINI-ISO-x86_64-Beta2-DVD.iso on /mnt type iso9660 (ro,loop=/dev/loop0)
@@ -324,6 +324,17 @@ Mount::getEntries(const std::string &mtab)
             ent.mnt_freq,   ent.mnt_passno
           );
 
+         // Attempt quick fix for bnc#710269:
+         // MountEntry is "//dist/install/ on /var/adm/mount/AP_0x00000001 type cifs (ro,relatime,unc=\dist\install,username=,domain=suse.de"
+         // but looking for "Looking for media(cifs<//dist/install>)attached(*/var/adm/mount/AP_0x00000001)"
+         // Kick the trailing '/' in "//dist/install/"
+         // TODO: Check and fix comparison in MediaHandler::checkAttached instead.
+         if ( ( entry.type == "cifs" || entry.type == "smb" )
+              && entry.src.size() > 1  // not for "/"
+              && entry.src[entry.src.size()-1] == '/' )
+         {
+           entry.src.erase( entry.src.size()-1 );
+         }
           entries.push_back(entry);
 
           memset(buf,  0, sizeof(buf));