From: "Shawn O. Pearce" <spearce@spearce•org>
To: Linus Torvalds <torvalds@linux-foundation•org>,
"Todd T. Fries" <todd@fries•net>
Cc: git@vger•kernel.org
Subject: Re: git on afs
Date: Fri, 19 Oct 2007 02:06:24 -0400 [thread overview]
Message-ID: <20071019060624.GK14735@spearce.org> (raw)
In-Reply-To: <alpine.LFD.0.999.0710181543380.26902@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation•org> wrote:
> On Thu, 18 Oct 2007, Todd T. Fries wrote:
> >
> > 2) git presumes that DTYPE(de) != DT_DIR .. means the dirent is not a dir
> > this is not true for afs
>
> That's a major bug, and has nothing to do with AFS. Oops.
>
> If you look just a bit lower, you'll see that just a few lines down, git
> handles DT_UNKNOWN correctly, and just does a lstat() on it as required. I
> guess that logic should be moved up, or alternatively the exclude logic
> should be moved down.
>
> Your patch looks ok, but at the same time, I don't think it's really the
> right thing to do, since it now does that lstat() twice.
What about this instead? It avoids the double lstat() of Todd's
original patch but seems like it would fix the issue here. Or did
I misunderstand the problem?
--8>--
From f290fc5f6ec5042b7c0393a300e4d3738b9090b8 Mon Sep 17 00:00:00 2001
From: Shawn O. Pearce <spearce@spearce•org>
Date: Fri, 19 Oct 2007 02:03:55 -0400
Subject: [PATCH] Correctly scan directories when DTYPE(de) is unknown
We have been presuming that if DTYPE(de) != DT_DIR than the item we
obtained from readdir() isn't a directory. This is actually not
true, it could still be a directory, especially if the underlying
system we were compiled for doesn't have the d_type member of struct
dirent and we have enabled our compatability definition of DTYPE(de)
to always be DT_UNKNOWN.
If DTYPE(de) == DT_UNKNOWN we need to fall through and perform an
actual lstat() call to determine what the type of this item is so
we know how to proceed with our scanning.
Reported by Todd T. Fries while trying to use Git on AFS, which
apparently has DTYPE(de) != DT_DIR for directories.
Signed-off-by: Shawn O. Pearce <spearce@spearce•org>
---
dir.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dir.c b/dir.c
index eb6c3ab..d2597ff 100644
--- a/dir.c
+++ b/dir.c
@@ -487,9 +487,10 @@ static int read_directory_recursive(struct dir_struct *dir, const char *path, co
&& in_pathspec(fullname, baselen + len, simplify))
dir_add_ignored(dir, fullname, baselen + len);
if (exclude != dir->show_ignored) {
- if (!dir->show_ignored || DTYPE(de) != DT_DIR) {
+ if (!dir->show_ignored)
+ continue;
+ else if (DTYPE(de) != DT_DIR && DTYPE(de) != DT_UNKNOWN)
continue;
- }
}
switch (DTYPE(de)) {
--
1.5.3.4.1249.g895be
--
Shawn.
next prev parent reply other threads:[~2007-10-19 6:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-18 20:31 git on afs Todd T. Fries
2007-10-18 21:28 ` Brandon Casey
2007-10-18 21:57 ` Brandon Casey
2007-10-18 22:47 ` Linus Torvalds
2007-10-19 6:06 ` Shawn O. Pearce [this message]
2007-10-19 12:19 ` Todd T. Fries
2007-10-19 17:59 ` Linus Torvalds
2007-10-19 19:06 ` Linus Torvalds
2007-10-19 5:48 ` Shawn O. Pearce
2007-10-19 12:42 ` Todd T. Fries
2007-10-19 20:19 ` Daniel Barkalow
2007-10-20 5:29 ` Shawn O. Pearce
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071019060624.GK14735@spearce.org \
--to=spearce@spearce$(echo .)org \
--cc=git@vger$(echo .)kernel.org \
--cc=todd@fries$(echo .)net \
--cc=torvalds@linux-foundation$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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