Re: [RFC] readlink()-related oddities
From: Linus Torvalds
Date: Thu Nov 19 2015 - 21:13:59 EST
On Thu, Nov 19, 2015 at 3:26 PM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> 1) atime updates, according to POSIX, should happen in case of success.
> For example, giving readlink(2) an unmapped buffer should _not_ touch
> atime. Neither should calling readlink(2) in case if ->readlink() method
> returns e.g. -EIO or -ENOMEM. We do atime update in those cases. Looks
> like a bug and unless there's a good reason to keep that behaviour, I'd
> rather have it do what POSIX says.
I really don't think anybody cares, but I also don't think anybody
cares about the current behavior, so we can certainly fix it to match
POSIX wording, and just move it a bit lower after checking the return
value from ->realink().
> 3) normally, readlink(2) fails for non-symlinks. Moreover, according to
> POSIX it should do so (with -EINVAL).
I don't think POSIX is necessarily relevant here.
We have had magic file behavior outside the scope of POSIX before, and
we will have it in the future. It makes perfect sense to use
readlink() for management tools for automounting, even if the normal
oepration is to treat the thing as a directory.
Not everything is within the domain of POSIX.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/