aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-01-11 13:50:19 -0800
committerEryu Guan <guaneryu@gmail.com>2022-01-16 12:56:18 +0800
commit3f79f632b07371f486cf9754c76ef53b4c579018 (patch)
treeb99ea45cdf8c7fbf493fc8d45bc2181ea9796bb8
parent94232f08cb9c0b869426b2926f504c3428ac6c81 (diff)
downloadxfstests-dev-3f79f632b07371f486cf9754c76ef53b4c579018.tar.gz
common/rc: fix unicode checker detection in xfs_scrub
_check_xfs_scrub_does_unicode is still less than adequate -- if running ldd to report the xfs_scrub binary's dynamic library dependencies doesn't work, we could still detect support by grepping for strings that only appear when the unicode checker is built. Note that this isn't the final word on all of this; I will make this easier to discover in a future xfs_scrub release. Cc: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
-rw-r--r--common/rc19
1 files changed, 14 insertions, 5 deletions
diff --git a/common/rc b/common/rc
index c63add750a..b3289de985 100644
--- a/common/rc
+++ b/common/rc
@@ -4726,13 +4726,22 @@ _check_xfs_scrub_does_unicode() {
_supports_xfs_scrub "${mount}" "${dev}" || return 1
- # We only care if xfs_scrub has unicode string support...
- if ! type ldd > /dev/null 2>&1 || \
- ! ldd "${XFS_SCRUB_PROG}" 2> /dev/null | grep -q libicui18n; then
- return 1
+ # If the xfs_scrub binary contains the string "Unicode name.*%s", then
+ # we know that it has the ability to complain about improper Unicode
+ # names.
+ if strings "${XFS_SCRUB_PROG}" | grep -q 'Unicode name.*%s'; then
+ return 0
fi
- return 0
+ # If the xfs_scrub binary is linked against the libicui18n Unicode
+ # library, then we surmise that it contains the Unicode name checker.
+ if type ldd > /dev/null 2>&1 && \
+ ldd "${XFS_SCRUB_PROG}" 2> /dev/null | grep -q libicui18n; then
+ return 0
+ fi
+
+ # We could not establish that xfs_scrub supports unicode names.
+ return 1
}
# exfat timestamps start at 1980 and cannot be prior to epoch