Merge lp:~mbp/bzr/446033-readdir into lp:bzr/2.0

Proposed by Martin Pool on 2009-10-08
Status: Merged
Approved by: John A Meinel on 2009-10-08
Approved revision: 4681
Merged at revision: not available
Proposed branch: lp:~mbp/bzr/446033-readdir
Merge into: lp:bzr/2.0
Diff against target: 30 lines
2 files modified
NEWS (+3/-0)
bzrlib/_readdir_pyx.pyx (+4/-2)
To merge this branch: bzr merge lp:~mbp/bzr/446033-readdir
Reviewer Review Type Date Requested Status
John A Meinel 2009-10-08 Approve on 2009-10-08
Review via email: mp+13049@code.launchpad.net
To post a comment you must log in.
Martin Pool (mbp) wrote :

I don't think there's any point in readdir returning the names of files that no longer exist.

John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool wrote:
> Martin Pool has proposed merging lp:~mbp/bzr/446033-readdir into lp:bzr/2.0.
>
> Requested reviews:
> bzr-core (bzr-core)
> Related bugs:
> #446033 NoneType has no attribute st_mode in _readdir_pyx.UTF8DirReader.read_dir
> https://bugs.launchpad.net/bugs/446033
>
>
> I don't think there's any point in readdir returning the names of files that no longer exist.
>

I'm fine with this patch, have you tried to do any sort of interactive
testing. Say adding a breakpoint between the readdir and the stat so
that we make sure this is doing what we think it is?

  review: approve
  merge: approve

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrN7SsACgkQJdeBCYSNAAO9+gCgqalC/ns4LdsknJ5KC9JmsOtl
9hoAn0qZ+8L40DYg1Y6/kTAnHF0QotnW
=S2YB
-----END PGP SIGNATURE-----

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 2009-10-07 12:01:20 +0000
3+++ NEWS 2009-10-08 07:10:25 +0000
4@@ -14,6 +14,9 @@
5 Bug Fixes
6 *********
7
8+* Avoid "NoneType has no attribute st_mode" error when files disappear
9+ from a directory while it's being read. (Martin Pool, #446033)
10+
11 * ``bzr add`` in a tree that has files with ``\r`` or ``\n`` in the
12 filename will issue a warning and skip over those files.
13 (Robert Collins, #3918)
14
15=== modified file 'bzrlib/_readdir_pyx.pyx'
16--- bzrlib/_readdir_pyx.pyx 2009-07-27 04:24:36 +0000
17+++ bzrlib/_readdir_pyx.pyx 2009-10-08 07:10:25 +0000
18@@ -343,8 +343,10 @@
19 raise OSError(errno, "lstat: " + strerror(errno),
20 path + "/" + entry.d_name)
21 else:
22- kind = _missing
23- statvalue = None
24+ # the file seems to have disappeared after being
25+ # seen by readdir - perhaps a transient temporary
26+ # file. there's no point returning it.
27+ continue
28 # We append a 5-tuple that can be modified in-place by the C
29 # api:
30 # inode to sort on (to replace with top_path)

Subscribers

People subscribed via source and target branches