From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f50.google.com ([209.85.215.50]:32780 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750945AbdAPPxP (ORCPT ); Mon, 16 Jan 2017 10:53:15 -0500 Received: by mail-lf0-f50.google.com with SMTP id k86so86611454lfi.0 for ; Mon, 16 Jan 2017 07:53:14 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <18a5b416-ad6a-e679-d993-af7ffa0dcc10@redhat.com> References: <18a5b416-ad6a-e679-d993-af7ffa0dcc10@redhat.com> From: Miklos Szeredi Date: Mon, 16 Jan 2017 16:53:13 +0100 Message-ID: Subject: Re: utimensat EACCES vs. EPERM in 4.8+ To: Jan Stancek Cc: linux-fsdevel , viro , guaneryu@gmail.com, Cyril Hrubis , ltp@lists.linux.it, "Michael Kerrisk (man-pages)" Content-Type: text/plain; charset=UTF-8 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, Jan 16, 2017 at 4:46 PM, Jan Stancek wrote: > Hi, > > we seem to have a conflict between kernel and man pages. > From utimensat man page: > > EACCES times is NULL, or both tv_nsec values are UTIME_NOW, and either: > * the effective user ID of the caller does not match the owner of the > file, the caller does not have write access to the file, and the > caller is not privileged (Linux: does not have either the CAP_FOWNER > or the CAP_DAC_OVERRIDE capability); or, > * the file is marked immutable (see chattr(1)). > > But following 2 commits gradually replaced EACCES with EPERM. > > commit 337684a1746f93ae107e05d90977b070bb7e39d8 > Author: Eryu Guan > Date: Tue Aug 2 19:58:28 2016 +0800 > fs: return EPERM on immutable inode I agree with Eryu that consistently returning EPERM for immutable is better than sometimes returning EACCESS and sometimes EPERM. So I think the man page should be fixed. > commit f2b20f6ee842313a0d681dbbf7f87b70291a6a3b > Author: Miklos Szeredi > Date: Fri Sep 16 12:44:20 2016 +0200 > vfs: move permission checking into notify_change() for utimes(NULL) Actually this later commit didn't change the error value, it just moved code around. Thanks, Miklos