Merge lp:~jameinel/bzr/readdir_leaks_583486 into lp:bzr/2.0

Proposed by John A Meinel
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: 4750
Proposed branch: lp:~jameinel/bzr/readdir_leaks_583486
Merge into: lp:bzr/2.0
Diff against target: 53 lines (+15/-7)
2 files modified
NEWS (+11/-6)
bzrlib/_readdir_pyx.pyx (+4/-1)
To merge this branch: bzr merge lp:~jameinel/bzr/readdir_leaks_583486
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+25723@code.launchpad.net

Commit message

Close the current directory descriptor when trying to iterate a file (bug #583486)

Description of the change

A single-line fix to make sure we close the current dir descriptor when the path we are given is a file and not a directory.

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

Approved by Robert on IRC, submitted to PQM by hand

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2010-04-29 03:25:12 +0000
3+++ NEWS 2010-05-20 21:28:30 +0000
4@@ -29,18 +29,23 @@
5 * Reduce peak memory by one copy of compressed text.
6 (John Arbash Meinel, #566940)
7
8-
9-* Selftest with versions of subunit that support ``stopTestRun`` will no longer
10- error. This error was caused by 2.0 not being updated when upstream
11- python merged the end of run patch, which chose ``stopTestRun`` rather than
12- ``done``. (Robert Collins, #571437)
13-
14 * Repositories accessed via a smart server now reject being stacked on a
15 repository in an incompatible format, as is the case when accessing them
16 via other methods. This was causing fetches from those repositories via
17 a smart server (e.g. using ``bzr branch``) to receive invalid data.
18 (Andrew Bennetts, #562380)
19
20+* Selftest with versions of subunit that support ``stopTestRun`` will no longer
21+ error. This error was caused by 2.0 not being updated when upstream
22+ python merged the end of run patch, which chose ``stopTestRun`` rather than
23+ ``done``. (Robert Collins, #571437)
24+
25+* When passing a file to ``UTF8DirReader`` make sure to close the current
26+ directory file handle after the chdir fails. Otherwise when passing many
27+ filenames into a command line ``bzr status`` we would leak descriptors.
28+ (John Arbash Meinel, #583486)
29+
30+
31 bzr 2.0.5
32 #########
33
34
35=== modified file 'bzrlib/_readdir_pyx.pyx'
36--- bzrlib/_readdir_pyx.pyx 2009-12-23 02:19:04 +0000
37+++ bzrlib/_readdir_pyx.pyx 2010-05-20 21:28:30 +0000
38@@ -1,4 +1,4 @@
39-# Copyright (C) 2006, 2008, 2009 Canonical Ltd
40+# Copyright (C) 2006, 2008, 2009, 2010 Canonical Ltd
41 #
42 # This program is free software; you can redistribute it and/or modify
43 # it under the terms of the GNU General Public License as published by
44@@ -307,6 +307,9 @@
45 if orig_dir_fd == -1:
46 raise_os_error(errno, "open: ", ".")
47 if -1 == chdir(path):
48+ # Ignore the return value, because we are already raising an
49+ # exception
50+ close(orig_dir_fd)
51 raise_os_error(errno, "chdir: ", path)
52 else:
53 orig_dir_fd = -1

Subscribers

People subscribed via source and target branches