Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Jeff King <>
To: Taylor Blau <>
Subject: Re: [PATCH] dir-iterator: drop unused `DIR_ITERATOR_FOLLOW_SYMLINKS`
Date: Thu, 16 Feb 2023 13:49:55 -0500	[thread overview]
Message-ID: <Y+560+/> (raw)
In-Reply-To: <>

On Thu, Feb 16, 2023 at 01:27:14PM -0500, Taylor Blau wrote:

> The `FOLLOW_SYMLINKS` flag was added to the dir-iterator API in
> fa1da7d2ee (dir-iterator: add flags parameter to dir_iterator_begin,
> 2019-07-10) in order to follow symbolic links while traversing through a
> directory.
> `FOLLOW_SYMLINKS` gained its first caller in ff7ccc8c9a (clone: use
> dir-iterator to avoid explicit dir traversal, 2019-07-10), but it was
> subsequently removed in 6f054f9fb3 (builtin/clone.c: disallow `--local`
> clones with symlinks, 2022-07-28).
> Since then, we've held on to the code for `DIR_ITERATOR_FOLLOW_SYMLINKS`
> in the name of making minimally invasive changes during a security
> embargo.
> In fact, we even changed the dir-iterator API in bffc762f87
> (dir-iterator: prevent top-level symlinks without FOLLOW_SYMLINKS,
> 2023-01-24) without having any non-test callers of that flag.
> Now that we're past those security embargo(s), let's finalize our
> cleanup of the `DIR_ITERATOR_FOLLOW_SYMLINKS` code and remove its
> implementation since there are no remaining callers.

Thanks for following up on this. I think it's an obviously good
direction, and the patch looks sensible. It's hard to grep for
--follow-symlinks or FOLLOW_SYMLINKS to make sure you got everything,
just because there are other unrelated features that use that name. ;)

But I think you got all the relevant spots. The only thing I wondered is
whether we could clean up any of the test setup. Specifically, "dir5"
does not seem to be used in the tests, and everything passes with:

diff --git a/t/ b/t/
index 4ed3136b00..1f3e070ec2 100755
--- a/t/
+++ b/t/
@@ -106,12 +106,6 @@ test_expect_success SYMLINKS 'setup dirs with symlinks' '
 	ln -s d dir4/a/e &&
 	ln -s ../b dir4/a/f &&
-	mkdir -p dir5/a/b &&
-	mkdir -p dir5/a/c &&
-	ln -s ../c dir5/a/b/d &&
-	ln -s ../ dir5/a/b/e &&
-	ln -s ../../ dir5/a/b/f &&
 	ln -s dir4 dir6

But...that is true even before your patch. dir5 is not mentioned in any
of the expected output, even in fa1da7d2ee (dir-iterator: add flags
parameter to dir_iterator_begin, 2019-07-10) where it was added. Was it
just vestigial? Or is it somehow important that it is _not_ in the

I didn't dig, and even if it can be removed, it would probably make
sense to do it separately from your patch anyway.


  reply	other threads:[~2023-02-16 18:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 18:27 [PATCH] dir-iterator: drop unused `DIR_ITERATOR_FOLLOW_SYMLINKS` Taylor Blau
2023-02-16 18:49 ` Jeff King [this message]
2023-02-16 20:03   ` Taylor Blau
2023-02-16 20:05     ` Taylor Blau
2023-02-17  0:16       ` Matheus Tavares Bernardino
2023-02-17  0:40         ` [PATCH 2/1] t0066: drop setup of "dir5" Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y+560+/ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).