[PATCH RFC] check-code: add rule for os.remove/unlink and friends

Matt Mackall mpm at selenic.com
Tue Oct 9 12:01:43 CDT 2012


On Tue, 2012-10-09 at 11:05 +0200, Adrian Buehlmann wrote:
> On 2012-10-08 16:26, Idan Kamara wrote:
> > # HG changeset patch
> > # User Idan Kamara <idankk86 at gmail.com>
> > # Date 1349706107 -7200
> > # Branch stable
> > # Node ID 0561e2d7dd3770ddcd2a0f27e009b767ddbea5f7
> > # Parent  6cd5ee6df3c463d2025cf17158c4ad8ca484d00f
> > check-code: add rule for os.remove/unlink and friends
> > 
> > I seem to remember util.unlink/unlinkpaths were born because of issues
> > we had on Windows. Should we enforce this on the entire codebase?
> 
> [..]
> > If so, I'll send a patch before this one that fixes all the errors.
> 
> I have been thinking about this a bit.
> 
> While there might be some value in reviewing all the file accesses, I
> currently have the impression that, for example, boldly enforcing
> util.unlink everywhere could be problematic or at least a bit pointless
> at best for some cases.

We will eventually wrap all file operations with VFS operations as part
of WindowsUTF8Plan and add corresponding check-code tests so I think
we'll eventually arrive here anyway. If we have a vfs.unlink, it'll
probably be the try-harder-on-failure variant.

Related thought: having a test in 'hg debugfs' that tries to trigger
virus scanner misbehavior might be helpful for troubleshooting. A
similar test could be added for hardlinks.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list