GNU bug report logs - #54338
enhancement (documentation): explain permission tests in "test"

Previous Next

Package: coreutils;

Reported by: "Ulrich Windl" <Ulrich.Windl <at> rz.uni-regensburg.de>

Date: Fri, 11 Mar 2022 10:43:01 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54338 in the body.
You can then email your comments to 54338 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#54338; Package coreutils. (Fri, 11 Mar 2022 10:43:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Ulrich Windl" <Ulrich.Windl <at> rz.uni-regensburg.de>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 11 Mar 2022 10:43:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Ulrich Windl" <Ulrich.Windl <at> rz.uni-regensburg.de>
To: <bug-coreutils <at> gnu.org>
Subject: enhancement (documentation): explain permission tests in
 "test"
Date: Fri, 11 Mar 2022 11:42:13 +0100
I noticed that "test -r file" returns success when called as root for a file
with these permissions:
"--w-------" (see also https://stackoverflow.com/q/71435657/6607497)

The documentation simply states:
‘-r FILE’
     True if FILE exists and read permission is granted.

Doing an strace it seems stat() is used to check the permissions (well, what
about ACLs, just in case?)

I think there should be a better explanatiomn how the permission tests work,
especially when called as "root".

(Report based on coreutils-8.32-150300.3.5.1 from openSUSE Leap 15.3)





Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Fri, 11 Mar 2022 12:52:02 GMT) Full text and rfc822 format available.

Notification sent to "Ulrich Windl" <Ulrich.Windl <at> rz.uni-regensburg.de>:
bug acknowledged by developer. (Fri, 11 Mar 2022 12:52:02 GMT) Full text and rfc822 format available.

Message #10 received at 54338-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Ulrich Windl <Ulrich.Windl <at> rz.uni-regensburg.de>,
 54338-done <at> debbugs.gnu.org
Subject: Re: bug#54338: enhancement (documentation): explain permission tests
 in "test"
Date: Fri, 11 Mar 2022 12:51:12 +0000
[Message part 1 (text/plain, inline)]
On 11/03/2022 10:42, Ulrich Windl wrote:
> I noticed that "test -r file" returns success when called as root for a file
> with these permissions:
> "--w-------" (see also https://stackoverflow.com/q/71435657/6607497)
> 
> The documentation simply states:
> ‘-r FILE’
>       True if FILE exists and read permission is granted.
> 
> Doing an strace it seems stat() is used to check the permissions (well, what
> about ACLs, just in case?)
> 
> I think there should be a better explanatiomn how the permission tests work,
> especially when called as "root".
> 
> (Report based on coreutils-8.32-150300.3.5.1 from openSUSE Leap 15.3)

I agree the current docs are ambiguous.
I'll apply the attached later to address this.

thanks,
Pádraig
[test-access.diff (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 09 Apr 2022 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 75 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.