From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161916AbbKTC5y (ORCPT ); Thu, 19 Nov 2015 21:57:54 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:44047 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161896AbbKTC5v (ORCPT ); Thu, 19 Nov 2015 21:57:51 -0500 Date: Fri, 20 Nov 2015 02:57:49 +0000 From: Al Viro To: Linus Torvalds Cc: linux-fsdevel , Linux Kernel Mailing List , LSM List , Miklos Szeredi , David Howells Subject: Re: [RFC] readlink()-related oddities Message-ID: <20151120025749.GJ22011@ZenIV.linux.org.uk> References: <20151119232635.GI22011@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 19, 2015 at 06:13:53PM -0800, Linus Torvalds wrote: > > 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. How would those tools know that this particular pathname _is_ a magical symlink? Sure, if you see a symlink with body that starts with % or #, you could figure out that it's not a regular one and go parse the body, but for stat(2) it looks like a directory. Do those tools call readlink() on every directory they spot on AFS volume? David? And what's the story with magical ->open() for those? How could one get to ->open() on those sucker and avoid triggering the automount instead?