[PATCH] tools: Fix dry run of libvirt_recover_xattrs.sh

Michal Privoznik mprivozn at redhat.com
Mon Mar 1 16:53:21 UTC 2021


The libvirt_recover_xattrs.sh script can be used to remove stale
XATTRs that were left behind by secdrivers (which should happen
only if there' an imbalance between set and restore calls).
Anyway, the script has '-n' switch which is supposed to perform
just a dry run, i.e. just to report which files have XATTRs set
without any attempt to remove them.

But, when rewriting the script a few months ago a typo was
introduced which made the script report no files even if there
were files with XATTRs.

Fixes: 5377177f80da40ee7d47601400b50835f093715a
Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 tools/libvirt_recover_xattrs.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libvirt_recover_xattrs.sh b/tools/libvirt_recover_xattrs.sh
index 59f1f3f476..be6ee84b5f 100755
--- a/tools/libvirt_recover_xattrs.sh
+++ b/tools/libvirt_recover_xattrs.sh
@@ -90,7 +90,7 @@ fix_xattrs() {
 
     for i in $(getfattr -R -d -m ${XATTR_PREFIX} --absolute-names ${DIR} 2>/dev/null | grep "^# file:" | cut -d':' -f 2); do
         if [ ${DRY_RUN} -ne 0 ]; then
-            getfattr -d -m $p --absolute-names $i | grep -v "^# file:"
+            getfattr -d -m ${XATTR_PREFIX} --absolute-names $i
             continue
         fi
 
-- 
2.26.2




More information about the libvir-list mailing list