Skip to content

setxattr failed with special name. #4803

@zhoucheng361

Description

@zhoucheng361

What happened:

reproduce:
root@bench-01:~/juicefs# cat .github/scripts/hypo/fs_test.py
    def test_xattr(self):
        state = JuicefsMachine()
        v1 = state.init_folders()
        v19 = state.create_file(content=b'\xb5y', file_name='wums', mode='x', parent=v1, umask=16, user='root')
        v29 = state.set_xattr(file=v19, flag=2, name='R', user='root', value=b'(9')
        state.set_xattr(file=v19, flag=2, name='\x8ar', user='root', value=b'E$\xfe')
        state.teardown()

log:
root@bench-01:~/juicefs# python3 .github/scripts/hypo/fs_test.py -k test_xattr
setup_logger ./fs1.log
setup_logger ./fs2.log
__init__
duration is 0.02861332893371582
2024-04-28 17:12:52,627 - INFO - do_create_file /tmp/fsrand/wums with mode x succeed
2024-04-28 17:12:52,641 - INFO - do_create_file /tmp/jfs/fsrand/wums with mode x succeed
2024-04-28 17:12:52,642 - INFO - do_set_xattr /tmp/fsrand/wums user.R b'(9' 2 succeed
2024-04-28 17:12:52,644 - INFO - do_set_xattr /tmp/jfs/fsrand/wums user.R b'(9' 2 succeed
2024-04-28 17:12:52,645 - INFO - do_set_xattr /tmp/fsrand/wums user.�r b'E$\xfe' 2 succeed
2024-04-28 17:12:52,646 - INFO - do_set_xattr /tmp/jfs/fsrand/wums {'name': '\x8ar', 'value': b'E$\xfe', 'flag': 2, 'user': 'root'} failed: [Errno 17] File exists: b'/tmp/jfs/fsrand/wums'
F
======================================================================
FAIL: test_xattr (__main__.TestFsrand2)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ".github/scripts/hypo/fs_test.py", line 61, in test_xattr
    state.set_xattr(file=v19, flag=2, name='\x8ar', user='root', value=b'E$\xfe')
  File "/root/juicefs/.github/scripts/hypo/fs.py", line 346, in set_xattr
    file = Files.filter(lambda x: x != multiple()),
  File "/root/hypothesis/hypothesis-python/src/hypothesis/stateful.py", line 681, in rule_wrapper
    return f(*args, **kwargs)
  File "/root/juicefs/.github/scripts/hypo/fs.py", line 346, in set_xattr
    file = Files.filter(lambda x: x != multiple()),
  File "/root/hypothesis/hypothesis-python/src/hypothesis/stateful.py", line 802, in precondition_wrapper
    return f(*args, **kwargs)
  File "/root/juicefs/.github/scripts/hypo/fs.py", line 357, in set_xattr
    assert self.equal(result1, result2), f'\033[31mset_xattr:\nresult1 is {result1}\nresult2 is {result2}\033[0m'
AssertionError: set_xattr:
result1 is (b'E$\xfe',)
result2 is [Errno 17] File exists: b'/tmp/jfs/fsrand/wums'

What you expected to happen:

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

Anything else we need to know?

Environment:

  • JuiceFS version (use juicefs --version) or Hadoop Java SDK version:
  • Cloud provider or hardware configuration running JuiceFS:
  • OS (e.g cat /etc/os-release):
  • Kernel (e.g. uname -a):
  • Object storage (cloud provider and region, or self maintained):
  • Metadata engine info (version, cloud provider managed or self maintained):
  • Network connectivity (JuiceFS to metadata engine, JuiceFS to object storage):
  • Others:

Metadata

Metadata

Assignees

No one assigned

    Labels

    pendingSolution to this issue is not decided

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions