Patchwork [STABLE,RESEND] fileset: suppress EACCES while reading arbitrary paths via filectx API

login
register
mail settings
Submitter Yuya Nishihara
Date July 31, 2018, 12:22 p.m.
Message ID <a4c9d951bfa7c55ed23f.1533039750@mimosa>
Download mbox | patch
Permalink /patch/32979/
State Accepted
Headers show

Comments

Yuya Nishihara - July 31, 2018, 12:22 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1532849151 -32400
#      Sun Jul 29 16:25:51 2018 +0900
# Branch stable
# Node ID a4c9d951bfa7c55ed23f481e066a21fd51f63946
# Parent  545a3e6650cd8f7e19c0f0256082837a33bea029
fileset: suppress EACCES while reading arbitrary paths via filectx API

On Windows, EACCES is raised in place of EISDIR. This patch simply adds
EACCES to the list of errors to be ignored since I think it's okay for
filesets to treat inaccessible working-copy files as not existing.
Augie Fackler - July 31, 2018, 1:54 p.m.
> On Jul 31, 2018, at 08:22, Yuya Nishihara <yuya@tcha.org> wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1532849151 -32400
> #      Sun Jul 29 16:25:51 2018 +0900
> # Branch stable
> # Node ID a4c9d951bfa7c55ed23f481e066a21fd51f63946
> # Parent  545a3e6650cd8f7e19c0f0256082837a33bea029
> fileset: suppress EACCES while reading arbitrary paths via filectx API

queued, thanks

Patch

diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -592,7 +592,9 @@  class matchctx(object):
                 try:
                     return predfn(fctx)
                 except (IOError, OSError) as e:
-                    if e.errno in (errno.ENOENT, errno.ENOTDIR, errno.EISDIR):
+                    # open()-ing a directory fails with EACCES on Windows
+                    if e.errno in (errno.ENOENT, errno.EACCES, errno.ENOTDIR,
+                                   errno.EISDIR):
                         return False
                     raise
         else: