juicedata / juicefs

JuiceFS is a distributed POSIX file system built on top of Redis and S3.
https://juicefs.com
Apache License 2.0
10.61k stars 926 forks source link

can't print system.posix_acl_access xattr after setfacl #4483

Closed zhoucheng361 closed 6 months ago

zhoucheng361 commented 6 months ago

What happened: Reproduce script:

    def test_4483(self):
        state = JuicefsMachine()
        v1 = state.init_folders()
        state.set_acl(default=True, entry=v1, group='root', group_perm={'r'}, logical=True, mask={'r'}, not_recalc_mask=False, other_perm={'r', 'x'}, physical=False, recalc_mask=False, recursive=True, set_mask=True, sudo_user='user1', user='user2', user_perm={'r', 'w', 'x'})
        v4 = state.create_file(content=b'\xe65', file_name='abha', mode='a', parent=v1, umask=3, user='root')
        v5 = state.set_acl(default=False, entry=v4, group='user3', group_perm={'x'}, logical=False, mask={'x'}, not_recalc_mask=True, other_perm=set(), physical=True, recalc_mask=True, recursive=False, set_mask=False, sudo_user='root', user='user1', user_perm=set())
        state.list_xattr(file=v4, user='root')
        state.teardown()

Log:

root@bench-01:~/juicefs# python3 .github/scripts/hypo/fsrand2_test.py -k test_xxx
setup_logger ./log1
setup_logger ./log2
__init__
duration is 0.029425621032714844
2024-03-11 17:27:11,224 - INFO - run_cmd: sudo -u user1 setfacl -d -R   -L  -m u:user2:wxr,g:root:r,o::xr,m::r /tmp/fsrand/
2024-03-11 17:27:11,229 - INFO - do_set_acl /tmp/fsrand/ {'user_perm': 'wxr', 'group_perm': 'r', 'other_perm': 'xr'} failed:
setfacl: /tmp/fsrand/: Operation not permitted
2024-03-11 17:27:11,229 - INFO - run_cmd: sudo -u user1 setfacl -d -R   -L  -m u:user2:wxr,g:root:r,o::xr,m::r /tmp/jfs/fsrand/
2024-03-11 17:27:11,235 - INFO - do_set_acl /tmp/jfs/fsrand/ {'user_perm': 'wxr', 'group_perm': 'r', 'other_perm': 'xr'} failed:
setfacl: /tmp/jfs/fsrand/: Operation not permitted
2024-03-11 17:27:11,235 - INFO - do_create_file /tmp/fsrand/abha with mode a succeed
2024-03-11 17:27:11,242 - INFO - do_create_file /tmp/jfs/fsrand/abha with mode a succeed
2024-03-11 17:27:11,242 - INFO - run_cmd: sudo -u root setfacl   --mask --no-mask   -m u:user1:-,g:user3:x,o::- /tmp/fsrand/abha
run_cmd:getfacl /tmp/fsrand/abha
2024-03-11 17:27:11,248 - INFO - do_set_acl /tmp/fsrand/abha with u:user1:-,g:user3:x,o::- succeed
2024-03-11 17:27:11,248 - INFO - run_cmd: sudo -u root setfacl   --mask --no-mask   -m u:user1:-,g:user3:x,o::- /tmp/jfs/fsrand/abha
run_cmd:getfacl /tmp/jfs/fsrand/abha
2024-03-11 17:27:11,257 - INFO - do_set_acl /tmp/jfs/fsrand/abha with u:user1:-,g:user3:x,o::- succeed
2024-03-11 17:27:11,257 - INFO - do_list_xattr /tmp/fsrand/abha succeed
2024-03-11 17:27:11,257 - INFO - do_list_xattr /tmp/jfs/fsrand/abha succeed
F
======================================================================
FAIL: test_xxx (__main__.TestFsrand2)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ".github/scripts/hypo/fsrand2_test.py", line 145, in test_xxx
    state.list_xattr(file=v4, user='root')
  File "/root/juicefs/.github/scripts/hypo/fsrand2.py", line 366, in list_xattr
    user = st.sampled_from(SUDO_USERS))
  File "/root/hypothesis/hypothesis-python/src/hypothesis/stateful.py", line 681, in rule_wrapper
    return f(*args, **kwargs)
  File "/root/juicefs/.github/scripts/hypo/fsrand2.py", line 366, in list_xattr
    user = st.sampled_from(SUDO_USERS))
  File "/root/hypothesis/hypothesis-python/src/hypothesis/stateful.py", line 802, in precondition_wrapper
    return f(*args, **kwargs)
  File "/root/juicefs/.github/scripts/hypo/fsrand2.py", line 371, in list_xattr
    assert self.equal(result1, result2), f'\033[31mlist_xattr:\nresult1 is {result1}\nresult2 is {result2}\033[0m'
AssertionError: list_xattr:
result1 is [('system.posix_acl_access', b'\x02\x00\x00\x00\x01\x00\x06\x00\xff\xff\xff\xff\x02\x00\x00\x00\xc6\r\x00\x00\x04\x00\x06\x00\xff\xff\xff\xff\x08\x00\x01\x00\xc8\r\x00\x00\x10\x00\x06\x00\xff\xff\xff\xff \x00\x00\x00\xff\xff\xff\xff')]
result2 is []

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?

Environment:

zhoucheng361 commented 6 months ago

fixed by d188bda