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

login
register
mail settings
Submitter Yuya Nishihara
Date July 29, 2018, 8:01 a.m.
Message ID <7d91a50276dfe66c6e85.1532851268@mimosa>
Download mbox | patch
Permalink /patch/32964/
State Superseded
Headers show

Comments

Yuya Nishihara - July 29, 2018, 8:01 a.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 7d91a50276dfe66c6e85892934403b6e803e548f
# Parent  39885c84a7c1fa65637d281188c51de06d9c0997
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.

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: