Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setxattr failed with special name. #4803

Open
zhoucheng361 opened this issue Apr 28, 2024 · 3 comments · May be fixed by #4873
Open

setxattr failed with special name. #4803

zhoucheng361 opened this issue Apr 28, 2024 · 3 comments · May be fixed by #4873
Labels
pending Solution to this issue is not decided

Comments

@zhoucheng361
Copy link
Contributor

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:
@zhoucheng361 zhoucheng361 added the kind/bug Something isn't working label Apr 28, 2024
@zhoucheng361 zhoucheng361 changed the title setxattr failed. setxattr failed with special name. Apr 28, 2024
@jiefenghuang
Copy link
Contributor

TBD: It's strange that the ORM library converts this special character, causing "R" and "\x8ar" to be judged as equal. "\x8a" is also not a special escape character in MySQL.

@davies
Copy link
Contributor

davies commented May 6, 2024

FoldEqual?Maybe we should store the xattr names as binary in SQL database.

@jiefenghuang
Copy link
Contributor

FoldEqual?Maybe we should store the xattr names as binary in SQL database.

It doesn’t seem to be a problem with FoldEqual. Storing xattr name as binary seems better, but it seems handling compatibility with older versions of metadata could be challenging.

@davies davies linked a pull request May 20, 2024 that will close this issue
@SandyXSD SandyXSD added the pending Solution to this issue is not decided label May 29, 2024
@davies davies removed the kind/bug Something isn't working label Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending Solution to this issue is not decided
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants