Your message dated Sun, 7 Apr 2024 11:44:38 +0200
with message-id <[email protected]>
and subject line Re: Bug#431333: bash ignores ACLs
has caused the Debian Bug report #431333,
regarding bash ignores ACLs
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
431333: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=431333
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: bash
Version: 3.1dfsg-8
Severity: normal

bash's builtin test function does not honor ACLs.

I have a test file which my user can read, but only because of the
ACLs:

mitch@yggdrasil:~/Mail$ ls -l testdatei 
-rw-r-----+ 1 root root 0 2007-07-01 12:51 testdatei
mitch@yggdrasil:~/Mail$ getfacl testdatei 
# file: testdatei
# owner: root
# group: root
user::rw-
user:mitch:r--
group::---
mask::r--
other::---

But bash tells me that the file is not readable by me:

mitch@yggdrasil:~/Mail$ echo $SHELL
/bin/bash
mitch@yggdrasil:~/Mail$ [ -r testdatei ] && echo readable || echo not readable
not readable

The external test command gives the correct result:

mitch@yggdrasil:~/Mail$ /usr/bin/test -r testdatei && echo readable || echo not 
readable
readable

strace shows that bash calls stat64() while /usr/bin/test calls access():

mitch@yggdrasil:~/Mail$ strace -e access,stat64 bash -c '[ -r testdatei ]'
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
stat64("/home/mitch/Mail", {st_mode=S_IFDIR|0750, st_size=12288, ...}) = 0
stat64(".", {st_mode=S_IFDIR|0750, st_size=12288, ...}) = 0
stat64(".", {st_mode=S_IFDIR|0750, st_size=12288, ...}) = 0
stat64("/usr/local/bin/bash", 0xbfdc4018) = -1 ENOENT (No such file or 
directory)
stat64("/usr/bin/bash", 0xbfdc4018)     = -1 ENOENT (No such file or directory)
stat64("/bin/bash", {st_mode=S_IFREG|0755, st_size=677184, ...}) = 0
stat64("/bin/bash", {st_mode=S_IFREG|0755, st_size=677184, ...}) = 0
stat64("testdatei", {st_mode=S_IFREG|0640, st_size=0, ...}) = 0
Process 29804 detached


mitch@yggdrasil:~/Mail$ strace -e access,stat64 /usr/bin/test -r testdatei 
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
access("testdatei", R_OK)               = 0
Process 29727 detached


The documentation of the builtin test does not mention file
permissions, but explicitly states "if file is readable by you".  As
the file is indeed readable by me, this looks like a bug to me.

mitch@yggdrasil:~/Mail$ help test | grep -- -r
        -r FILE        True if file is readable by you.


Perhaps bash should use access() instead of stat64().

This might be related to bug #387408.

References:
de.comp.os.unix.linux.misc <[email protected]> et 
seq.

Regards,
Christian

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)

Versions of packages bash depends on:
ii  base-files                  4            Debian base system miscellaneous f
ii  debianutils                 2.17         Miscellaneous utilities specific t
ii  libc6                       2.3.6.ds1-13 GNU C Library: Shared libraries
ii  libncurses5                 5.5-5        Shared libraries for terminal hand

bash recommends no packages.

-- no debconf information

-- 
....Christian.Garbs.....................................http://www.cgarbs.de

Wer sich im Gefängnis nicht benimmt, fliegt raus.

Attachment: signature.asc
Description: Digital signature


--- End Message ---
--- Begin Message ---
Version: 5.0-6

On Sun, 1 Jul 2007 20:58:26 +0200 Christian Garbs <[email protected]> wrote:
bash's builtin test function does not honor ACLs.

I have a test file which my user can read, but only because of the
ACLs:

mitch@yggdrasil:~/Mail$ ls -l testdatei -rw-r-----+ 1 root root 0 2007-07-01 12:51 testdatei mitch@yggdrasil:~/Mail$ getfacl testdatei # file: testdatei
# owner: root
# group: root
user::rw-
user:mitch:r--
group::---
mask::r--
other::---

But bash tells me that the file is not readable by me:

mitch@yggdrasil:~/Mail$ [ -r testdatei ] && echo readable || echo not readable
not readable

Hi,

this issue does not seem to affect version 5.0-6 and later of bash.

    $ sudo touch /tmp/abc
    $ sudo chmod u=rw,go= /tmp/abc
    $ ls -l /tmp/abc
    -rw------- 1 root root 0 apr  7 11:38 /tmp/abc
    $ test -r /tmp/abc; echo $?
    1
    $ sudo setfacl -m u:$USER:r /tmp/abc
    $ ls -l /tmp/abc
    -rw-r-----+ 1 root root 0 apr  7 11:38 /tmp/abc
    $ getfacl /tmp/abc
    getfacl: Removing leading '/' from absolute path names
    # file: tmp/abc
    # owner: root
    # group: root
    user::rw-
    user:gioele:r--
    group::---
    mask::r--
    other::---

    $ test -r /tmp/abc ; echo $?
    0
    $ /usr/bin/test -r /tmp/abc ; echo $?
    0

Please reopen this bug if you can still reproduce this issue.

Regards,

--
Gioele Barabucci

--- End Message ---

Reply via email to