mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-30 16:10:36 +00:00
composefs: fix check with restricted listxattr (#573977)
This commit is contained in:
48
pkgs/by-name/co/composefs/catch_xattr_errors.patch
Normal file
48
pkgs/by-name/co/composefs/catch_xattr_errors.patch
Normal file
@@ -0,0 +1,48 @@
|
||||
From 5ff87511c2bacd825b00e1503bbf828a1c2e8265 Mon Sep 17 00:00:00 2001
|
||||
From: Kiskae <Kiskae@users.noreply.github.com>
|
||||
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
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user