Skip to content

Commit

Permalink
Merge pull request #2336 from OSInside/fix_xattr_check
Browse files Browse the repository at this point in the history
Fixed check for extended attributes
  • Loading branch information
Conan-Kudo authored Jul 25, 2023
2 parents 48e43f8 + 3669d8c commit 7528c35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
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

0 comments on commit 7528c35

Please sign in to comment.