]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tools: Fix dry run of libvirt_recover_xattrs.sh
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 24 Feb 2021 16:17:41 +0000 (17:17 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 2 Mar 2021 08:42:38 +0000 (09:42 +0100)
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's 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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tools/libvirt_recover_xattrs.sh

index 59f1f3f4761fd87e4e29d79968928932688992f3..be6ee84b5f4102d66f7d87294a3979f521b6920b 100755 (executable)
@@ -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