tools: Fix dry run of libvirt_recover_xattrs.sh

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: 5377177f80
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2021-02-24 17:17:41 +01:00
parent 78879650e4
commit e19171b40c

View File

@ -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