Re: UTF-8 practically vs. theoretically in the VFS API (was: Re: JFS default behavior)

Jamie Lokier
2004-02-17T21:22:47Z

Linus Torvalds wrote:
> > 1. Eliminate "." and ".." components, leaving only leading ".."s.
>
> Who does this anyway? It's wrong. It gives the wrong answer if there was a
> symlink somewhere.

It's wrong for GCC, but correct for HTML/XLink relative path
resolution.

> > O_NODOTDOT won't protect against that.
>
> Ok, so explain why? O_NODOTDOT will certainly guarantee that it stays
> inside "/var/public/files", since it has no way to escape (modulo
> symlinks/mounts, of course).

Oh, I meant to say "will" but my mailer must have used the wrong
character encoding. :)

> O_NOMOUNT may actually become a good idea.

Right now, you can avoid crossing filesystems by calling lstat()
_except_ that it doesn't detect a bind mount. Among other things,
this makes it difficult to know for sure when there is only one path
to a file, because n_link==1 doesn't mean that any more. O_NOMOUNT
might be useful as a way to detect when you're crossing a bind mount.

-- Jamie