Messages in this thread | | | Date | Tue, 14 Apr 1998 23:09:21 -0400 (EDT) | From | "C. Scott Ananian" <> | Subject | Re: PATCH: smart symlink loop detection. |
| |
Greetings from across the river, Adam. ;-)
On Tue, 14 Apr 1998 "Adam D. Bradley" <artdodge@cs.bu.edu> wrote:
> The problem isn't finding the loops - it's in resolving each of the > symbolic names to a real pathname. The current system is inherently > recursive in the way it descends through each layer of the directory > tree. [...] If it can be flattened and made iterative, then loop detection is > simple. Doing it well and correctly with the current setup, however, > would be hairy.
Adam's summarized the situation well.
> Keep your eyes peeled for another patch from Scott (I e-mailed him > this AM with some comments about the current code, and within 20 > minutes he had e-mailed me back saying he had a working patch running > on his system... I may code my own version for kicks, but you'll > probably see one from him on the list much sooner ;->
Well, here's the problem, as pointed out to me this afternoon by Mr. Linus Torvalds: symlink traversal is inherently recursive. We can rewrite the tail recursion as iteration (which my morning patch did), but symlinks in the middle of paths require mid-recursion. You need to keep a stack around *somewhere* to handle this.
Rewriting the traversal code in this manner will be a much bigger deal than removing the tail-recursion was. It may take a wee bit longer than 20 minutes. ;-)
In the meantime, I plan on 1) writing a patch to fix documentation issues uncovered investigating symlink traversal, 2) fixing my morning patch to limit mid-recursion depth after we've eliminated the tail recursion, creating a *safe* partial-solution patch, and 3) thinking hard about the Right Way to create a final fix. I agree with Linus that the Right Thing may have to wait until 2.3.x, but if the no-tail-recursion partial fix proves useful, perhaps that will be included in 2.2.x. --Scott @ @ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-oOO-(_)-OOo-=-=-=-=-= C. Scott Ananian: cananian@lcs.mit.edu / Declare the Truth boldly and Laboratory for Computer Science/Crypto / without hindrance. Massachusetts Institute of Technology /META-PARRESIAS AKOLUTOS:Acts 28:31 -.-. .-.. .. ..-. ..-. --- .-. -.. ... -.-. --- - - .- -. .- -. .. .- -. PGP key available via finger and from http://www.pdos.lcs.mit.edu/~cananian
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
| |