Rev 5244: Bring in the UTF8DirReader changes. in http://bazaar.launchpad.net/~jameinel/bzr/readdir_leaks_583486

John Arbash Meinel john at arbash-meinel.com
Thu May 20 22:57:07 BST 2010


At http://bazaar.launchpad.net/~jameinel/bzr/readdir_leaks_583486

------------------------------------------------------------
revno: 5244 [merge]
revision-id: john at arbash-meinel.com-20100520215644-4jppqrzkalnu9t4d
parent: pqm at pqm.ubuntu.com-20100520092748-oa7knubtqio8l2rc
parent: john at arbash-meinel.com-20100520212347-y6onphkgkspziji2
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: readdir_leaks_583486
timestamp: Thu 2010-05-20 16:56:44 -0500
message:
  Bring in the UTF8DirReader changes.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/_readdir_pyx.pyx        readdir.pyx-20060609152855-rm6v321vuaqyh9tu-1
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2010-05-20 09:27:48 +0000
+++ b/NEWS	2010-05-20 21:56:44 +0000
@@ -1132,6 +1132,12 @@
   python merged the end of run patch, which chose ``stopTestRun`` rather than
   ``done``. (Robert Collins, #571437)
 
+* When passing a file to ``UTF8DirReader`` make sure to close the current
+  directory file handle after the chdir fails. Otherwise when passing many
+  filenames into a command line ``bzr status`` we would leak descriptors.
+  (John Arbash Meinel, #583486)
+
+
 bzr 2.0.5
 #########
 

=== modified file 'bzrlib/_readdir_pyx.pyx'
--- a/bzrlib/_readdir_pyx.pyx	2010-02-17 17:11:16 +0000
+++ b/bzrlib/_readdir_pyx.pyx	2010-05-20 21:56:44 +0000
@@ -307,6 +307,9 @@
         if orig_dir_fd == -1:
             raise_os_error(errno, "open: ", ".")
         if -1 == chdir(path):
+            # Ignore the return value, because we are already raising an
+            # exception
+            close(orig_dir_fd)
             raise_os_error(errno, "chdir: ", path)
     else:
         orig_dir_fd = -1



More information about the bazaar-commits mailing list