From: "Darrick J. Wong" <djwong@kernel.org>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Theodore Ts'o <tytso@mit.edu>,
linux-xfs@vger.kernel.org, allison.henderson@oracle.com
Subject: Re: [PATCH v2 12/17] xfs_scrub: report optional features in version string
Date: Fri, 25 Feb 2022 16:04:21 -0800 [thread overview]
Message-ID: <20220226000421.GT8313@magnolia> (raw)
In-Reply-To: <3ef560bc-25ae-2fa2-26c0-844acf800c24@sandeen.net>
On Fri, Feb 25, 2022 at 04:14:13PM -0600, Eric Sandeen wrote:
> On 1/19/22 7:32 PM, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > Ted Ts'o reported brittleness in the fstests logic in generic/45[34] to
> > detect whether or not xfs_scrub is capable of detecting Unicode mischief
> > in directory and xattr names. This is a compile-time feature, since we
> > do not assume that all distros will want to ship xfsprogs with libicu.
> >
> > Rather than relying on ldd tests (which don't work at all if xfs_scrub
> > is compiled statically), let's have -V print whether or not the feature
> > is built into the tool. Phase 5 still requires the presence of "UTF-8"
> > in LC_MESSAGES to enable Unicode confusable detection; this merely makes
> > the feature easier to discover.
> >
> > Reported-by: Theodore Ts'o <tytso@mit.edu>
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> > v2: correct the name of the reporter
> > ---
>
> Hum, every single other utility just does "$progname version $version"
> and I'm not that keen to tack on something for everyone, if it won't
> really mean anything to anyone except xfstests scripts ;)
>
> What about adding an "-F" to display features, and xfstests can use that,
> and xfs_scrub -V will keep acting like every other utility?
>
> Other utilities could use this too if we ever cared (though xfs_db
> and xfs_io already have an "-F" option ... we could choose -Z for
> featureZ, which is unused as a primary option anywhere ...)
>
> like so:
>
> ===
>
> diff --git a/man/man8/xfs_scrub.8 b/man/man8/xfs_scrub.8
> index e881ae76..65d8f4a2 100644
> --- a/man/man8/xfs_scrub.8
> +++ b/man/man8/xfs_scrub.8
> @@ -8,7 +8,7 @@ xfs_scrub \- check and repair the contents of a mounted XFS filesystem
> ]
> .I mount-point
> .br
> -.B xfs_scrub \-V
> +.B xfs_scrub \-V | \-F
> .SH DESCRIPTION
> .B xfs_scrub
> attempts to check and repair all metadata in a mounted XFS filesystem.
> @@ -76,6 +76,9 @@ If
> is given, no action is taken if errors are found; this is the default
> behavior.
> .TP
> +.B \-F
> +Prints the version number along with optional build-time features and exits.
> +.TP
> .B \-k
> Do not call TRIM on the free space.
> .TP
> diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c
> index bc2e84a7..9e9a098c 100644
> --- a/scrub/xfs_scrub.c
> +++ b/scrub/xfs_scrub.c
> @@ -582,6 +582,13 @@ report_outcome(
> }
> }
>
> +/* Compile-time features discoverable via version strings */
> +#ifdef HAVE_LIBICU
> +# define XFS_SCRUB_HAVE_UNICODE "+"
> +#else
> +# define XFS_SCRUB_HAVE_UNICODE "-"
> +#endif
> +
> int
> main(
> int argc,
> @@ -613,7 +620,7 @@ main(
> pthread_mutex_init(&ctx.lock, NULL);
> ctx.mode = SCRUB_MODE_REPAIR;
> ctx.error_action = ERRORS_CONTINUE;
> - while ((c = getopt(argc, argv, "a:bC:de:km:nTvxV")) != EOF) {
> + while ((c = getopt(argc, argv, "a:bC:de:Fkm:nTvxV")) != EOF) {
> switch (c) {
> case 'a':
> ctx.max_errors = cvt_u64(optarg, 10);
> @@ -654,6 +661,12 @@ main(
> usage();
> }
> break;
> + case 'F':
> + fprintf(stdout, _("%s version %s %sUnicode\n"),
> + progname, VERSION,
> + XFS_SCRUB_HAVE_UNICODE);
> + fflush(stdout);
> + return SCRUB_RET_SUCCESS;
Works for me!
--D
> case 'k':
> want_fstrim = false;
> break;
next prev parent reply other threads:[~2022-02-26 0:04 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-20 0:21 [PATCHSET 00/17] xfsprogs: various 5.15 fixes Darrick J. Wong
2022-01-20 0:21 ` [PATCH 01/17] libxcmd: use emacs mode for command history editing Darrick J. Wong
2022-01-20 0:21 ` [PATCH 02/17] libxfs: shut down filesystem if we xfs_trans_cancel with deferred work items Darrick J. Wong
2022-02-04 21:36 ` Eric Sandeen
2022-02-04 21:47 ` Darrick J. Wong
2022-01-20 0:21 ` [PATCH 03/17] libxfs: don't leave dangling perag references from xfs_buf Darrick J. Wong
2022-02-04 22:05 ` Eric Sandeen
2022-01-20 0:21 ` [PATCH 04/17] libfrog: move the GETFSMAP definitions into libfrog Darrick J. Wong
2022-02-04 23:18 ` Eric Sandeen
2022-02-05 0:36 ` Darrick J. Wong
2022-02-07 1:05 ` Dave Chinner
2022-02-07 17:09 ` Darrick J. Wong
2022-02-07 21:32 ` Eric Sandeen
2022-02-10 3:33 ` Dave Chinner
2022-02-08 16:46 ` [PATCH v1.1 04/17] libfrog: always use the kernel GETFSMAP definitions Darrick J. Wong
2022-02-25 22:35 ` Eric Sandeen
2022-01-20 0:22 ` [PATCH 05/17] misc: add a crc32c self test to mkfs and repair Darrick J. Wong
2022-02-04 23:23 ` Eric Sandeen
2022-01-20 0:22 ` [PATCH 06/17] libxfs-apply: support filterdiff >= 0.4.2 only Darrick J. Wong
2022-01-20 0:22 ` [PATCH 07/17] xfs_db: fix nbits parameter in fa_ino[48] functions Darrick J. Wong
2022-02-25 21:45 ` Eric Sandeen
2022-01-20 0:22 ` [PATCH 08/17] xfs_repair: explicitly cast resource usage counts in do_warn Darrick J. Wong
2022-02-25 21:46 ` Eric Sandeen
2022-01-20 0:22 ` [PATCH 09/17] xfs_repair: explicitly cast directory inode numbers " Darrick J. Wong
2022-02-25 21:48 ` Eric Sandeen
2022-01-20 0:22 ` [PATCH 10/17] xfs_repair: fix indentation problems in upgrade_filesystem Darrick J. Wong
2022-02-25 21:53 ` Eric Sandeen
2022-01-20 0:22 ` [PATCH 11/17] xfs_repair: update secondary superblocks after changing features Darrick J. Wong
2022-02-25 21:57 ` Eric Sandeen
2022-01-20 0:22 ` [PATCH 12/17] xfs_scrub: report optional features in version string Darrick J. Wong
2022-01-20 1:16 ` Theodore Ts'o
2022-01-20 1:28 ` Darrick J. Wong
2022-01-20 1:32 ` [PATCH v2 " Darrick J. Wong
2022-02-25 22:14 ` Eric Sandeen
2022-02-26 0:04 ` Darrick J. Wong [this message]
2022-02-26 2:48 ` Darrick J. Wong
2022-02-26 2:53 ` [PATCH v3 " Darrick J. Wong
2022-02-28 21:38 ` Eric Sandeen
2022-01-20 0:22 ` [PATCH 13/17] mkfs: prevent corruption of passed-in suboption string values Darrick J. Wong
2022-01-20 0:22 ` [PATCH 14/17] mkfs: add configuration files for the last few LTS kernels Darrick J. Wong
2022-01-20 0:22 ` [PATCH 15/17] mkfs: document sample configuration file location Darrick J. Wong
2022-01-20 0:23 ` [PATCH 16/17] mkfs: add a config file for x86_64 pmem filesystems Darrick J. Wong
2022-02-25 22:21 ` Eric Sandeen
2022-02-26 2:38 ` Darrick J. Wong
2022-02-26 2:52 ` [PATCH v2 " Darrick J. Wong
2022-02-28 21:37 ` Eric Sandeen
2022-01-20 0:23 ` [PATCH 17/17] mkfs: enable inobtcount and bigtime by default Darrick J. Wong
2022-02-25 22:22 ` Eric Sandeen
2022-01-28 22:44 ` [PATCH 18/17] xfs_scrub: fix reporting if we can't open raw block devices Darrick J. Wong
2022-01-31 12:28 ` Christoph Hellwig
2022-02-26 2:54 ` [PATCH 19/17] mkfs: increase default log size for new (aka bigtime) filesystems Darrick J. Wong
2022-02-26 21:37 ` Dave Chinner
2022-02-28 23:22 ` Darrick J. Wong
2022-03-01 0:42 ` Dave Chinner
2022-03-01 2:38 ` Darrick J. Wong
2022-03-01 15:55 ` Brian Foster
2022-03-01 3:10 ` Dave Chinner
2022-02-28 21:44 ` Eric Sandeen
2022-03-01 2:21 ` Darrick J. Wong
2022-03-01 2:44 ` Eric Sandeen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220226000421.GT8313@magnolia \
--to=djwong@kernel.org \
--cc=allison.henderson@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@sandeen.net \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).