From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jamie Lokier Subject: Re: euidaccess() as syscall Date: Fri, 2 May 2008 18:33:43 +0100 Message-ID: <20080502173343.GB1240@shareable.org> References: <8499950a0805020959g5114c9c9wa3803a9d1eab3147@mail.gmail.com> <20080502170603.GJ14976@parisc-linux.org> <8499950a0805021013g76261641r847ab18e648693a1@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Matthew Wilcox , linux-fsdevel@vger.kernel.org To: Oleg Verych Return-path: Received: from mail2.shareable.org ([80.68.89.115]:58847 "EHLO mail2.shareable.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1765129AbYEBRdu (ORCPT ); Fri, 2 May 2008 13:33:50 -0400 Content-Disposition: inline In-Reply-To: <8499950a0805021013g76261641r847ab18e648693a1@mail.gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Oleg Verych wrote: > open() will change timestamp. `bash` and `dash` have very broken workarounds of > access() in `test` due to euid requirements. I.e. read-only fs for > root or various > selinux-like restrictions are not shown unless open() is used. > > So, it's better just to use stat64(), right? The whole point of access() originally seems to be so you can check the real-user permissions, as there is no reliable way to do that otherwise. euidaccess() was added much later. As noted, you can use open() instead. This is one reason why open() shouldn't change the timestamps: only reading and writing should do that. Windows has an additional open flag OF_EXIST, which lets you call the Windows equivalent of open() and just check if you can, with the specified open flags, without returning a handle. Perhaps Linux could copy that idea with an O_ACCESS flag to open()? -- Jamie