Commits

Anonymous committed 71cb5be

fix bug 91807: handle race condition stemming from os.path.exist

  • Participants
  • Parent commits 9385208

Comments (0)

Files changed (4)

+2012-02-22  Sebastien Binet  <sebastien.binet@cern.ch>
+
+	* tagging AtlasCommonPolicy-00-00-17
+	* fix bug 91807: handle race condition stemming from os.path.exists
+	* M scripts/abuild-merge-rootmap.py
+	* M scripts/abuild-merge-genconfdb.py
+	* M scripts/abuild-gen-tpcnvdb.py
+
 2012-01-30   Grigori Rybkine <Grigori.Rybkine@cern.ch>
 	* cmt/fragments/optdebug_library_header: Install separate file with library
 	debug symbols

scripts/abuild-gen-tpcnvdb.py

 
     outdir = os.path.dirname(args.output_file)
     if not os.path.exists(outdir):
-        os.makedirs(outdir)
+        try:
+            os.makedirs(outdir)
+        except OSError, err:
+            import errno
+            # "handle" race condition
+            if err.errno == errno.EEXIST:
+                pass
+            else:
+                raise
 
     install_area = []
     _install_area = getattr(args, 'install-area')

scripts/abuild-merge-genconfdb.py

     outdir = os.path.dirname(opts.output_file)
     if not os.path.exists(outdir):
         if outdir:
-            os.makedirs(outdir)
+            try:
+                os.makedirs(outdir)
+            except OSError, err:
+                import errno
+                # "handle" race condition
+                if err.errno == errno.EEXIST:
+                    pass
+                else:
+                    raise
     
     if os.path.exists(opts.output_file):
         os.remove(opts.output_file)

scripts/abuild-merge-rootmap.py

     outdir = os.path.dirname(opts.output_file)
     if not os.path.exists(outdir):
         if outdir:
-            os.makedirs(outdir)
+            try:
+                os.makedirs(outdir)
+            except OSError, err:
+                import errno
+                # "handle" race condition
+                if err.errno == errno.EEXIST:
+                    pass
+                else:
+                    raise
 
     if os.path.exists(opts.output_file):
         os.remove(opts.output_file)