canonical / craft-parts

https://canonical-craft-parts.readthedocs-hosted.com
GNU Lesser General Public License v3.0
11 stars 36 forks source link

CI failing due to xattrs not supported #661

Open lengau opened 7 months ago

lengau commented 7 months ago

Bug Description

It appears a GitHub runner update has disable xattrs or changed filesystems? Regardless, tests are failing now.

To Reproduce

https://github.com/canonical/craft-parts/actions/workflows/tests.yaml

part yaml

n/a

Relevant log output

=================================== FAILURES ===================================
  ____________ TestOriginStagePackage.test_mark_origin_stage_package _____________

  path = '.tests-xattr-test-dir/bar'
  key = 'user.craft_parts.origin_stage_package', value = 'package'

      def write_xattr(path: str, key: str, value: str) -> None:
          """Add extended attribute metadata to a file.

          :param path: The file to add metadata to.
          :param key: The attribute key.
          :param value: The attribute value.
          """
          if sys.platform != "linux":
              raise RuntimeError("xattr support only available for Linux")

          # Extended attributes do not apply to symlinks.
          if os.path.islink(path):
              return

          key = f"user.craft_parts.{key}"

          try:
  >           os.setxattr(path, key, value.encode())
  E           OSError: [Errno 95] Operation not supported: '.tests-xattr-test-dir/bar'

  /home/runner/work/craft-parts/craft-parts/craft_parts/xattrs.py:77: OSError

  The above exception was the direct cause of the following exception:

  self = <tests.unit.packages.test_base.TestOriginStagePackage object at 0x7f5c3a1ba6f0>

      @pytest.mark.usefixtures("new_dir")
      def test_mark_origin_stage_package(self):
          test_dir = Path(".tests-xattr-test-dir")
          test_dir.mkdir()

          Path(test_dir / "foo").touch()
          Path(test_dir / "bar").touch()

  >       base.mark_origin_stage_package(str(test_dir), "package")

  /home/runner/work/craft-parts/craft-parts/tests/unit/packages/test_base.py:119: 
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  /home/runner/work/craft-parts/craft-parts/craft_parts/packages/base.py:274: in mark_origin_stage_package
      write_origin_stage_package(file_path, stage_package)
  /home/runner/work/craft-parts/craft-parts/craft_parts/packages/base.py:264: in write_origin_stage_package
      xattrs.write_xattr(path, _STAGE_PACKAGE_KEY, value)
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

  path = '.tests-xattr-test-dir/bar'
  key = 'user.craft_parts.origin_stage_package', value = 'package'

      def write_xattr(path: str, key: str, value: str) -> None:
          """Add extended attribute metadata to a file.

          :param path: The file to add metadata to.
          :param key: The attribute key.
          :param value: The attribute value.
          """
          if sys.platform != "linux":
              raise RuntimeError("xattr support only available for Linux")

          # Extended attributes do not apply to symlinks.
          if os.path.islink(path):
              return

          key = f"user.craft_parts.{key}"

          try:
              os.setxattr(path, key, value.encode())
          except OSError as error:
              # Label is too long for filesystem:
              # OSError: [Errno 7] Argument list too long: b'<path>'
              if error.errno == 7:  # noqa: PLR2004
                  raise errors.XAttributeTooLong(path=path, key=key, value=value) from error

              # Chain unknown variants of OSError.
  >           raise errors.XAttributeError(key=key, path=path, is_write=True) from error
  E           craft_parts.errors.XAttributeError: Unable to write extended attribute.
  E           Failed to write attribute 'user.craft_parts.origin_stage_package' on '.tests-xattr-test-dir/bar'.
  E           Make sure your filesystem supports extended attributes.

  /home/runner/work/craft-parts/craft-parts/craft_parts/xattrs.py:85: XAttributeError
  - generated xml file: /home/runner/work/craft-parts/craft-parts/results/test-results-test-py312.xml -
syncronize-issues-to-jira[bot] commented 4 months ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-2948.

This message was autogenerated