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

Fixed check for extended attributes #2336

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion kiwi/utils/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ def target_supports_extended_attributes(self) -> bool:
try:
os.getxattr(self.target_dir, 'user.mime_type')
except OSError as e:
if e.errno not in (errno.EPERM, errno.ENOTSUP, errno.ENODATA):
log.debug(
f'Check for extended attributes on {self.target_dir} said: {e}'
)
if e.errno == errno.ENOTSUP:
return False
return True
7 changes: 4 additions & 3 deletions test/unit/utils/sync_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import errno
import logging
from pytest import fixture
from stat import ST_MODE
Expand Down Expand Up @@ -66,7 +67,7 @@ def test_target_supports_extended_attributes(self, mock_getxattr):

@patch('os.getxattr')
def test_target_does_not_support_extended_attributes(self, mock_getxattr):
mock_getxattr.side_effect = OSError(
"""[Errno 95] Operation not supported: b'/boot/efi"""
)
effect = OSError()
effect.errno = errno.ENOTSUP
mock_getxattr.side_effect = effect
assert self.sync.target_supports_extended_attributes() is False
Loading