From 9969a49144a7ff118eba6ec461012f54834dfd2d Mon Sep 17 00:00:00 2001 From: Kiskae Date: Wed, 14 Oct 2026 13:33:19 +0200 Subject: [PATCH] composefs: fix check with restricted listxattr Fixes #567933 --- .../co/composefs/catch_xattr_errors.patch | 48 +++++++++++++++++++ pkgs/by-name/co/composefs/package.nix | 7 +++ 2 files changed, 55 insertions(+) create mode 100644 pkgs/by-name/co/composefs/catch_xattr_errors.patch diff --git a/pkgs/by-name/co/composefs/catch_xattr_errors.patch b/pkgs/by-name/co/composefs/catch_xattr_errors.patch new file mode 100644 index 000000000000..b88b7b144be9 --- /dev/null +++ b/pkgs/by-name/co/composefs/catch_xattr_errors.patch @@ -0,0 +1,48 @@ +From 5ff87511c2bacd825b00e1503bbf828a1c2e8265 Mon Sep 17 00:00:00 2001 +From: Kiskae +Date: Wed, 14 Oct 2026 13:27:09 +0200 +Subject: [PATCH] tests/dumpdir: Don't exit with exception if xattr not + supported + +This was already the case with gendir. +--- + tests/dumpdir | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/tests/dumpdir b/tests/dumpdir +index a60a2970..876118b2 100755 +--- a/tests/dumpdir ++++ b/tests/dumpdir +@@ -6,6 +6,7 @@ import shlex + import hashlib + import stat + import argparse ++import errno + + def log_error(error): + print("Readdir error: " + error) +@@ -20,6 +21,15 @@ def has_whiteout_child(path): + return True + return False + ++def list_xattrs(file): ++ try: ++ return sorted(os.listxattr(file, follow_symlinks=False)) ++ except OSError as e: ++ # Not much we can do if the backing fs doesn't allow xattrs ++ if e.errno not in (errno.EPERM, errno.ENOTSUP): ++ raise ++ return [] ++ + def dumpfile(file, root): + rel = os.path.relpath(file, root) + s = os.lstat(file) +@@ -53,7 +63,7 @@ def dumpfile(file, root): + link = os.readlink(file) + print(f" ->{shlex.quote(link)}",end="") + +- for attr in sorted(os.listxattr(file, follow_symlinks=False)): ++ for attr in list_xattrs(file): + v = os.getxattr(file, attr, follow_symlinks=False) + xattrs[attr] = v + \ No newline at end of file diff --git a/pkgs/by-name/co/composefs/package.nix b/pkgs/by-name/co/composefs/package.nix index 27f7a590d112..e37ba7cefeaf 100644 --- a/pkgs/by-name/co/composefs/package.nix +++ b/pkgs/by-name/co/composefs/package.nix @@ -47,6 +47,9 @@ stdenv.mkDerivation (finalAttrs: { url = "https://github.com/composefs/composefs/commit/b3cb176a771386081c993e29ae42e77dabe5a577.patch"; hash = "sha256-nzUENLM24G6NezhPywVsRzRgWmL1VZdMfZTsXNorJl8="; }) + # tests/dumpdir: Don't exit with exception if xattr not supported + # https://github.com/composefs/composefs/pull/450 + ./catch_xattr_errors.patch ]; postPatch = @@ -92,6 +95,10 @@ stdenv.mkDerivation (finalAttrs: { preCheck = '' patchShebangs --build ../tests/*dir ../tests/*.sh + + # Do not access xattrs + substituteInPlace ../tests/test-*.sh \ + --replace-quiet "mkcomposefs" "mkcomposefs --skip-xattrs" ''; passthru = {