Re: PATCH:failed to unlink /var/lib/rpm/__db.xxx

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

 



I'm sorry that indent is brekoen
so I attached patch.

Hiroshi Hara wrote:
> hi, anaconda developpers
>
> I always found the following message in anaconda.log after
> FC6 updgrade installation.
> -------------
> failed to unlink /var/lib/rpm/__db.000
> -------------
> and I checked anaconda source and it's no problem,
> but It looks not good.
> How about checking __db.xxx exists or not before unlink?
>
>
> --- anaconda_org/yuminstall.py 2006-12-14 01:00:19.000000000 +0900
> +++ anaconda/yuminstall.py 2007-01-06 12:26:28.000000000 +0900
> @@ -780,10 +780,11 @@ class YumBackend(AnacondaBackend):
> if anaconda.id.getUpgrade():
> # FIXME: make sure that the rpmdb doesn't have stale locks :/
> for rpmfile in ["__db.000", "__db.001", "__db.002", "__db.003"]:
> - try:
> - os.unlink("%s/var/lib/rpm/%s" %(anaconda.rootPath, rpmfile))
> - except:
> - log.error("failed to unlink /var/lib/rpm/%s" %(rpmfile,))
> + if os.access("%s/var/lib/rpm/%s" %(anaconda.rootPath, rpmfile), os.F_OK):
> + try:
> + os.unlink("%s/var/lib/rpm/%s" %(anaconda.rootPath, rpmfile))
> + except:
> + log.error("failed to unlink /var/lib/rpm/%s" %(rpmfile,))
>
> iutil.writeRpmPlatform()
> self.ayum = AnacondaYum(anaconda)
> @@ -1278,11 +1279,12 @@ class YumBackend(AnacondaBackend):
> type = "yesno")
> if rc == 0:
> for rpmfile in ["__db.000", "__db.001", "__db.002", "__db.003"]:
> - try:
> - os.unlink("%s/var/lib/rpm/%s" %(anaconda.rootPath, rpmfile))
> - except:
> - log.info("error %s removing file: /var/lib/rpm/%s" %(e,rpmfile))
> - pass
> + if os.access("%s/var/lib/rpm/%s" %(anaconda.rootPath, rpmfile), os.F_OK):
> + try:
> + os.unlink("%s/var/lib/rpm/%s" %(anaconda.rootPath, rpmfile))
> + except:
> + log.info("error %s removing file: /var/lib/rpm/%s" %(e,rpmfile))
> + pass
> sys.exit(0)
>
> def doInstall(self, anaconda):
>
>
>
>
>   

diff -uNrp anaconda_org/yuminstall.py anaconda/yuminstall.py
--- anaconda_org/yuminstall.py	2006-12-14 01:00:19.000000000 +0900
+++ anaconda/yuminstall.py	2007-01-06 12:26:28.000000000 +0900
@@ -780,10 +780,11 @@ class YumBackend(AnacondaBackend):
         if anaconda.id.getUpgrade():
            # FIXME: make sure that the rpmdb doesn't have stale locks :/
             for rpmfile in ["__db.000", "__db.001", "__db.002", "__db.003"]:
-                try:
-                    os.unlink("%s/var/lib/rpm/%s" %(anaconda.rootPath, rpmfile))
-                except:
-                    log.error("failed to unlink /var/lib/rpm/%s" %(rpmfile,))
+                if os.access("%s/var/lib/rpm/%s" %(anaconda.rootPath, rpmfile), os.F_OK):
+                    try:
+                        os.unlink("%s/var/lib/rpm/%s" %(anaconda.rootPath, rpmfile))
+                    except:
+                        log.error("failed to unlink /var/lib/rpm/%s" %(rpmfile,))
 
         iutil.writeRpmPlatform()
         self.ayum = AnacondaYum(anaconda)
@@ -1278,11 +1279,12 @@ class YumBackend(AnacondaBackend):
                                     type = "yesno")
             if rc == 0:
                 for rpmfile in ["__db.000", "__db.001", "__db.002", "__db.003"]:
-                    try:
-                        os.unlink("%s/var/lib/rpm/%s" %(anaconda.rootPath, rpmfile))
-                    except:
-                        log.info("error %s removing file: /var/lib/rpm/%s" %(e,rpmfile))
-                        pass
+                    if os.access("%s/var/lib/rpm/%s" %(anaconda.rootPath, rpmfile), os.F_OK):
+                        try:
+                            os.unlink("%s/var/lib/rpm/%s" %(anaconda.rootPath, rpmfile))
+                        except:
+                            log.info("error %s removing file: /var/lib/rpm/%s" %(e,rpmfile))
+                            pass
                 sys.exit(0)
 
     def doInstall(self, anaconda):

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux