]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_db: Don't ASSERT on unrecognized metadata
authorCarlos Maiolino <cmaiolino@redhat.com>
Thu, 31 May 2018 19:10:42 +0000 (14:10 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 31 May 2018 19:10:42 +0000 (14:10 -0500)
For some types, (for example attr3) if the metadata is not recognized
as the requested type, we can hit an ASSERT when trying to print
the type:

xfs_db: print.c:164: print_flist_1: Assertion `fa->arg & 64' failed.
Aborted (core dumped)

This can happen for corrupted metadata or even just a misdirected
user command; there's no reason to ASSERT.  If we get here, print
something helpful and carry on.

[sandeen: write the commit log]

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
db/print.c

index 0da36c278b90274a2d6e69073b95ade52f692852..f8a482810f0af11ffb0629abf4f58b424f2554f3 100644 (file)
@@ -160,9 +160,10 @@ print_flist_1(
                                        (f->flags & FLD_ARRAY) != 0);
                                if (neednl)
                                        dbprintf("\n");
-                       } else {
-                               ASSERT(fa->arg & FTARG_OKEMPTY);
+                       } else if (fa->arg & FTARG_OKEMPTY) {
                                dbprintf(_("(empty)\n"));
+                       } else {
+                               dbprintf(_("Unrecognized metadata or type mismatch\n"));
                        }
                }
                free_strvec(pfx);