[PATCH 2/8] common/rc: fix unicode checker detection in xfs_scrub

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <djwong@xxxxxxxxxx>

_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@xxxxxxx>
Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
---
 common/rc |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)


diff --git a/common/rc b/common/rc
index c63add75..b3289de9 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




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux