[PATCH] pathutil: resurrect comment about path auditing order

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] pathutil: resurrect comment about path auditing order

Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara <[hidden email]>
# Date 1580529452 -32400
#      Sat Feb 01 12:57:32 2020 +0900
# Node ID c30168a6a58660a119379c36e83c41ad7535d129
# Parent  6b7aef44274b457847d912cf1eada1dd8396f650
pathutil: resurrect comment about path auditing order

It was removed at 51c86c6167c1, but expensive symlink traversal isn't the
only reason we should walk path components from the root.

diff --git a/mercurial/pathutil.py b/mercurial/pathutil.py
--- a/mercurial/pathutil.py
+++ b/mercurial/pathutil.py
@@ -100,8 +100,10 @@ class pathauditor(object):
         parts.pop()
         normparts.pop()
         # It's important that we check the path parts starting from the root.
-        # This means we won't accidentally traverse a symlink into some other
-        # filesystem (which is potentially expensive to access).
+        # We don't want to add "foo/bar/baz" to auditeddir before checking if
+        # there's a "foo/.hg" directory. This also means we won't accidentally
+        # traverse a symlink into some other filesystem (which is potentially
+        # expensive to access).
         for i in range(len(parts)):
             prefix = pycompat.ossep.join(parts[: i + 1])
             normprefix = pycompat.ossep.join(normparts[: i + 1])
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] pathutil: resurrect comment about path auditing order

Augie Fackler-2
queued, thanks

> On Feb 1, 2020, at 00:29, Yuya Nishihara <[hidden email]> wrote:
>
> # HG changeset patch
> # User Yuya Nishihara <[hidden email]>
> # Date 1580529452 -32400
> #      Sat Feb 01 12:57:32 2020 +0900
> # Node ID c30168a6a58660a119379c36e83c41ad7535d129
> # Parent  6b7aef44274b457847d912cf1eada1dd8396f650
> pathutil: resurrect comment about path auditing order
>
> It was removed at 51c86c6167c1, but expensive symlink traversal isn't the
> only reason we should walk path components from the root.
>
> diff --git a/mercurial/pathutil.py b/mercurial/pathutil.py
> --- a/mercurial/pathutil.py
> +++ b/mercurial/pathutil.py
> @@ -100,8 +100,10 @@ class pathauditor(object):
>         parts.pop()
>         normparts.pop()
>         # It's important that we check the path parts starting from the root.
> -        # This means we won't accidentally traverse a symlink into some other
> -        # filesystem (which is potentially expensive to access).
> +        # We don't want to add "foo/bar/baz" to auditeddir before checking if
> +        # there's a "foo/.hg" directory. This also means we won't accidentally
> +        # traverse a symlink into some other filesystem (which is potentially
> +        # expensive to access).
>         for i in range(len(parts)):
>             prefix = pycompat.ossep.join(parts[: i + 1])
>             normprefix = pycompat.ossep.join(normparts[: i + 1])
> _______________________________________________
> Mercurial-devel mailing list
> [hidden email]
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel